Skip to content

Commit

Permalink
add test for token decimal places
Browse files Browse the repository at this point in the history
  • Loading branch information
janmazak committed May 24, 2022
1 parent fdbf752 commit c923179
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/integration/__fixtures__/signTx.ts
Expand Up @@ -880,6 +880,35 @@ export const testsMary: TestcaseMary[] = [
auxiliaryDataSupplement: null,
},
},
{
// TODO not enough, should have a test for outputs too, and use a network that does not give a warning
testname: "Sign tx with mint with decimal places",
tx: {
...maryBase,
outputs: [],
ttl: undefined,
validityIntervalStart: undefined,
mint: mints.mintWithDecimalPlaces,
},
signingMode: TransactionSigningMode.ORDINARY_TRANSACTION,
txBody: "a400818258203b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b700018002182a09a2581c6954264b15bc92d6d592febeac84f14645e1ed46ca5ebb9acdb5c15fa14553545249503a0034bf14581caf2e27f580f7f08e93190a81f72462f153026d06450924726645891ba244445249501904d24cffffffffffffffffffffffff1904d2",
result: {
txHashHex: "94748b2eb870881e38fd6ecea5142f52d6ebc4d51314b6fc012de31c4462a523",
"witnesses": [
{
"path": [
2147485500,
2147485463,
2147483648,
0,
0,
],
"witnessSignatureHex": "399008a7679a144a2a9827d6b671377a7e965c6dec0073fa92aa3f0313e24d0f9fb3555bded5f7bcd11356180ae99b58cb083ba848e41d3b3761fd3e2efedd0b",
},
],
auxiliaryDataSupplement: null,
},
},
{
testname: "Sign tx with mint fields among other fields",
tx: {
Expand Down
28 changes: 28 additions & 0 deletions test/integration/__fixtures__/txElements.ts
Expand Up @@ -210,11 +210,39 @@ export const destinations: Record<
}

export const mints: Record<
| 'mintWithDecimalPlaces'
| 'mintAmountVariety'
| 'mintInvalidCanonicalOrderingPolicy'
| 'mintInvalidCanonicalOrderingAssetName'
, Array<AssetGroup>
> = {
mintWithDecimalPlaces: [
{
policyIdHex: "6954264b15bc92d6d592febeac84f14645e1ed46ca5ebb9acdb5c15f",
tokens: [
{
// fingerprint: asset155nxgqj5acff7fdhc8ranfwyl7nq4ljrks7l6w
assetNameHex: "5354524950",
amount: "-3456789", // -3,456.789
},
],
},
{
policyIdHex: "af2e27f580f7f08e93190a81f72462f153026d06450924726645891b",
tokens: [
{
// fingerprint: asset14yqf3pclzx88jjahydyfad8pxw5xhuca6j7k2p
assetNameHex: "44524950",
amount: "1234", // 0.01234
},
{
// fingerprint: asset12wejgxu04lpg6h3pm056qd207k2sfh7yjklclf
assetNameHex: "ffffffffffffffffffffffff",
amount: "1234", // 1,234 with warning
},
],
},
],
mintAmountVariety: [
{
// fingerprints taken from CIP 14 draft
Expand Down

0 comments on commit c923179

Please sign in to comment.