From 555fa7cf45bf01d2562a2ce34aa8a60e6566dcf1 Mon Sep 17 00:00:00 2001 From: janniks Date: Fri, 15 Jul 2022 16:57:09 -0400 Subject: [PATCH] test: add pox abi tests --- packages/stacking/tests/poxAbi.json | 678 +++++++++++++++++++++++ packages/stacking/tests/stacking.test.ts | 39 +- 2 files changed, 712 insertions(+), 5 deletions(-) create mode 100644 packages/stacking/tests/poxAbi.json diff --git a/packages/stacking/tests/poxAbi.json b/packages/stacking/tests/poxAbi.json new file mode 100644 index 00000000..454a1903 --- /dev/null +++ b/packages/stacking/tests/poxAbi.json @@ -0,0 +1,678 @@ +{ + "functions": [ + { + "name": "add-pox-addr-to-ith-reward-cycle", + "access": "private", + "args": [ + { "name": "cycle-index", "type": "uint128" }, + { + "name": "params", + "type": { + "tuple": [ + { "name": "amount-ustx", "type": "uint128" }, + { "name": "first-reward-cycle", "type": "uint128" }, + { "name": "i", "type": "uint128" }, + { "name": "num-cycles", "type": "uint128" }, + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + } + ] + } + } + ], + "outputs": { + "type": { + "tuple": [ + { "name": "amount-ustx", "type": "uint128" }, + { "name": "first-reward-cycle", "type": "uint128" }, + { "name": "i", "type": "uint128" }, + { "name": "num-cycles", "type": "uint128" }, + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + } + ] + } + } + }, + { + "name": "add-pox-addr-to-reward-cycles", + "access": "private", + "args": [ + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "first-reward-cycle", "type": "uint128" }, + { "name": "num-cycles", "type": "uint128" }, + { "name": "amount-ustx", "type": "uint128" } + ], + "outputs": { "type": { "response": { "ok": "bool", "error": "int128" } } } + }, + { + "name": "add-pox-partial-stacked", + "access": "private", + "args": [ + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "first-reward-cycle", "type": "uint128" }, + { "name": "num-cycles", "type": "uint128" }, + { "name": "amount-ustx", "type": "uint128" } + ], + "outputs": { "type": "bool" } + }, + { + "name": "add-pox-partial-stacked-to-ith-cycle", + "access": "private", + "args": [ + { "name": "cycle-index", "type": "uint128" }, + { + "name": "params", + "type": { + "tuple": [ + { "name": "amount-ustx", "type": "uint128" }, + { "name": "num-cycles", "type": "uint128" }, + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "reward-cycle", "type": "uint128" } + ] + } + } + ], + "outputs": { + "type": { + "tuple": [ + { "name": "amount-ustx", "type": "uint128" }, + { "name": "num-cycles", "type": "uint128" }, + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "reward-cycle", "type": "uint128" } + ] + } + } + }, + { + "name": "append-reward-cycle-pox-addr", + "access": "private", + "args": [ + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "reward-cycle", "type": "uint128" }, + { "name": "amount-ustx", "type": "uint128" } + ], + "outputs": { "type": "uint128" } + }, + { + "name": "burn-height-to-reward-cycle", + "access": "private", + "args": [{ "name": "height", "type": "uint128" }], + "outputs": { "type": "uint128" } + }, + { + "name": "check-caller-allowed", + "access": "private", + "args": [], + "outputs": { "type": "bool" } + }, + { + "name": "check-pox-addr-version", + "access": "private", + "args": [{ "name": "version", "type": { "buffer": { "length": 1 } } }], + "outputs": { "type": "bool" } + }, + { + "name": "check-pox-lock-period", + "access": "private", + "args": [{ "name": "lock-period", "type": "uint128" }], + "outputs": { "type": "bool" } + }, + { + "name": "current-pox-reward-cycle", + "access": "private", + "args": [], + "outputs": { "type": "uint128" } + }, + { + "name": "get-check-delegation", + "access": "private", + "args": [{ "name": "stacker", "type": "principal" }], + "outputs": { + "type": { + "optional": { + "tuple": [ + { "name": "amount-ustx", "type": "uint128" }, + { "name": "delegated-to", "type": "principal" }, + { + "name": "pox-addr", + "type": { + "optional": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + } + }, + { "name": "until-burn-ht", "type": { "optional": "uint128" } } + ] + } + } + } + }, + { + "name": "next-cycle-rejection-votes", + "access": "private", + "args": [], + "outputs": { "type": "uint128" } + }, + { + "name": "reward-cycle-to-burn-height", + "access": "private", + "args": [{ "name": "cycle", "type": "uint128" }], + "outputs": { "type": "uint128" } + }, + { + "name": "allow-contract-caller", + "access": "public", + "args": [ + { "name": "caller", "type": "principal" }, + { "name": "until-burn-ht", "type": { "optional": "uint128" } } + ], + "outputs": { "type": { "response": { "ok": "bool", "error": "int128" } } } + }, + { + "name": "delegate-stack-stx", + "access": "public", + "args": [ + { "name": "stacker", "type": "principal" }, + { "name": "amount-ustx", "type": "uint128" }, + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "start-burn-ht", "type": "uint128" }, + { "name": "lock-period", "type": "uint128" } + ], + "outputs": { + "type": { + "response": { + "ok": { + "tuple": [ + { "name": "lock-amount", "type": "uint128" }, + { "name": "stacker", "type": "principal" }, + { "name": "unlock-burn-height", "type": "uint128" } + ] + }, + "error": "int128" + } + } + } + }, + { + "name": "delegate-stx", + "access": "public", + "args": [ + { "name": "amount-ustx", "type": "uint128" }, + { "name": "delegate-to", "type": "principal" }, + { "name": "until-burn-ht", "type": { "optional": "uint128" } }, + { + "name": "pox-addr", + "type": { + "optional": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + } + } + ], + "outputs": { "type": { "response": { "ok": "bool", "error": "int128" } } } + }, + { + "name": "disallow-contract-caller", + "access": "public", + "args": [{ "name": "caller", "type": "principal" }], + "outputs": { "type": { "response": { "ok": "bool", "error": "int128" } } } + }, + { + "name": "reject-pox", + "access": "public", + "args": [], + "outputs": { "type": { "response": { "ok": "bool", "error": "int128" } } } + }, + { + "name": "revoke-delegate-stx", + "access": "public", + "args": [], + "outputs": { "type": { "response": { "ok": "bool", "error": "int128" } } } + }, + { + "name": "set-burnchain-parameters", + "access": "public", + "args": [ + { "name": "first-burn-height", "type": "uint128" }, + { "name": "prepare-cycle-length", "type": "uint128" }, + { "name": "reward-cycle-length", "type": "uint128" }, + { "name": "rejection-fraction", "type": "uint128" } + ], + "outputs": { "type": { "response": { "ok": "bool", "error": "int128" } } } + }, + { + "name": "stack-aggregation-commit", + "access": "public", + "args": [ + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "reward-cycle", "type": "uint128" } + ], + "outputs": { "type": { "response": { "ok": "bool", "error": "int128" } } } + }, + { + "name": "stack-stx", + "access": "public", + "args": [ + { "name": "amount-ustx", "type": "uint128" }, + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "start-burn-ht", "type": "uint128" }, + { "name": "lock-period", "type": "uint128" } + ], + "outputs": { + "type": { + "response": { + "ok": { + "tuple": [ + { "name": "lock-amount", "type": "uint128" }, + { "name": "stacker", "type": "principal" }, + { "name": "unlock-burn-height", "type": "uint128" } + ] + }, + "error": "int128" + } + } + } + }, + { + "name": "can-stack-stx", + "access": "read_only", + "args": [ + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "amount-ustx", "type": "uint128" }, + { "name": "first-reward-cycle", "type": "uint128" }, + { "name": "num-cycles", "type": "uint128" } + ], + "outputs": { "type": { "response": { "ok": "bool", "error": "int128" } } } + }, + { + "name": "get-pox-info", + "access": "read_only", + "args": [], + "outputs": { + "type": { + "response": { + "ok": { + "tuple": [ + { "name": "current-rejection-votes", "type": "uint128" }, + { "name": "first-burnchain-block-height", "type": "uint128" }, + { "name": "min-amount-ustx", "type": "uint128" }, + { "name": "prepare-cycle-length", "type": "uint128" }, + { "name": "rejection-fraction", "type": "uint128" }, + { "name": "reward-cycle-id", "type": "uint128" }, + { "name": "reward-cycle-length", "type": "uint128" }, + { "name": "total-liquid-supply-ustx", "type": "uint128" } + ] + }, + "error": "none" + } + } + } + }, + { + "name": "get-pox-rejection", + "access": "read_only", + "args": [ + { "name": "stacker", "type": "principal" }, + { "name": "reward-cycle", "type": "uint128" } + ], + "outputs": { "type": { "optional": { "tuple": [{ "name": "amount", "type": "uint128" }] } } } + }, + { + "name": "get-reward-set-pox-address", + "access": "read_only", + "args": [ + { "name": "reward-cycle", "type": "uint128" }, + { "name": "index", "type": "uint128" } + ], + "outputs": { + "type": { + "optional": { + "tuple": [ + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "total-ustx", "type": "uint128" } + ] + } + } + } + }, + { + "name": "get-reward-set-size", + "access": "read_only", + "args": [{ "name": "reward-cycle", "type": "uint128" }], + "outputs": { "type": "uint128" } + }, + { + "name": "get-stacker-info", + "access": "read_only", + "args": [{ "name": "stacker", "type": "principal" }], + "outputs": { + "type": { + "optional": { + "tuple": [ + { "name": "amount-ustx", "type": "uint128" }, + { "name": "first-reward-cycle", "type": "uint128" }, + { "name": "lock-period", "type": "uint128" }, + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + } + ] + } + } + } + }, + { + "name": "get-stacking-minimum", + "access": "read_only", + "args": [], + "outputs": { "type": "uint128" } + }, + { + "name": "get-total-ustx-stacked", + "access": "read_only", + "args": [{ "name": "reward-cycle", "type": "uint128" }], + "outputs": { "type": "uint128" } + }, + { + "name": "is-pox-active", + "access": "read_only", + "args": [{ "name": "reward-cycle", "type": "uint128" }], + "outputs": { "type": "bool" } + }, + { + "name": "minimal-can-stack-stx", + "access": "read_only", + "args": [ + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "amount-ustx", "type": "uint128" }, + { "name": "first-reward-cycle", "type": "uint128" }, + { "name": "num-cycles", "type": "uint128" } + ], + "outputs": { "type": { "response": { "ok": "bool", "error": "int128" } } } + } + ], + "variables": [ + { + "name": "ADDRESS_VERSION_P2PKH", + "type": { "buffer": { "length": 1 } }, + "access": "constant" + }, + { "name": "ADDRESS_VERSION_P2SH", "type": { "buffer": { "length": 1 } }, "access": "constant" }, + { + "name": "ADDRESS_VERSION_P2WPKH", + "type": { "buffer": { "length": 1 } }, + "access": "constant" + }, + { + "name": "ADDRESS_VERSION_P2WSH", + "type": { "buffer": { "length": 1 } }, + "access": "constant" + }, + { "name": "ERR_DELEGATION_EXPIRES_DURING_LOCK", "type": "int128", "access": "constant" }, + { "name": "ERR_DELEGATION_POX_ADDR_REQUIRED", "type": "int128", "access": "constant" }, + { "name": "ERR_DELEGATION_TOO_MUCH_LOCKED", "type": "int128", "access": "constant" }, + { "name": "ERR_INVALID_START_BURN_HEIGHT", "type": "int128", "access": "constant" }, + { "name": "ERR_NOT_ALLOWED", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_ALREADY_DELEGATED", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_ALREADY_REJECTED", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_ALREADY_STACKED", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_EXPIRED", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_INSUFFICIENT_FUNDS", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_INVALID_AMOUNT", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_INVALID_LOCK_PERIOD", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_INVALID_POX_ADDRESS", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_NO_SUCH_PRINCIPAL", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_PERMISSION_DENIED", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_POX_ADDRESS_IN_USE", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_STX_LOCKED", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_THRESHOLD_NOT_MET", "type": "int128", "access": "constant" }, + { "name": "ERR_STACKING_UNREACHABLE", "type": "int128", "access": "constant" }, + { "name": "MAX_POX_REWARD_CYCLES", "type": "uint128", "access": "constant" }, + { "name": "MIN_POX_REWARD_CYCLES", "type": "uint128", "access": "constant" }, + { "name": "POX_REJECTION_FRACTION", "type": "uint128", "access": "constant" }, + { "name": "PREPARE_CYCLE_LENGTH", "type": "uint128", "access": "constant" }, + { "name": "REWARD_CYCLE_LENGTH", "type": "uint128", "access": "constant" }, + { "name": "STACKING_THRESHOLD_100", "type": "uint128", "access": "constant" }, + { "name": "STACKING_THRESHOLD_25", "type": "uint128", "access": "constant" }, + { "name": "configured", "type": "bool", "access": "variable" }, + { "name": "first-burnchain-block-height", "type": "uint128", "access": "variable" }, + { "name": "pox-prepare-cycle-length", "type": "uint128", "access": "variable" }, + { "name": "pox-rejection-fraction", "type": "uint128", "access": "variable" }, + { "name": "pox-reward-cycle-length", "type": "uint128", "access": "variable" } + ], + "maps": [ + { + "name": "allowance-contract-callers", + "key": { + "tuple": [ + { "name": "contract-caller", "type": "principal" }, + { "name": "sender", "type": "principal" } + ] + }, + "value": { "tuple": [{ "name": "until-burn-ht", "type": { "optional": "uint128" } }] } + }, + { + "name": "delegation-state", + "key": { "tuple": [{ "name": "stacker", "type": "principal" }] }, + "value": { + "tuple": [ + { "name": "amount-ustx", "type": "uint128" }, + { "name": "delegated-to", "type": "principal" }, + { + "name": "pox-addr", + "type": { + "optional": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + } + }, + { "name": "until-burn-ht", "type": { "optional": "uint128" } } + ] + } + }, + { + "name": "partial-stacked-by-cycle", + "key": { + "tuple": [ + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "reward-cycle", "type": "uint128" }, + { "name": "sender", "type": "principal" } + ] + }, + "value": { "tuple": [{ "name": "stacked-amount", "type": "uint128" }] } + }, + { + "name": "reward-cycle-pox-address-list", + "key": { + "tuple": [ + { "name": "index", "type": "uint128" }, + { "name": "reward-cycle", "type": "uint128" } + ] + }, + "value": { + "tuple": [ + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + }, + { "name": "total-ustx", "type": "uint128" } + ] + } + }, + { + "name": "reward-cycle-pox-address-list-len", + "key": { "tuple": [{ "name": "reward-cycle", "type": "uint128" }] }, + "value": { "tuple": [{ "name": "len", "type": "uint128" }] } + }, + { + "name": "reward-cycle-total-stacked", + "key": { "tuple": [{ "name": "reward-cycle", "type": "uint128" }] }, + "value": { "tuple": [{ "name": "total-ustx", "type": "uint128" }] } + }, + { + "name": "stacking-rejection", + "key": { "tuple": [{ "name": "reward-cycle", "type": "uint128" }] }, + "value": { "tuple": [{ "name": "amount", "type": "uint128" }] } + }, + { + "name": "stacking-rejectors", + "key": { + "tuple": [ + { "name": "reward-cycle", "type": "uint128" }, + { "name": "stacker", "type": "principal" } + ] + }, + "value": { "tuple": [{ "name": "amount", "type": "uint128" }] } + }, + { + "name": "stacking-state", + "key": { "tuple": [{ "name": "stacker", "type": "principal" }] }, + "value": { + "tuple": [ + { "name": "amount-ustx", "type": "uint128" }, + { "name": "first-reward-cycle", "type": "uint128" }, + { "name": "lock-period", "type": "uint128" }, + { + "name": "pox-addr", + "type": { + "tuple": [ + { "name": "hashbytes", "type": { "buffer": { "length": 20 } } }, + { "name": "version", "type": { "buffer": { "length": 1 } } } + ] + } + } + ] + } + } + ], + "fungible_tokens": [], + "non_fungible_tokens": [] +} diff --git a/packages/stacking/tests/stacking.test.ts b/packages/stacking/tests/stacking.test.ts index 06e040e5..3696cbc5 100644 --- a/packages/stacking/tests/stacking.test.ts +++ b/packages/stacking/tests/stacking.test.ts @@ -7,14 +7,17 @@ import { ClarityType, intCV, noneCV, + ReadOnlyFunctionOptions, responseErrorCV, responseOkCV, + SignedContractCallOptions, someCV, standardPrincipalCV, trueCV, tupleCV, TupleCV, uintCV, + validateContractCall, } from '@stacks/transactions'; import { address as btcAddress } from 'bitcoinjs-lib'; import fetchMock from 'jest-fetch-mock'; @@ -26,11 +29,6 @@ import { poxAddressToBtcAddress, } from '../src/utils'; -beforeEach(() => { - fetchMock.resetMocks(); - jest.resetModules(); -}); - const poxInfo = { contract_id: 'ST000000000000000000002AMW42H.pox', first_burnchain_block_height: 0, @@ -128,6 +126,29 @@ const blocktimeInfo = { }, }; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const poxAbi = require('./poxAbi.json'); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const { createContractCallPayload } = require('../../transactions/src/payload.ts'); // not exported currently + +// testing helper method +function isPoxAbiValid(opts: SignedContractCallOptions | ReadOnlyFunctionOptions): boolean { + return validateContractCall( + createContractCallPayload( + opts.contractAddress, + opts.contractName, + opts.functionName, + opts.functionArgs + ), + poxAbi + ); +} + +beforeEach(() => { + fetchMock.resetMocks(); + jest.resetModules(); +}); + test('check stacking eligibility true', async () => { const address = 'ST3XKKN4RPV69NN1PHFDNX3TYKXT7XPC4N8KC1ARH'; const poxAddress = '1Xik14zRm29UsyS6DjhYg4iZeZqsDa8D3'; @@ -287,6 +308,7 @@ test('stack stx', async () => { expect(broadcastTransaction).toHaveBeenCalledTimes(1); expect(broadcastTransaction).toHaveBeenCalledWith(transaction, network); expect(stackingResults).toEqual(broadcastResponse); + expect(isPoxAbiValid(expectedContractCallOptions)).toBe(true); }); test('delegate stx', async () => { @@ -358,6 +380,7 @@ test('delegate stx', async () => { expect(broadcastTransaction).toHaveBeenCalledTimes(1); expect(broadcastTransaction).toHaveBeenCalledWith(transaction, network); expect(delegateResults).toEqual(broadcastResponse); + expect(isPoxAbiValid(expectedContractCallOptions)).toBe(true); }); test('delegate stx with empty optional parameters', async () => { @@ -421,6 +444,7 @@ test('delegate stx with empty optional parameters', async () => { expect(broadcastTransaction).toHaveBeenCalledTimes(1); expect(broadcastTransaction).toHaveBeenCalledWith(transaction, network); expect(delegateResults).toEqual(broadcastResponse); + expect(isPoxAbiValid(expectedContractCallOptions)).toBe(true); }); test('delegate stack stx with one delegator', async () => { @@ -504,6 +528,7 @@ test('delegate stack stx with one delegator', async () => { expect(broadcastTransaction).toHaveBeenCalledTimes(1); expect(broadcastTransaction).toHaveBeenCalledWith(transaction, network); expect(delegateResults).toEqual(broadcastResponse); + expect(isPoxAbiValid(expectedContractCallOptions)).toBe(true); }); test('delegate stack stx with set nonce', async () => { @@ -589,6 +614,7 @@ test('delegate stack stx with set nonce', async () => { expect(broadcastTransaction).toHaveBeenCalledTimes(1); expect(broadcastTransaction).toHaveBeenCalledWith(transaction, network); expect(delegateResults).toEqual(broadcastResponse); + expect(isPoxAbiValid(expectedContractCallOptions)).toBe(true); }); test('delegator commit', async () => { @@ -651,6 +677,7 @@ test('delegator commit', async () => { expect(broadcastTransaction).toHaveBeenCalledTimes(1); expect(broadcastTransaction).toHaveBeenCalledWith(transaction, network); expect(delegateResults).toEqual(broadcastResponse); + expect(isPoxAbiValid(expectedContractCallOptions)).toBe(true); }); test('revoke delegate stx', async () => { @@ -699,6 +726,7 @@ test('revoke delegate stx', async () => { expect(broadcastTransaction).toHaveBeenCalledTimes(1); expect(broadcastTransaction).toHaveBeenCalledWith(transaction, network); expect(revokeDelegateResults).toEqual(broadcastResponse); + expect(isPoxAbiValid(expectedContractCallOptions)).toBe(true); }); test('get stacking status', async () => { @@ -768,6 +796,7 @@ test('get stacking status', async () => { expect(stackingStatus.details.lock_period).toEqual(lockPeriod); expect(stackingStatus.details.pox_address.version.toString()).toEqual(version); expect(stackingStatus.details.pox_address.hashbytes.toString()).toEqual(hashbytes); + expect(isPoxAbiValid(expectedReadOnlyFunctionCallOptions)).toBe(true); }); test('get core info', async () => {