You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0c7950c
Browse filesBrowse the repository at this point in the historyBrowse files
feat(sdk-coin-stx): allow a caller-supplied staking contract
The contract builder only accepts the canonical pox-4 / pox-5 / send-many-memo
contracts: contractName must be in VALID_STAKING_CONTRACT_NAMES and
contractAddress must be one of the network's contract addresses. That blocks
building for a non-canonical staking contract (e.g. a test/dummy pox-5, or a
future pox version) without an SDK change.
Add an opt-in allowlist of staking contracts ({ name, address } pairs) that the
caller supplies. Empty by default, so the canonical set and every existing flow
is unchanged.
It is threaded through every path that builds or rebuilds a contract call:
- ContractBuilder takes the allowlist (constructor) and accepts a name/address
only when they match one allowlisted pair (canonical set otherwise);
- TransactionBuilderFactory.from(hex, { allowedStakingContracts }) passes it to
getContractBuilder;
- Stx.signTransaction / explainTransaction (and the recovery rebuild) pass the
coin's setAllowedStakingContracts(...) value, so a rehydrated transaction
re-validates against the same rules as the build path.
Validation is therefore unchanged: the canonical checks run on every path
(including initBuilder), and only an explicitly allowlisted contract is accepted
in addition. A contract name that is allowlisted is validated against the
canonical pox-5 function set (the dummy is an ABI-identical copy).
Ticket: SI-2106
0 commit comments