@ledgerhq/coin-internet_computer 1.32.2 → 2.0.0-nightly.20261023092320
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -9
- package/jest.config.js +12 -0
- package/jest.integ.config.js +4 -0
- package/package.json +9 -14
- package/src/api/api.ts +41 -57
- package/src/api/queries.test.ts +3 -3
- package/src/api/readReply.test.ts +19 -22
- package/src/api/readTransferOutcome.certificate.test.ts +57 -0
- package/src/bridge/bridgeHelpers/account.test.ts +48 -0
- package/src/bridge/bridgeHelpers/account.ts +15 -23
- package/src/bridge/broadcast.integ.test.ts +5 -11
- package/src/bridge/getTransactionStatus.ts +1 -1
- package/src/bridge/signOperation.ts +1 -1
- package/src/common-logic/neuron.test.ts +1 -1
- package/src/common-logic/neuron.ts +10 -11
- package/src/common-logic/redact.ts +1 -1
- package/src/common-logic/utils.ts +1 -1
- package/src/logic/accountIdentifier.test.ts +63 -0
- package/src/logic/accountIdentifier.ts +76 -0
- package/src/logic/buildNeuronTransaction.test.ts +38 -3
- package/src/logic/buildNeuronTransaction.ts +15 -20
- package/src/logic/buildTransaction.test.ts +22 -3
- package/src/logic/buildTransaction.ts +18 -9
- package/src/logic/crypto.ts +8 -12
- package/src/logic/validation.ts +2 -2
- package/src/network/agent.test.ts +2 -2
- package/src/network/agent.ts +1 -1
- package/src/network/candid.ts +5 -2
- package/src/network/idl/governance.idl.ts +1 -1
- package/src/network/idl/index.idl.ts +1 -1
- package/src/network/idl/index.types.ts +52 -0
- package/src/network/idl/ledger.idl.ts +1 -1
- package/src/types/neuron.ts +1 -1
- package/tsconfig.build.json +3 -19
- package/tsconfig.json +4 -20
- package/lib/api/api.d.ts +0 -64
- package/lib/api/api.d.ts.map +0 -1
- package/lib/api/api.js +0 -342
- package/lib/api/api.js.map +0 -1
- package/lib/api/index.d.ts +0 -2
- package/lib/api/index.d.ts.map +0 -1
- package/lib/api/index.js +0 -18
- package/lib/api/index.js.map +0 -1
- package/lib/bridge/bridgeHelpers/account.d.ts +0 -11
- package/lib/bridge/bridgeHelpers/account.d.ts.map +0 -1
- package/lib/bridge/bridgeHelpers/account.js +0 -182
- package/lib/bridge/bridgeHelpers/account.js.map +0 -1
- package/lib/bridge/bridgeHelpers/addresses.d.ts +0 -6
- package/lib/bridge/bridgeHelpers/addresses.d.ts.map +0 -1
- package/lib/bridge/bridgeHelpers/addresses.js +0 -6
- package/lib/bridge/bridgeHelpers/addresses.js.map +0 -1
- package/lib/bridge/bridgeHelpers/fee.d.ts +0 -3
- package/lib/bridge/bridgeHelpers/fee.d.ts.map +0 -1
- package/lib/bridge/bridgeHelpers/fee.js +0 -12
- package/lib/bridge/bridgeHelpers/fee.js.map +0 -1
- package/lib/bridge/broadcast.d.ts +0 -4
- package/lib/bridge/broadcast.d.ts.map +0 -1
- package/lib/bridge/broadcast.js +0 -137
- package/lib/bridge/broadcast.js.map +0 -1
- package/lib/bridge/buildOptimisticOperation.d.ts +0 -4
- package/lib/bridge/buildOptimisticOperation.d.ts.map +0 -1
- package/lib/bridge/buildOptimisticOperation.js +0 -41
- package/lib/bridge/buildOptimisticOperation.js.map +0 -1
- package/lib/bridge/createTransaction.d.ts +0 -4
- package/lib/bridge/createTransaction.d.ts.map +0 -1
- package/lib/bridge/createTransaction.js +0 -21
- package/lib/bridge/createTransaction.js.map +0 -1
- package/lib/bridge/deviceTransactionConfig.d.ts +0 -11
- package/lib/bridge/deviceTransactionConfig.d.ts.map +0 -1
- package/lib/bridge/deviceTransactionConfig.js +0 -58
- package/lib/bridge/deviceTransactionConfig.js.map +0 -1
- package/lib/bridge/estimateMaxSpendable.d.ts +0 -4
- package/lib/bridge/estimateMaxSpendable.d.ts.map +0 -1
- package/lib/bridge/estimateMaxSpendable.js +0 -17
- package/lib/bridge/estimateMaxSpendable.js.map +0 -1
- package/lib/bridge/getTransactionStatus.d.ts +0 -4
- package/lib/bridge/getTransactionStatus.d.ts.map +0 -1
- package/lib/bridge/getTransactionStatus.js +0 -334
- package/lib/bridge/getTransactionStatus.js.map +0 -1
- package/lib/bridge/index.d.ts +0 -8
- package/lib/bridge/index.d.ts.map +0 -1
- package/lib/bridge/index.js +0 -63
- package/lib/bridge/index.js.map +0 -1
- package/lib/bridge/prepareTransaction.d.ts +0 -4
- package/lib/bridge/prepareTransaction.d.ts.map +0 -1
- package/lib/bridge/prepareTransaction.js +0 -51
- package/lib/bridge/prepareTransaction.js.map +0 -1
- package/lib/bridge/serialization.d.ts +0 -10
- package/lib/bridge/serialization.d.ts.map +0 -1
- package/lib/bridge/serialization.js +0 -60
- package/lib/bridge/serialization.js.map +0 -1
- package/lib/bridge/signOperation.d.ts +0 -5
- package/lib/bridge/signOperation.d.ts.map +0 -1
- package/lib/bridge/signOperation.js +0 -100
- package/lib/bridge/signOperation.js.map +0 -1
- package/lib/bridge/transaction.d.ts +0 -15
- package/lib/bridge/transaction.d.ts.map +0 -1
- package/lib/bridge/transaction.js +0 -75
- package/lib/bridge/transaction.js.map +0 -1
- package/lib/bridge/validateAddress.d.ts +0 -3
- package/lib/bridge/validateAddress.d.ts.map +0 -1
- package/lib/bridge/validateAddress.js +0 -8
- package/lib/bridge/validateAddress.js.map +0 -1
- package/lib/common-logic/index.d.ts +0 -5
- package/lib/common-logic/index.d.ts.map +0 -1
- package/lib/common-logic/index.js +0 -37
- package/lib/common-logic/index.js.map +0 -1
- package/lib/common-logic/neuron.d.ts +0 -218
- package/lib/common-logic/neuron.d.ts.map +0 -1
- package/lib/common-logic/neuron.js +0 -630
- package/lib/common-logic/neuron.js.map +0 -1
- package/lib/common-logic/redact.d.ts +0 -11
- package/lib/common-logic/redact.d.ts.map +0 -1
- package/lib/common-logic/redact.js +0 -36
- package/lib/common-logic/redact.js.map +0 -1
- package/lib/common-logic/utils.d.ts +0 -25
- package/lib/common-logic/utils.d.ts.map +0 -1
- package/lib/common-logic/utils.js +0 -129
- package/lib/common-logic/utils.js.map +0 -1
- package/lib/constants.d.ts +0 -2
- package/lib/constants.d.ts.map +0 -1
- package/lib/constants.js +0 -5
- package/lib/constants.js.map +0 -1
- package/lib/consts.d.ts +0 -77
- package/lib/consts.d.ts.map +0 -1
- package/lib/consts.js +0 -130
- package/lib/consts.js.map +0 -1
- package/lib/errors.d.ts +0 -165
- package/lib/errors.d.ts.map +0 -1
- package/lib/errors.js +0 -354
- package/lib/errors.js.map +0 -1
- package/lib/hw-signMessage.d.ts +0 -12
- package/lib/hw-signMessage.d.ts.map +0 -1
- package/lib/hw-signMessage.js +0 -33
- package/lib/hw-signMessage.js.map +0 -1
- package/lib/logic/buildNeuronTransaction.d.ts +0 -38
- package/lib/logic/buildNeuronTransaction.d.ts.map +0 -1
- package/lib/logic/buildNeuronTransaction.js +0 -264
- package/lib/logic/buildNeuronTransaction.js.map +0 -1
- package/lib/logic/buildTransaction.d.ts +0 -30
- package/lib/logic/buildTransaction.d.ts.map +0 -1
- package/lib/logic/buildTransaction.js +0 -33
- package/lib/logic/buildTransaction.js.map +0 -1
- package/lib/logic/crypto.d.ts +0 -6
- package/lib/logic/crypto.d.ts.map +0 -1
- package/lib/logic/crypto.js +0 -22
- package/lib/logic/crypto.js.map +0 -1
- package/lib/logic/hashTransaction.d.ts +0 -11
- package/lib/logic/hashTransaction.d.ts.map +0 -1
- package/lib/logic/hashTransaction.js +0 -36
- package/lib/logic/hashTransaction.js.map +0 -1
- package/lib/logic/validateMemo.d.ts +0 -2
- package/lib/logic/validateMemo.d.ts.map +0 -1
- package/lib/logic/validateMemo.js +0 -8
- package/lib/logic/validateMemo.js.map +0 -1
- package/lib/logic/validation.d.ts +0 -9
- package/lib/logic/validation.d.ts.map +0 -1
- package/lib/logic/validation.js +0 -48
- package/lib/logic/validation.js.map +0 -1
- package/lib/network/agent.d.ts +0 -3
- package/lib/network/agent.d.ts.map +0 -1
- package/lib/network/agent.js +0 -18
- package/lib/network/agent.js.map +0 -1
- package/lib/network/candid.d.ts +0 -8
- package/lib/network/candid.d.ts.map +0 -1
- package/lib/network/candid.js +0 -36
- package/lib/network/candid.js.map +0 -1
- package/lib/network/idl/governance.idl.d.ts +0 -3
- package/lib/network/idl/governance.idl.d.ts.map +0 -1
- package/lib/network/idl/governance.idl.js +0 -968
- package/lib/network/idl/governance.idl.js.map +0 -1
- package/lib/network/idl/index.idl.d.ts +0 -4
- package/lib/network/idl/index.idl.d.ts.map +0 -1
- package/lib/network/idl/index.idl.js +0 -105
- package/lib/network/idl/index.idl.js.map +0 -1
- package/lib/network/idl/ledger.idl.d.ts +0 -4
- package/lib/network/idl/ledger.idl.d.ts.map +0 -1
- package/lib/network/idl/ledger.idl.js +0 -384
- package/lib/network/idl/ledger.idl.js.map +0 -1
- package/lib/signer/getAddress.d.ts +0 -6
- package/lib/signer/getAddress.d.ts.map +0 -1
- package/lib/signer/getAddress.js +0 -26
- package/lib/signer/getAddress.js.map +0 -1
- package/lib/signer/index.d.ts +0 -3
- package/lib/signer/index.d.ts.map +0 -1
- package/lib/signer/index.js +0 -8
- package/lib/signer/index.js.map +0 -1
- package/lib/supportedFeatures.d.ts +0 -3
- package/lib/supportedFeatures.d.ts.map +0 -1
- package/lib/supportedFeatures.js +0 -7
- package/lib/supportedFeatures.js.map +0 -1
- package/lib/test/bridgeDatasetTest.d.ts +0 -4
- package/lib/test/bridgeDatasetTest.d.ts.map +0 -1
- package/lib/test/bridgeDatasetTest.js +0 -133
- package/lib/test/bridgeDatasetTest.js.map +0 -1
- package/lib/test/index.d.ts +0 -2
- package/lib/test/index.d.ts.map +0 -1
- package/lib/test/index.js +0 -18
- package/lib/test/index.js.map +0 -1
- package/lib/types/common.d.ts +0 -72
- package/lib/types/common.d.ts.map +0 -1
- package/lib/types/common.js +0 -28
- package/lib/types/common.js.map +0 -1
- package/lib/types/index.d.ts +0 -4
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/index.js +0 -20
- package/lib/types/index.js.map +0 -1
- package/lib/types/neuron.d.ts +0 -118
- package/lib/types/neuron.d.ts.map +0 -1
- package/lib/types/neuron.js +0 -66
- package/lib/types/neuron.js.map +0 -1
- package/lib/types/signer.d.ts +0 -37
- package/lib/types/signer.d.ts.map +0 -1
- package/lib/types/signer.js +0 -3
- package/lib/types/signer.js.map +0 -1
- package/lib-es/api/api.d.ts +0 -64
- package/lib-es/api/api.d.ts.map +0 -1
- package/lib-es/api/api.js +0 -326
- package/lib-es/api/api.js.map +0 -1
- package/lib-es/api/index.d.ts +0 -2
- package/lib-es/api/index.d.ts.map +0 -1
- package/lib-es/api/index.js +0 -2
- package/lib-es/api/index.js.map +0 -1
- package/lib-es/bridge/bridgeHelpers/account.d.ts +0 -11
- package/lib-es/bridge/bridgeHelpers/account.d.ts.map +0 -1
- package/lib-es/bridge/bridgeHelpers/account.js +0 -174
- package/lib-es/bridge/bridgeHelpers/account.js.map +0 -1
- package/lib-es/bridge/bridgeHelpers/addresses.d.ts +0 -6
- package/lib-es/bridge/bridgeHelpers/addresses.d.ts.map +0 -1
- package/lib-es/bridge/bridgeHelpers/addresses.js +0 -2
- package/lib-es/bridge/bridgeHelpers/addresses.js.map +0 -1
- package/lib-es/bridge/bridgeHelpers/fee.d.ts +0 -3
- package/lib-es/bridge/bridgeHelpers/fee.d.ts.map +0 -1
- package/lib-es/bridge/bridgeHelpers/fee.js +0 -6
- package/lib-es/bridge/bridgeHelpers/fee.js.map +0 -1
- package/lib-es/bridge/broadcast.d.ts +0 -4
- package/lib-es/bridge/broadcast.d.ts.map +0 -1
- package/lib-es/bridge/broadcast.js +0 -130
- package/lib-es/bridge/broadcast.js.map +0 -1
- package/lib-es/bridge/buildOptimisticOperation.d.ts +0 -4
- package/lib-es/bridge/buildOptimisticOperation.d.ts.map +0 -1
- package/lib-es/bridge/buildOptimisticOperation.js +0 -34
- package/lib-es/bridge/buildOptimisticOperation.js.map +0 -1
- package/lib-es/bridge/createTransaction.d.ts +0 -4
- package/lib-es/bridge/createTransaction.d.ts.map +0 -1
- package/lib-es/bridge/createTransaction.js +0 -14
- package/lib-es/bridge/createTransaction.js.map +0 -1
- package/lib-es/bridge/deviceTransactionConfig.d.ts +0 -11
- package/lib-es/bridge/deviceTransactionConfig.d.ts.map +0 -1
- package/lib-es/bridge/deviceTransactionConfig.js +0 -56
- package/lib-es/bridge/deviceTransactionConfig.js.map +0 -1
- package/lib-es/bridge/estimateMaxSpendable.d.ts +0 -4
- package/lib-es/bridge/estimateMaxSpendable.d.ts.map +0 -1
- package/lib-es/bridge/estimateMaxSpendable.js +0 -10
- package/lib-es/bridge/estimateMaxSpendable.js.map +0 -1
- package/lib-es/bridge/getTransactionStatus.d.ts +0 -4
- package/lib-es/bridge/getTransactionStatus.d.ts.map +0 -1
- package/lib-es/bridge/getTransactionStatus.js +0 -327
- package/lib-es/bridge/getTransactionStatus.js.map +0 -1
- package/lib-es/bridge/index.d.ts +0 -8
- package/lib-es/bridge/index.d.ts.map +0 -1
- package/lib-es/bridge/index.js +0 -57
- package/lib-es/bridge/index.js.map +0 -1
- package/lib-es/bridge/prepareTransaction.d.ts +0 -4
- package/lib-es/bridge/prepareTransaction.d.ts.map +0 -1
- package/lib-es/bridge/prepareTransaction.js +0 -47
- package/lib-es/bridge/prepareTransaction.js.map +0 -1
- package/lib-es/bridge/serialization.d.ts +0 -10
- package/lib-es/bridge/serialization.d.ts.map +0 -1
- package/lib-es/bridge/serialization.js +0 -54
- package/lib-es/bridge/serialization.js.map +0 -1
- package/lib-es/bridge/signOperation.d.ts +0 -5
- package/lib-es/bridge/signOperation.d.ts.map +0 -1
- package/lib-es/bridge/signOperation.js +0 -93
- package/lib-es/bridge/signOperation.js.map +0 -1
- package/lib-es/bridge/transaction.d.ts +0 -15
- package/lib-es/bridge/transaction.d.ts.map +0 -1
- package/lib-es/bridge/transaction.js +0 -67
- package/lib-es/bridge/transaction.js.map +0 -1
- package/lib-es/bridge/validateAddress.d.ts +0 -3
- package/lib-es/bridge/validateAddress.d.ts.map +0 -1
- package/lib-es/bridge/validateAddress.js +0 -5
- package/lib-es/bridge/validateAddress.js.map +0 -1
- package/lib-es/common-logic/index.d.ts +0 -5
- package/lib-es/common-logic/index.d.ts.map +0 -1
- package/lib-es/common-logic/index.js +0 -10
- package/lib-es/common-logic/index.js.map +0 -1
- package/lib-es/common-logic/neuron.d.ts +0 -218
- package/lib-es/common-logic/neuron.d.ts.map +0 -1
- package/lib-es/common-logic/neuron.js +0 -592
- package/lib-es/common-logic/neuron.js.map +0 -1
- package/lib-es/common-logic/redact.d.ts +0 -11
- package/lib-es/common-logic/redact.d.ts.map +0 -1
- package/lib-es/common-logic/redact.js +0 -32
- package/lib-es/common-logic/redact.js.map +0 -1
- package/lib-es/common-logic/utils.d.ts +0 -25
- package/lib-es/common-logic/utils.d.ts.map +0 -1
- package/lib-es/common-logic/utils.js +0 -118
- package/lib-es/common-logic/utils.js.map +0 -1
- package/lib-es/constants.d.ts +0 -2
- package/lib-es/constants.d.ts.map +0 -1
- package/lib-es/constants.js +0 -2
- package/lib-es/constants.js.map +0 -1
- package/lib-es/consts.d.ts +0 -77
- package/lib-es/consts.d.ts.map +0 -1
- package/lib-es/consts.js +0 -127
- package/lib-es/consts.js.map +0 -1
- package/lib-es/errors.d.ts +0 -165
- package/lib-es/errors.d.ts.map +0 -1
- package/lib-es/errors.js +0 -318
- package/lib-es/errors.js.map +0 -1
- package/lib-es/hw-signMessage.d.ts +0 -12
- package/lib-es/hw-signMessage.d.ts.map +0 -1
- package/lib-es/hw-signMessage.js +0 -29
- package/lib-es/hw-signMessage.js.map +0 -1
- package/lib-es/logic/buildNeuronTransaction.d.ts +0 -38
- package/lib-es/logic/buildNeuronTransaction.d.ts.map +0 -1
- package/lib-es/logic/buildNeuronTransaction.js +0 -255
- package/lib-es/logic/buildNeuronTransaction.js.map +0 -1
- package/lib-es/logic/buildTransaction.d.ts +0 -30
- package/lib-es/logic/buildTransaction.d.ts.map +0 -1
- package/lib-es/logic/buildTransaction.js +0 -29
- package/lib-es/logic/buildTransaction.js.map +0 -1
- package/lib-es/logic/crypto.d.ts +0 -6
- package/lib-es/logic/crypto.d.ts.map +0 -1
- package/lib-es/logic/crypto.js +0 -16
- package/lib-es/logic/crypto.js.map +0 -1
- package/lib-es/logic/hashTransaction.d.ts +0 -11
- package/lib-es/logic/hashTransaction.d.ts.map +0 -1
- package/lib-es/logic/hashTransaction.js +0 -30
- package/lib-es/logic/hashTransaction.js.map +0 -1
- package/lib-es/logic/validateMemo.d.ts +0 -2
- package/lib-es/logic/validateMemo.d.ts.map +0 -1
- package/lib-es/logic/validateMemo.js +0 -5
- package/lib-es/logic/validateMemo.js.map +0 -1
- package/lib-es/logic/validation.d.ts +0 -9
- package/lib-es/logic/validation.d.ts.map +0 -1
- package/lib-es/logic/validation.js +0 -42
- package/lib-es/logic/validation.js.map +0 -1
- package/lib-es/network/agent.d.ts +0 -3
- package/lib-es/network/agent.d.ts.map +0 -1
- package/lib-es/network/agent.js +0 -14
- package/lib-es/network/agent.js.map +0 -1
- package/lib-es/network/candid.d.ts +0 -8
- package/lib-es/network/candid.d.ts.map +0 -1
- package/lib-es/network/candid.js +0 -24
- package/lib-es/network/candid.js.map +0 -1
- package/lib-es/network/idl/governance.idl.d.ts +0 -3
- package/lib-es/network/idl/governance.idl.d.ts.map +0 -1
- package/lib-es/network/idl/governance.idl.js +0 -964
- package/lib-es/network/idl/governance.idl.js.map +0 -1
- package/lib-es/network/idl/index.idl.d.ts +0 -4
- package/lib-es/network/idl/index.idl.d.ts.map +0 -1
- package/lib-es/network/idl/index.idl.js +0 -100
- package/lib-es/network/idl/index.idl.js.map +0 -1
- package/lib-es/network/idl/ledger.idl.d.ts +0 -4
- package/lib-es/network/idl/ledger.idl.d.ts.map +0 -1
- package/lib-es/network/idl/ledger.idl.js +0 -379
- package/lib-es/network/idl/ledger.idl.js.map +0 -1
- package/lib-es/signer/getAddress.d.ts +0 -6
- package/lib-es/signer/getAddress.d.ts.map +0 -1
- package/lib-es/signer/getAddress.js +0 -24
- package/lib-es/signer/getAddress.js.map +0 -1
- package/lib-es/signer/index.d.ts +0 -3
- package/lib-es/signer/index.d.ts.map +0 -1
- package/lib-es/signer/index.js +0 -3
- package/lib-es/signer/index.js.map +0 -1
- package/lib-es/supportedFeatures.d.ts +0 -3
- package/lib-es/supportedFeatures.d.ts.map +0 -1
- package/lib-es/supportedFeatures.js +0 -4
- package/lib-es/supportedFeatures.js.map +0 -1
- package/lib-es/test/bridgeDatasetTest.d.ts +0 -4
- package/lib-es/test/bridgeDatasetTest.d.ts.map +0 -1
- package/lib-es/test/bridgeDatasetTest.js +0 -127
- package/lib-es/test/bridgeDatasetTest.js.map +0 -1
- package/lib-es/test/index.d.ts +0 -2
- package/lib-es/test/index.d.ts.map +0 -1
- package/lib-es/test/index.js +0 -2
- package/lib-es/test/index.js.map +0 -1
- package/lib-es/types/common.d.ts +0 -72
- package/lib-es/types/common.d.ts.map +0 -1
- package/lib-es/types/common.js +0 -22
- package/lib-es/types/common.js.map +0 -1
- package/lib-es/types/index.d.ts +0 -4
- package/lib-es/types/index.d.ts.map +0 -1
- package/lib-es/types/index.js +0 -4
- package/lib-es/types/index.js.map +0 -1
- package/lib-es/types/neuron.d.ts +0 -118
- package/lib-es/types/neuron.d.ts.map +0 -1
- package/lib-es/types/neuron.js +0 -60
- package/lib-es/types/neuron.js.map +0 -1
- package/lib-es/types/signer.d.ts +0 -37
- package/lib-es/types/signer.d.ts.map +0 -1
- package/lib-es/types/signer.js +0 -2
- package/lib-es/types/signer.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# @ledgerhq/coin-internet_computer
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 2.0.0-nightly.20261023092320
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Major Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- @ledgerhq/ledger-wallet-framework@3.8.0
|
|
9
|
-
- @ledgerhq/types-live@6.128.0
|
|
7
|
+
- [#23629](https://github.com/LedgerHQ/ledger-live/pull/23629) [`9cf38bd`](https://github.com/LedgerHQ/ledger-live/commit/9cf38bd70c3cf8cdb0fd6d8932fffe45ac4ec07f) Thanks [@lysyi3m](https://github.com/lysyi3m)! - Replace the deprecated @dfinity/\* packages with @icp-sdk/core and derive account identifiers locally; signed payloads are unchanged.
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
Breaking: binary values use `Uint8Array` instead of `ArrayBuffer`: `UnsignedTransaction.arg`, the result of `pubkeyToDer`, the replies of `readReplyFromCanister`, and the input of `decodeManageNeuronReply` and `decodeListNeuronsReply`. `Principal` and the agent types come from `@icp-sdk/core`.
|
|
12
10
|
|
|
13
11
|
### Patch Changes
|
|
14
12
|
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
- [#23762](https://github.com/LedgerHQ/ledger-live/pull/23762) [`25e1918`](https://github.com/LedgerHQ/ledger-live/commit/25e19188feae52fffa42063909dfece72a6eea9b) Thanks [@lysyi3m](https://github.com/lysyi3m)! - Replace the constant-false transfer check in ICP history mapping with the intended guard
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`80f99a8`](https://github.com/LedgerHQ/ledger-live/commit/80f99a819b13d3ec2bd39d896de46e0a433b9954), [`f40b1c2`](https://github.com/LedgerHQ/ledger-live/commit/f40b1c20948a5c7921796926f620201f1bb8d574), [`75498cf`](https://github.com/LedgerHQ/ledger-live/commit/75498cf55065bccf17d09b780866ae031c01701a), [`7c1b6f0`](https://github.com/LedgerHQ/ledger-live/commit/7c1b6f0128cc3bb58c1e7efb19ff25dee1d4da48), [`e66d21e`](https://github.com/LedgerHQ/ledger-live/commit/e66d21ea7ccb706d718703b69d2133ede3294c1a), [`98c994b`](https://github.com/LedgerHQ/ledger-live/commit/98c994bc1f46a03366096531afac2471f07f397b), [`696357f`](https://github.com/LedgerHQ/ledger-live/commit/696357f754751853758d67c88bf34df9302b9b97), [`de915ee`](https://github.com/LedgerHQ/ledger-live/commit/de915eed19c90ded038285862676bb46a78a45ac)]:
|
|
16
|
+
- @ledgerhq/ledger-wallet-framework@3.8.0-nightly.20261023092320
|
|
17
|
+
- @ledgerhq/types-live@6.128.0-nightly.20261023092320
|
|
18
18
|
|
|
19
19
|
## 1.32.1
|
|
20
20
|
|
|
@@ -263,4 +263,61 @@
|
|
|
263
263
|
- @ledgerhq/types-live@6.119.0-next.0
|
|
264
264
|
- @ledgerhq/ledger-wallet-framework@2.8.0-next.0
|
|
265
265
|
|
|
266
|
+
## 1.28.0
|
|
267
|
+
|
|
268
|
+
### Minor Changes
|
|
269
|
+
|
|
270
|
+
- [#20280](https://github.com/LedgerHQ/ledger-live/pull/20280) [`9fcbe39`](https://github.com/LedgerHQ/ledger-live/commit/9fcbe39689ff122568ffb031a30dc3805ebb6add) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Stop depending on `@ledgerhq/errors` (LIVE-32915).
|
|
271
|
+
|
|
272
|
+
No workspace package declares it anymore, and none may again: `enforce-boundaries` now fails CI on any manifest that does. The classes it held live in the package that owns them, with `@ledgerhq/ledger-wallet-framework/errors` as the shared home below the coin layer.
|
|
273
|
+
|
|
274
|
+
The package itself stays in the repo so it keeps being published for external consumers, and is bridged to the external coin packages that still peer-depend on it via `pnpm.packageExtensions` using `workspace:*` (which reuses the single in-repo copy, so the dependency graph keeps exactly the physical copies it had before). [LedgerHQ/coin-modules#752](https://github.com/LedgerHQ/coin-modules/pull/752) removes that peerDependency upstream; once it is released the bridge can be dropped, but the package still needs publishing.
|
|
275
|
+
|
|
276
|
+
- [#20074](https://github.com/LedgerHQ/ledger-live/pull/20074) [`72930e9`](https://github.com/LedgerHQ/ledger-live/commit/72930e93e2a01d46012c3e7b72e3e3d4875ae7d7) Thanks [@lysyi3m](https://github.com/lysyi3m)! - Add a DMK-based Internet Computer signer and use it as the sole device signer, replacing the legacy `@zondax/ledger-icp` transport.
|
|
277
|
+
|
|
278
|
+
The new `@ledgerhq/live-signer-icp` package provides `DmkSignerICP` (built on `@ledgerhq/device-signer-kit-icp`), and the `internet_computer` family now requires a DMK transport — mirroring the aleo and concordium signers. `@zondax/ledger-icp` is removed from Ledger Live.
|
|
279
|
+
|
|
280
|
+
The ICP signer contract also exposes the neuron-management signing surface: `signUpdateCall` (signs a governance update call together with its read-state request, returning both signatures and the read-state body) and a `stake` flag on `sign` for neuron-creation transfers.
|
|
281
|
+
|
|
282
|
+
### Patch Changes
|
|
283
|
+
|
|
284
|
+
- Updated dependencies [[`56cfe0b`](https://github.com/LedgerHQ/ledger-live/commit/56cfe0bc6673f416f739c1593abfec718230952d), [`a464f7d`](https://github.com/LedgerHQ/ledger-live/commit/a464f7d6092607ff6b81aa6ec0cd29ef6cfcf35a), [`6a531c5`](https://github.com/LedgerHQ/ledger-live/commit/6a531c54ccd1c65df122286de6f136f9d73b9002), [`53c3431`](https://github.com/LedgerHQ/ledger-live/commit/53c3431e01b3139ef689cb589bab0adee4ed6152), [`635fa12`](https://github.com/LedgerHQ/ledger-live/commit/635fa12d47f5a98858326f4dd68962dffe82eda9)]:
|
|
285
|
+
- @ledgerhq/types-live@6.118.0
|
|
286
|
+
- @ledgerhq/ledger-wallet-framework@2.7.0
|
|
287
|
+
|
|
288
|
+
## 1.28.0-next.0
|
|
289
|
+
|
|
290
|
+
### Minor Changes
|
|
291
|
+
|
|
292
|
+
- [#20280](https://github.com/LedgerHQ/ledger-live/pull/20280) [`9fcbe39`](https://github.com/LedgerHQ/ledger-live/commit/9fcbe39689ff122568ffb031a30dc3805ebb6add) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Stop depending on `@ledgerhq/errors` (LIVE-32915).
|
|
293
|
+
|
|
294
|
+
No workspace package declares it anymore, and none may again: `enforce-boundaries` now fails CI on any manifest that does. The classes it held live in the package that owns them, with `@ledgerhq/ledger-wallet-framework/errors` as the shared home below the coin layer.
|
|
295
|
+
|
|
296
|
+
The package itself stays in the repo so it keeps being published for external consumers, and is bridged to the external coin packages that still peer-depend on it via `pnpm.packageExtensions` using `workspace:*` (which reuses the single in-repo copy, so the dependency graph keeps exactly the physical copies it had before). [LedgerHQ/coin-modules#752](https://github.com/LedgerHQ/coin-modules/pull/752) removes that peerDependency upstream; once it is released the bridge can be dropped, but the package still needs publishing.
|
|
297
|
+
|
|
298
|
+
- [#20074](https://github.com/LedgerHQ/ledger-live/pull/20074) [`72930e9`](https://github.com/LedgerHQ/ledger-live/commit/72930e93e2a01d46012c3e7b72e3e3d4875ae7d7) Thanks [@lysyi3m](https://github.com/lysyi3m)! - Add a DMK-based Internet Computer signer and use it as the sole device signer, replacing the legacy `@zondax/ledger-icp` transport.
|
|
299
|
+
|
|
300
|
+
The new `@ledgerhq/live-signer-icp` package provides `DmkSignerICP` (built on `@ledgerhq/device-signer-kit-icp`), and the `internet_computer` family now requires a DMK transport — mirroring the aleo and concordium signers. `@zondax/ledger-icp` is removed from Ledger Live.
|
|
301
|
+
|
|
302
|
+
The ICP signer contract also exposes the neuron-management signing surface: `signUpdateCall` (signs a governance update call together with its read-state request, returning both signatures and the read-state body) and a `stake` flag on `sign` for neuron-creation transfers.
|
|
303
|
+
|
|
304
|
+
### Patch Changes
|
|
305
|
+
|
|
306
|
+
- Updated dependencies [[`56cfe0b`](https://github.com/LedgerHQ/ledger-live/commit/56cfe0bc6673f416f739c1593abfec718230952d), [`a464f7d`](https://github.com/LedgerHQ/ledger-live/commit/a464f7d6092607ff6b81aa6ec0cd29ef6cfcf35a), [`6a531c5`](https://github.com/LedgerHQ/ledger-live/commit/6a531c54ccd1c65df122286de6f136f9d73b9002), [`53c3431`](https://github.com/LedgerHQ/ledger-live/commit/53c3431e01b3139ef689cb589bab0adee4ed6152), [`635fa12`](https://github.com/LedgerHQ/ledger-live/commit/635fa12d47f5a98858326f4dd68962dffe82eda9)]:
|
|
307
|
+
- @ledgerhq/types-live@6.118.0-next.0
|
|
308
|
+
- @ledgerhq/ledger-wallet-framework@2.7.0-next.0
|
|
309
|
+
|
|
310
|
+
## 1.27.0
|
|
311
|
+
|
|
312
|
+
### Minor Changes
|
|
313
|
+
|
|
314
|
+
- [#19979](https://github.com/LedgerHQ/ledger-live/pull/19979) [`24d60d7`](https://github.com/LedgerHQ/ledger-live/commit/24d60d7628696b58764f8fbd4495140a049b3fcc) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Convert coin module errors from createCustomErrorClass to native ES6 classes as part of the @ledgerhq/errors sunset (LIVE-32915).
|
|
315
|
+
|
|
316
|
+
### Patch Changes
|
|
317
|
+
|
|
318
|
+
- Updated dependencies [[`1070564`](https://github.com/LedgerHQ/ledger-live/commit/107056410174d3da2d45c468232a8d742aea021f), [`2e1aecc`](https://github.com/LedgerHQ/ledger-live/commit/2e1aeccf6c91761c5d09c91e4be10dcc8c22eb7b), [`a534db5`](https://github.com/LedgerHQ/ledger-live/commit/a534db5c41da6957d38a330c1da6f7db1b693763), [`c622459`](https://github.com/LedgerHQ/ledger-live/commit/c622459fcbff5dcc094ee10eb360f2a835036007), [`524d763`](https://github.com/LedgerHQ/ledger-live/commit/524d7636d85a79379a9b086323d3121f3199bd1f), [`dbf8acf`](https://github.com/LedgerHQ/ledger-live/commit/dbf8acf27c9405548e7eb559d163a8e0883a20aa)]:
|
|
319
|
+
- @ledgerhq/errors@7.0.0
|
|
320
|
+
- @ledgerhq/ledger-wallet-framework@2.6.0
|
|
321
|
+
- @ledgerhq/types-live@6.117.0
|
|
322
|
+
|
|
266
323
|
<!-- changelog-pruned: older entries were removed to keep this file small. Full history is in `git log -p CHANGELOG.md` and in the GitHub release for each version. -->
|
package/jest.config.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// ESM-only dependencies of @icp-sdk/core, which jest must transform to load from CommonJS.
|
|
2
|
+
const esmPackages = ["@noble", "@scure"];
|
|
3
|
+
|
|
1
4
|
module.exports = {
|
|
2
5
|
passWithNoTests: true,
|
|
3
6
|
collectCoverageFrom: [
|
|
@@ -17,7 +20,16 @@ module.exports = {
|
|
|
17
20
|
},
|
|
18
21
|
},
|
|
19
22
|
],
|
|
23
|
+
[`node_modules/\\.pnpm/(${esmPackages.join("|")}).+\\.m?js$`]: [
|
|
24
|
+
"@swc/jest",
|
|
25
|
+
{
|
|
26
|
+
jsc: {
|
|
27
|
+
target: "esnext",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
20
31
|
},
|
|
32
|
+
transformIgnorePatterns: [`node_modules/\\.pnpm/(?!(${esmPackages.join("|")}))`],
|
|
21
33
|
coverageReporters: ["json", ["lcov", { file: "lcov.info", projectRoot: "../../../" }], "text"],
|
|
22
34
|
testEnvironment: "node",
|
|
23
35
|
testPathIgnorePatterns: ["lib/", "lib-es/", ".integration.test.ts", "\\.integ\\.test\\.ts$"],
|
package/jest.integ.config.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// ESM-only dependencies of @icp-sdk/core, which jest must transform to load from CommonJS.
|
|
2
|
+
const esmPackages = ["@noble", "@scure"];
|
|
3
|
+
|
|
1
4
|
/** @type {import('jest').Config} */
|
|
2
5
|
module.exports = {
|
|
3
6
|
testEnvironment: "node",
|
|
@@ -16,4 +19,5 @@ module.exports = {
|
|
|
16
19
|
},
|
|
17
20
|
],
|
|
18
21
|
},
|
|
22
|
+
transformIgnorePatterns: [`node_modules/\\.pnpm/(?!(${esmPackages.join("|")}))`],
|
|
19
23
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-internet_computer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-nightly.20261023092320",
|
|
4
4
|
"description": "Ledger Internet Computer integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -92,24 +92,21 @@
|
|
|
92
92
|
},
|
|
93
93
|
"license": "Apache-2.0",
|
|
94
94
|
"dependencies": {
|
|
95
|
-
"@
|
|
96
|
-
"@dfinity/candid": "2.4.1",
|
|
97
|
-
"@dfinity/identity-secp256k1": "2.4.1",
|
|
98
|
-
"@dfinity/ledger-icp": "2.6.13",
|
|
99
|
-
"@dfinity/principal": "2.4.1",
|
|
100
|
-
"@dfinity/utils": "2.14.0",
|
|
95
|
+
"@icp-sdk/core": "6.1.1",
|
|
101
96
|
"@ledgerhq/coin-module-framework": "10.0.0",
|
|
97
|
+
"@ledgerhq/ledger-wallet-framework": "^3.8.0-nightly.20261023092320",
|
|
102
98
|
"@ledgerhq/logs": "6.19.0",
|
|
99
|
+
"@ledgerhq/types-live": "^6.128.0-nightly.20261023092320",
|
|
103
100
|
"@noble/hashes": "1.8.0",
|
|
104
101
|
"bignumber.js": "^9.1.2",
|
|
105
102
|
"cbor": "10.0.11",
|
|
106
103
|
"invariant": "^2.2.2",
|
|
107
|
-
"lodash": "4.
|
|
108
|
-
"rxjs": "7.8.2"
|
|
109
|
-
"@ledgerhq/ledger-wallet-framework": "^3.8.0",
|
|
110
|
-
"@ledgerhq/types-live": "^6.128.0"
|
|
104
|
+
"lodash": "4.18.1",
|
|
105
|
+
"rxjs": "7.8.2"
|
|
111
106
|
},
|
|
112
107
|
"devDependencies": {
|
|
108
|
+
"@ledgerhq/test-quarantine": "0.1.0",
|
|
109
|
+
"@ledgerhq/wallet-framework-test-setup": "^0.1.14-nightly.20261023092320",
|
|
113
110
|
"@swc/core": "1.15.11",
|
|
114
111
|
"@swc/jest": "0.2.39",
|
|
115
112
|
"@types/invariant": "^2.2.2",
|
|
@@ -120,9 +117,7 @@
|
|
|
120
117
|
"axios": "1.20.0",
|
|
121
118
|
"jest": "30.5.0",
|
|
122
119
|
"oxfmt": "0.67.0",
|
|
123
|
-
"oxlint": "1.82.0"
|
|
124
|
-
"@ledgerhq/test-quarantine": "0.1.0",
|
|
125
|
-
"@ledgerhq/wallet-framework-test-setup": "^0.1.14"
|
|
120
|
+
"oxlint": "1.82.0"
|
|
126
121
|
},
|
|
127
122
|
"scripts": {
|
|
128
123
|
"clean": "rimraf lib lib-es",
|
package/src/api/api.ts
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Cbor,
|
|
3
3
|
Certificate,
|
|
4
|
-
Expiry,
|
|
5
4
|
lookupResultToBuffer,
|
|
5
|
+
ReadRequestType,
|
|
6
6
|
requestIdOf,
|
|
7
7
|
SubmitRequestType,
|
|
8
8
|
type RequestId,
|
|
9
|
-
} from "@
|
|
10
|
-
import
|
|
11
|
-
GetAccountIdentifierTransactionsResponse,
|
|
12
|
-
TransactionWithId,
|
|
13
|
-
} from "@dfinity/ledger-icp";
|
|
14
|
-
import { Principal } from "@dfinity/principal";
|
|
15
|
-
import { fromNullable } from "@dfinity/utils";
|
|
9
|
+
} from "@icp-sdk/core/agent";
|
|
10
|
+
import { Principal } from "@icp-sdk/core/principal";
|
|
16
11
|
import { log } from "@ledgerhq/logs";
|
|
17
12
|
import BigNumber from "bignumber.js";
|
|
18
13
|
import invariant from "invariant";
|
|
19
14
|
import {
|
|
20
|
-
DEFAULT_INGRESS_EXPIRY_DELTA_IN_MSECS,
|
|
21
15
|
FETCH_TXNS_LIMIT,
|
|
22
16
|
ICP_NETWORK_URL,
|
|
23
17
|
MAINNET_GOVERNANCE_CANISTER_ID,
|
|
@@ -31,38 +25,33 @@ import {
|
|
|
31
25
|
ICPNodeRefused,
|
|
32
26
|
ICPStakeNotRefreshed,
|
|
33
27
|
} from "../errors";
|
|
28
|
+
import { createIngressExpiry } from "../logic/buildTransaction";
|
|
34
29
|
import { getAgent } from "../network/agent";
|
|
35
30
|
import {
|
|
36
31
|
decodeCanisterIdlFunc,
|
|
37
32
|
encodeCanisterIdlFunc,
|
|
33
|
+
fromOpt,
|
|
38
34
|
getCanisterIdlFunc,
|
|
39
35
|
governanceIdlFactory,
|
|
40
36
|
indexIdlFactory,
|
|
41
37
|
ledgerIdlFactory,
|
|
42
38
|
} from "../network/candid";
|
|
39
|
+
import type {
|
|
40
|
+
GetAccountIdentifierTransactionsResponse,
|
|
41
|
+
TransactionWithId,
|
|
42
|
+
} from "../network/idl/index.types";
|
|
43
43
|
import type { ListNeuronsResponse, NeuronCommandOutcome } from "../types/neuron";
|
|
44
44
|
|
|
45
|
-
function toArrayBuffer(view: ArrayBuffer | Uint8Array): ArrayBuffer {
|
|
46
|
-
if (view instanceof ArrayBuffer) {
|
|
47
|
-
return view;
|
|
48
|
-
}
|
|
49
|
-
const copy = new Uint8Array(view.byteLength);
|
|
50
|
-
copy.set(view);
|
|
51
|
-
return copy.buffer;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
45
|
function requestIdFromHex(hex: string): RequestId {
|
|
55
|
-
|
|
56
|
-
const copy = new Uint8Array(bytes);
|
|
57
|
-
return copy.buffer as RequestId;
|
|
46
|
+
return new Uint8Array(Buffer.from(hex, "hex")) as RequestId;
|
|
58
47
|
}
|
|
59
48
|
|
|
60
49
|
// The IC root key is the trust anchor for BLS certificate verification. On mainnet the agent embeds
|
|
61
|
-
// the well-known key (
|
|
50
|
+
// the well-known key (the agent's IC_ROOT_KEY); only a local replica fetches it — from the replica
|
|
62
51
|
// itself, which is the trust boundary for local dev. It is deliberately NOT fetched from the boundary
|
|
63
52
|
// node whose replies we verify: doing so would let a compromised boundary supply both a forged
|
|
64
53
|
// certificate and a matching forged root, defeating certificate verification.
|
|
65
|
-
async function getRootKey(): Promise<
|
|
54
|
+
async function getRootKey(): Promise<Uint8Array> {
|
|
66
55
|
const agent = await getAgent(ICP_NETWORK_URL);
|
|
67
56
|
invariant(agent.rootKey, "[ICP](getRootKey) Root key unavailable");
|
|
68
57
|
return agent.rootKey;
|
|
@@ -86,11 +75,10 @@ export const fetchBlockHeight = async (): Promise<BigNumber> => {
|
|
|
86
75
|
|
|
87
76
|
invariant(blockHeightRes.status === "replied", "[ICP](fetchBlockHeight) Query failed");
|
|
88
77
|
|
|
89
|
-
const
|
|
78
|
+
const [decoded] = decodeCanisterIdlFunc<[{ chain_length: bigint }]>(
|
|
90
79
|
queryBlocksIdlFunc,
|
|
91
80
|
blockHeightRes.reply.arg,
|
|
92
81
|
);
|
|
93
|
-
const decoded = fromNullable(decodedIdl);
|
|
94
82
|
invariant(decoded, "[ICP](fetchBlockHeight) Decoding failed");
|
|
95
83
|
|
|
96
84
|
return BigNumber(decoded.chain_length.toString());
|
|
@@ -153,8 +141,7 @@ export const fetchBalance = async (address: string): Promise<BigNumber> => {
|
|
|
153
141
|
return BigNumber(0);
|
|
154
142
|
}
|
|
155
143
|
|
|
156
|
-
const
|
|
157
|
-
const balance: bigint | undefined = fromNullable(decodedBalance);
|
|
144
|
+
const [balance] = decodeCanisterIdlFunc<[bigint]>(getBalanceIdlFunc, balanceRes.reply.arg);
|
|
158
145
|
if (!balance) {
|
|
159
146
|
return BigNumber(0);
|
|
160
147
|
}
|
|
@@ -193,11 +180,10 @@ export const fetchTxns = async (
|
|
|
193
180
|
});
|
|
194
181
|
|
|
195
182
|
invariant(transactionsRes.status === "replied", "[ICP](fetchTxns) Query failed");
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const response = fromNullable(decodedTransactions);
|
|
183
|
+
const [response] = decodeCanisterIdlFunc<[{ Ok: GetAccountIdentifierTransactionsResponse }]>(
|
|
184
|
+
getTransactionsIdlFunc,
|
|
185
|
+
transactionsRes.reply.arg,
|
|
186
|
+
);
|
|
201
187
|
invariant(response, "[ICP](fetchTxns) Decoding failed");
|
|
202
188
|
|
|
203
189
|
if (response.Ok.transactions.length === 0) {
|
|
@@ -222,28 +208,28 @@ const delay = (ms: number): Promise<void> => new Promise(resolve => setTimeout(r
|
|
|
222
208
|
// The terminal reply from a status certificate, or null while the request is still non-terminal
|
|
223
209
|
// (received / processing / not yet in the tree). Throws only on an explicit `rejected` status.
|
|
224
210
|
const terminalReply = async (
|
|
225
|
-
certificate:
|
|
211
|
+
certificate: Uint8Array,
|
|
226
212
|
canisterId: Principal,
|
|
227
213
|
requestId: RequestId,
|
|
228
|
-
rootKey:
|
|
229
|
-
): Promise<
|
|
214
|
+
rootKey: Uint8Array,
|
|
215
|
+
): Promise<Uint8Array | null> => {
|
|
230
216
|
const cert = await Certificate.create({
|
|
231
|
-
certificate
|
|
217
|
+
certificate,
|
|
232
218
|
rootKey,
|
|
233
|
-
canisterId,
|
|
219
|
+
principal: { canisterId },
|
|
234
220
|
maxAgeInMinutes: 100,
|
|
235
221
|
});
|
|
236
|
-
const statusBuf = lookupResultToBuffer(cert.
|
|
222
|
+
const statusBuf = lookupResultToBuffer(cert.lookup_path(["request_status", requestId, "status"]));
|
|
237
223
|
const status = statusBuf ? new TextDecoder().decode(statusBuf) : undefined;
|
|
238
224
|
if (status === "rejected") {
|
|
239
225
|
const rejectBuf = lookupResultToBuffer(
|
|
240
|
-
cert.
|
|
226
|
+
cert.lookup_path(["request_status", requestId, "reject_message"]),
|
|
241
227
|
);
|
|
242
228
|
const reason = redactPrincipals(rejectBuf ? new TextDecoder().decode(rejectBuf) : "");
|
|
243
229
|
throw new ICPCallRejected(`[ICP] call rejected: ${reason || "unknown"}`, { reason });
|
|
244
230
|
}
|
|
245
231
|
return status === "replied"
|
|
246
|
-
? (lookupResultToBuffer(cert.
|
|
232
|
+
? (lookupResultToBuffer(cert.lookup_path(["request_status", requestId, "reply"])) ?? null)
|
|
247
233
|
: null;
|
|
248
234
|
};
|
|
249
235
|
|
|
@@ -251,7 +237,7 @@ const terminalReply = async (
|
|
|
251
237
|
// status, or — for a call the node turned away before replication — the rejection itself.
|
|
252
238
|
interface SyncCallBody {
|
|
253
239
|
status?: string;
|
|
254
|
-
certificate?:
|
|
240
|
+
certificate?: Uint8Array;
|
|
255
241
|
reject_message?: string;
|
|
256
242
|
}
|
|
257
243
|
|
|
@@ -276,14 +262,14 @@ export const readReplyFromCanister = async (
|
|
|
276
262
|
readStateBlob: Buffer | undefined,
|
|
277
263
|
canisterIdStr: string,
|
|
278
264
|
requestIdHex: string,
|
|
279
|
-
): Promise<
|
|
265
|
+
): Promise<Uint8Array | null> => {
|
|
280
266
|
const canisterId = Principal.fromText(canisterIdStr);
|
|
281
267
|
const requestId = requestIdFromHex(requestIdHex);
|
|
282
268
|
const rootKey = await getRootKey();
|
|
283
269
|
|
|
284
270
|
const callRes = await broadcastTxn(callBlob, canisterIdStr, "call");
|
|
285
271
|
if (callRes) {
|
|
286
|
-
const top = Cbor.decode<SyncCallBody>(
|
|
272
|
+
const top = Cbor.decode<SyncCallBody>(callRes);
|
|
287
273
|
throwIfRejectedBeforeReplication(top);
|
|
288
274
|
if (top.certificate) {
|
|
289
275
|
const reply = await terminalReply(top.certificate, canisterId, requestId, rootKey);
|
|
@@ -298,9 +284,7 @@ export const readReplyFromCanister = async (
|
|
|
298
284
|
await delay(READ_STATE_POLL_INTERVAL_MS);
|
|
299
285
|
const readStateRes = await broadcastTxn(readStateBlob, canisterIdStr, "read_state");
|
|
300
286
|
if (!readStateRes) continue;
|
|
301
|
-
const { certificate } = Cbor.decode<{ certificate
|
|
302
|
-
toArrayBuffer(readStateRes),
|
|
303
|
-
);
|
|
287
|
+
const { certificate } = Cbor.decode<{ certificate?: Uint8Array }>(readStateRes);
|
|
304
288
|
if (!certificate) continue;
|
|
305
289
|
const reply = await terminalReply(certificate, canisterId, requestId, rootKey);
|
|
306
290
|
if (reply) return reply;
|
|
@@ -329,7 +313,7 @@ export const readTransferOutcome = async (
|
|
|
329
313
|
): Promise<LedgerTransferOutcome> => {
|
|
330
314
|
const requestId = requestIdFromHex(transferRequestIdHex);
|
|
331
315
|
const canisterId = Principal.fromText(MAINNET_LEDGER_CANISTER_ID);
|
|
332
|
-
const top = Cbor.decode<SyncCallBody>(
|
|
316
|
+
const top = Cbor.decode<SyncCallBody>(syncCallResponse);
|
|
333
317
|
throwIfRejectedBeforeReplication(top);
|
|
334
318
|
invariant(
|
|
335
319
|
top.status === "replied" && top.certificate,
|
|
@@ -365,27 +349,27 @@ export const claimOrRefreshNeuronFromAccount = async (
|
|
|
365
349
|
const func = getCanisterIdlFunc(governanceIdlFactory, "claim_or_refresh_neuron_from_account");
|
|
366
350
|
const arg = encodeCanisterIdlFunc(func, [{ controller: [controller], memo }]);
|
|
367
351
|
const content = {
|
|
368
|
-
|
|
352
|
+
arg,
|
|
369
353
|
canister_id: Principal.fromText(MAINNET_GOVERNANCE_CANISTER_ID),
|
|
354
|
+
ingress_expiry: createIngressExpiry(),
|
|
370
355
|
method_name: "claim_or_refresh_neuron_from_account",
|
|
371
|
-
|
|
356
|
+
request_type: SubmitRequestType.Call,
|
|
372
357
|
sender: Principal.anonymous(),
|
|
373
|
-
ingress_expiry: new Expiry(DEFAULT_INGRESS_EXPIRY_DELTA_IN_MSECS),
|
|
374
358
|
};
|
|
375
359
|
const requestId = requestIdOf(content);
|
|
376
360
|
const requestIdHex = Buffer.from(requestId).toString("hex");
|
|
377
361
|
// Companion read-state envelope so the call can be polled to a terminal status (anonymous, no sig).
|
|
378
362
|
const readStateContent = {
|
|
379
|
-
|
|
363
|
+
ingress_expiry: content.ingress_expiry,
|
|
380
364
|
paths: [[new TextEncoder().encode("request_status"), new Uint8Array(requestId)]],
|
|
365
|
+
request_type: ReadRequestType.ReadState,
|
|
381
366
|
sender: content.sender,
|
|
382
|
-
ingress_expiry: content.ingress_expiry,
|
|
383
367
|
};
|
|
384
368
|
// The claim only ever runs after the transfer settled, so a rejected claim call leaves the same
|
|
385
369
|
// state as one governance answered with an error: the ICP is in the neuron's account, unclaimed.
|
|
386
370
|
// It is reported as that rather than as a rejected call, which reads as "nothing ran" — true of
|
|
387
371
|
// the claim, false of the transfer, and what would get the user offered a retry that stakes twice.
|
|
388
|
-
let reply:
|
|
372
|
+
let reply: Uint8Array | null;
|
|
389
373
|
try {
|
|
390
374
|
reply = await readReplyFromCanister(
|
|
391
375
|
Buffer.from(Cbor.encode({ content })),
|
|
@@ -405,7 +389,7 @@ export const claimOrRefreshNeuronFromAccount = async (
|
|
|
405
389
|
const decoded = decodeCanisterIdlFunc<
|
|
406
390
|
[{ result: [] | [{ NeuronId?: { id: bigint }; Error?: { error_message: string } }] }]
|
|
407
391
|
>(func, reply);
|
|
408
|
-
const result =
|
|
392
|
+
const result = fromOpt(decoded[0].result);
|
|
409
393
|
if (result && "Error" in result && result.Error) {
|
|
410
394
|
// The transfer has settled by now, so this is not a failed transaction: the ICP sits in the
|
|
411
395
|
// neuron's account, and the reason says what stopped the claim or refresh.
|
|
@@ -424,7 +408,7 @@ export const claimOrRefreshNeuronFromAccount = async (
|
|
|
424
408
|
* re-deriving the split from a percentage of a maturity figure that may have accrued since the last
|
|
425
409
|
* snapshot; the reply states both totals outright.
|
|
426
410
|
*/
|
|
427
|
-
export const decodeManageNeuronReply = (reply:
|
|
411
|
+
export const decodeManageNeuronReply = (reply: Uint8Array): NeuronCommandOutcome | undefined => {
|
|
428
412
|
const func = getCanisterIdlFunc(governanceIdlFactory, "manage_neuron");
|
|
429
413
|
const [decoded] = decodeCanisterIdlFunc<
|
|
430
414
|
[
|
|
@@ -440,7 +424,7 @@ export const decodeManageNeuronReply = (reply: ArrayBuffer): NeuronCommandOutcom
|
|
|
440
424
|
},
|
|
441
425
|
]
|
|
442
426
|
>(func, reply);
|
|
443
|
-
const command =
|
|
427
|
+
const command = fromOpt(decoded.command);
|
|
444
428
|
if (command && "Error" in command && command.Error) {
|
|
445
429
|
// Named rather than a bare Error: `errors.<name>` is how the apps translate this, and the
|
|
446
430
|
// canister's own text rides along as `reason` for the copy to quote — minus the caller, which
|
|
@@ -458,7 +442,7 @@ export const decodeManageNeuronReply = (reply: ArrayBuffer): NeuronCommandOutcom
|
|
|
458
442
|
};
|
|
459
443
|
|
|
460
444
|
/** Decode a list_neurons reply into the raw neuron snapshot. */
|
|
461
|
-
export const decodeListNeuronsReply = (reply:
|
|
445
|
+
export const decodeListNeuronsReply = (reply: Uint8Array): ListNeuronsResponse => {
|
|
462
446
|
const func = getCanisterIdlFunc(governanceIdlFactory, "list_neurons");
|
|
463
447
|
const [decoded] = decodeCanisterIdlFunc<[ListNeuronsResponse]>(func, reply);
|
|
464
448
|
return decoded;
|
package/src/api/queries.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Exercises the account read/query helpers' branch + pagination logic. The
|
|
1
|
+
// Exercises the account read/query helpers' branch + pagination logic. The candid codec is
|
|
2
2
|
// upstream-tested, so getAgent (the query transport) and the candid decode are mocked and we assert
|
|
3
3
|
// the function's own handling of replied/non-replied, absent values, and pagination.
|
|
4
4
|
const mockQuery = jest.fn();
|
|
@@ -25,7 +25,7 @@ afterEach(() => jest.clearAllMocks());
|
|
|
25
25
|
describe("fetchBalance", () => {
|
|
26
26
|
it("returns the balance when the query replies", async () => {
|
|
27
27
|
mockQuery.mockResolvedValue(replied());
|
|
28
|
-
mockDecode.mockReturnValue([500n]);
|
|
28
|
+
mockDecode.mockReturnValue([500n]);
|
|
29
29
|
expect((await fetchBalance("addr")).toString()).toBe("500");
|
|
30
30
|
});
|
|
31
31
|
|
|
@@ -36,7 +36,7 @@ describe("fetchBalance", () => {
|
|
|
36
36
|
|
|
37
37
|
it("returns 0 when the balance is absent", async () => {
|
|
38
38
|
mockQuery.mockResolvedValue(replied());
|
|
39
|
-
mockDecode.mockReturnValue([]);
|
|
39
|
+
mockDecode.mockReturnValue([]);
|
|
40
40
|
expect((await fetchBalance("addr")).toString()).toBe("0");
|
|
41
41
|
});
|
|
42
42
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Cbor, Certificate } from "@
|
|
1
|
+
import { Cbor, Certificate, LookupPathStatus } from "@icp-sdk/core/agent";
|
|
2
2
|
import { ICPCallRejected, ICPStakeNotRefreshed } from "../errors";
|
|
3
|
-
import { IDL } from "@
|
|
4
|
-
import { Principal } from "@
|
|
3
|
+
import { IDL } from "@icp-sdk/core/candid";
|
|
4
|
+
import { Principal } from "@icp-sdk/core/principal";
|
|
5
5
|
import {
|
|
6
6
|
claimOrRefreshNeuronFromAccount,
|
|
7
7
|
decodeListNeuronsReply,
|
|
@@ -14,37 +14,34 @@ import { getCanisterIdlFunc, governanceIdlFactory, ledgerIdlFactory } from "../n
|
|
|
14
14
|
|
|
15
15
|
// Encode a governance canister *reply* (return value) using the real vendored IDL, so the decode
|
|
16
16
|
// functions run against genuine candid bytes rather than a hand-rolled buffer.
|
|
17
|
-
const encodeReply = (method: string, value: unknown):
|
|
18
|
-
IDL.encode(getCanisterIdlFunc(governanceIdlFactory, method).retTypes, [value])
|
|
17
|
+
const encodeReply = (method: string, value: unknown): Uint8Array =>
|
|
18
|
+
IDL.encode(getCanisterIdlFunc(governanceIdlFactory, method).retTypes, [value]);
|
|
19
19
|
|
|
20
|
-
const encodeLedgerReply = (value: unknown):
|
|
21
|
-
IDL.encode(getCanisterIdlFunc(ledgerIdlFactory, "transfer").retTypes, [value])
|
|
20
|
+
const encodeLedgerReply = (value: unknown): Uint8Array =>
|
|
21
|
+
IDL.encode(getCanisterIdlFunc(ledgerIdlFactory, "transfer").retTypes, [value]);
|
|
22
22
|
|
|
23
|
-
// Keep the real
|
|
24
|
-
//
|
|
25
|
-
jest.mock("@
|
|
26
|
-
...jest.requireActual("@
|
|
23
|
+
// Keep the real agent (Cbor, lookupResultToBuffer, …); mock only certificate creation so we can
|
|
24
|
+
// drive terminalReply's status branches without a real BLS certificate.
|
|
25
|
+
jest.mock("@icp-sdk/core/agent", () => ({
|
|
26
|
+
...jest.requireActual("@icp-sdk/core/agent"),
|
|
27
27
|
Certificate: { create: jest.fn() },
|
|
28
28
|
}));
|
|
29
29
|
|
|
30
30
|
// getRootKey() reads the agent's embedded root key; stub the agent so no network/embedded-key logic runs.
|
|
31
31
|
jest.mock("../network/agent", () => ({
|
|
32
|
-
getAgent: jest.fn().mockResolvedValue({ rootKey: new
|
|
32
|
+
getAgent: jest.fn().mockResolvedValue({ rootKey: new Uint8Array(0) }),
|
|
33
33
|
}));
|
|
34
34
|
|
|
35
35
|
const CANISTER = "rrkah-fqaaa-aaaaa-aaaaq-cai";
|
|
36
36
|
const REQ_ID_HEX = "ab".repeat(32); // 32-byte request id
|
|
37
37
|
|
|
38
|
-
const encStr = (s: string):
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
const FOUND = (value: ArrayBuffer) => ({ status: "found", value });
|
|
43
|
-
const ABSENT = { status: "absent" };
|
|
38
|
+
const encStr = (s: string): Uint8Array => new TextEncoder().encode(s);
|
|
39
|
+
const FOUND = (value: Uint8Array) => ({ status: LookupPathStatus.Found, value });
|
|
40
|
+
const ABSENT = { status: LookupPathStatus.Absent };
|
|
44
41
|
|
|
45
|
-
// A stand-in Certificate whose `
|
|
46
|
-
const certWith = (status: string, reply?:
|
|
47
|
-
|
|
42
|
+
// A stand-in Certificate whose `lookup_path` answers the request_status leaves terminalReply asks for.
|
|
43
|
+
const certWith = (status: string, reply?: Uint8Array) => ({
|
|
44
|
+
lookup_path: (path: unknown[]) => {
|
|
48
45
|
const leaf = path[2];
|
|
49
46
|
if (leaf === "status") return FOUND(encStr(status));
|
|
50
47
|
if (leaf === "reject_message") return FOUND(encStr("boom"));
|
|
@@ -260,7 +257,7 @@ describe("claimOrRefreshNeuronFromAccount", () => {
|
|
|
260
257
|
|
|
261
258
|
// Drive the whole read path: the sync /call returns a `replied` certificate whose reply is the
|
|
262
259
|
// given governance response, so readReplyFromCanister resolves without polling.
|
|
263
|
-
const driveWith = (reply:
|
|
260
|
+
const driveWith = (reply: Uint8Array) => {
|
|
264
261
|
(Certificate.create as jest.Mock).mockResolvedValue(certWith("replied", reply));
|
|
265
262
|
respondingWith({ status: "replied", certificate: new Uint8Array([1]) });
|
|
266
263
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ICPCallRejected } from "../errors";
|
|
2
|
+
import { readTransferOutcome } from "./api";
|
|
3
|
+
|
|
4
|
+
// A mainnet synchronous /call answer to a transfer from an unfunded account: the ledger replied
|
|
5
|
+
// InsufficientFunds, certified by the subnet. It runs through the real certificate verification and
|
|
6
|
+
// the agent's embedded IC root key.
|
|
7
|
+
const REQUEST_ID_HEX = "73f2fe831215b9a10004db514a6b7f48407aa1ad7fbe4914327f49f16b133b4d";
|
|
8
|
+
const RESPONSE_HEX =
|
|
9
|
+
"d9d9f7a266737461747573677265706c6965646b636572746966696361746559034cd9d9f7a26474726565830182045820369d6e0ae5a8940d2a0d2db22b5740b86383b04261567380ae744cd4e3333c2f8301830183024e726571756573745f7374617475738301830182045820ba87b0349dfe928face96f5d1b77b4063fbacf7fe76ad6d2c47ee9d88bc19c2a83018301830183018301830182045820959cb992c65a8009373b5127f4a2c4eaf77bd93d6307ce0d083ea5a45caa2b0d830182045820dc7bd4fcb7900f0825e9603a92c0e3959eff22ef2a8d813b73a175e07e0310b28301820458200742d9eb61b0585c8cc15ab40092528eecf5680be138e353d1e48abed1eb79ef830182045820cc3d7f2c057120610bb00deaa022efecccb9904f01e17d99cfb82a08880dca7583018302582073f2fe831215b9a10004db514a6b7f48407aa1ad7fbe4914327f49f16b133b4d83018302457265706c79820358624449444c076b02bc8a0178c5fed201016b05b79eb35d02a1c3ebfd0703c7c6b5f60a05cce5b6900f7feb9cdbd50f066c01a7a5f3cc0e786c01bf9bb7f00d046c01e0a9b302786c018bbdf29b01786c019cbab69c02040100010400000000000000008302467374617475738203477265706c6965648204582003e2b893586f4fd41e06f4aa304837ff99a3aeeb9070dea07fb1dab4e51d790f82045820302d5ca2b16e6888cd2c325f81da44d110d9ae2036bad37e1756f87920c1dc51820458204c6988b5b6966aceea670127ffdc08b0bf37f95ae68d635b9a84feb84c005de382045820ee20202c16f7c315988825ba4a1a5d3c5e7bd7c51225dd876e7885ed88204f2e82045820890d94601bd0b251070c365fb2ee236825700372e8cc1aa8bb5d95323e4a1986820458202fd862ccdcdddb71f0187f4c6f673c014bd62fe3da13902310b9ca59f11d74ee820458204b3662d87a2770ee96670c50295afec5f8fe8d2128bcda9fb6b4269186e38f2f820458201a5e56235a7a5a84c938404041d614fd6eec6a5d8bc825a372f325eb2a546c948301820458203132b0c4606158939de5ceab086a43df368beb2392e7a98363d9b46d63e3e2de83024474696d65820349ddf694c0a6a3a2f018697369676e617475726558308c5afab59e140e433d5237956b0f61d06bf2e39265deb91f3a1d3b0f0d1de2e0f0ff425bedf8c76104448eaf1a01a651";
|
|
10
|
+
// The certificate's `time` leaf.
|
|
11
|
+
const CERTIFIED_AT_MS = 1_792_583_398_200;
|
|
12
|
+
|
|
13
|
+
const response = () => new Uint8Array(Buffer.from(RESPONSE_HEX, "hex"));
|
|
14
|
+
|
|
15
|
+
describe("readTransferOutcome against a real certificate", () => {
|
|
16
|
+
const originalFetch = global.fetch;
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
// Verification must need nothing from the network: the root key is the embedded one.
|
|
20
|
+
global.fetch = jest.fn(() => Promise.reject(new Error("unexpected network call")));
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
afterEach(() => {
|
|
24
|
+
global.fetch = originalFetch;
|
|
25
|
+
jest.useRealTimers();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("returns the ledger's verdict from a certificate that verifies", async () => {
|
|
29
|
+
jest.useFakeTimers({ now: CERTIFIED_AT_MS, advanceTimers: true });
|
|
30
|
+
|
|
31
|
+
const outcome = await readTransferOutcome(response(), REQUEST_ID_HEX);
|
|
32
|
+
|
|
33
|
+
expect(outcome.Err).toHaveProperty("InsufficientFunds");
|
|
34
|
+
expect(global.fetch).not.toHaveBeenCalled();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// The last bytes of the answer are the certificate's BLS signature.
|
|
38
|
+
it("fails plainly when the certificate signature does not verify", async () => {
|
|
39
|
+
jest.useFakeTimers({ now: CERTIFIED_AT_MS, advanceTimers: true });
|
|
40
|
+
const tampered = response();
|
|
41
|
+
tampered[tampered.length - 1] ^= 0x01;
|
|
42
|
+
|
|
43
|
+
const attempt = readTransferOutcome(tampered, REQUEST_ID_HEX);
|
|
44
|
+
|
|
45
|
+
await expect(attempt).rejects.toThrow(/signature/i);
|
|
46
|
+
await expect(attempt).rejects.not.toBeInstanceOf(ICPCallRejected);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("fails plainly when the certificate is older than the accepted age", async () => {
|
|
50
|
+
jest.useFakeTimers({ now: CERTIFIED_AT_MS + 101 * 60_000, advanceTimers: true });
|
|
51
|
+
|
|
52
|
+
const attempt = readTransferOutcome(response(), REQUEST_ID_HEX);
|
|
53
|
+
|
|
54
|
+
await expect(attempt).rejects.toThrow(/more than 100 minutes in the past/);
|
|
55
|
+
await expect(attempt).rejects.not.toBeInstanceOf(ICPCallRejected);
|
|
56
|
+
});
|
|
57
|
+
});
|