@kynesyslabs/demosdk 2.9.0 → 2.10.0
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/build/abstraction/CoinFinder.js +19 -23
- package/build/abstraction/CoinFinder.js.map +1 -1
- package/build/abstraction/EvmCoinFinder.js +48 -89
- package/build/abstraction/EvmCoinFinder.js.map +1 -1
- package/build/abstraction/Identities.d.ts +28 -1
- package/build/abstraction/Identities.js +58 -24
- package/build/abstraction/Identities.js.map +1 -1
- package/build/abstraction/index.js +4 -9
- package/build/abstraction/index.js.map +1 -1
- package/build/abstraction/providers/AbstractionProviders.js +1 -3
- package/build/abstraction/providers/AbstractionProviders.js.map +1 -1
- package/build/abstraction/providers/CoinAddresses.js +4 -7
- package/build/abstraction/providers/CoinAddresses.js.map +1 -1
- package/build/abstraction/providers/Providers.js +13 -18
- package/build/abstraction/providers/Providers.js.map +1 -1
- package/build/abstraction/providers/evm/ankr.js +8 -14
- package/build/abstraction/providers/evm/ankr.js.map +1 -1
- package/build/abstraction/providers/evm/arbitrum.js +4 -10
- package/build/abstraction/providers/evm/arbitrum.js.map +1 -1
- package/build/abstraction/providers/evm/bsc.js +4 -10
- package/build/abstraction/providers/evm/bsc.js.map +1 -1
- package/build/abstraction/providers/evm/ethereum.js +5 -11
- package/build/abstraction/providers/evm/ethereum.js.map +1 -1
- package/build/abstraction/providers/evm/index.js +4 -14
- package/build/abstraction/providers/evm/index.js.map +1 -1
- package/build/abstraction/providers/evm/optimism.js +4 -10
- package/build/abstraction/providers/evm/optimism.js.map +1 -1
- package/build/abstraction/providers/index.js +2 -7
- package/build/abstraction/providers/index.js.map +1 -1
- package/build/abstraction/providers/non-evm/bitcoin.js +4 -10
- package/build/abstraction/providers/non-evm/bitcoin.js.map +1 -1
- package/build/abstraction/providers/non-evm/index.js +4 -14
- package/build/abstraction/providers/non-evm/index.js.map +1 -1
- package/build/abstraction/providers/non-evm/multiversx.js +4 -10
- package/build/abstraction/providers/non-evm/multiversx.js.map +1 -1
- package/build/abstraction/providers/non-evm/solana.js +7 -13
- package/build/abstraction/providers/non-evm/solana.js.map +1 -1
- package/build/abstraction/providers/non-evm/xrp.js +4 -10
- package/build/abstraction/providers/non-evm/xrp.js.map +1 -1
- package/build/abstraction/types/UDResolution.js +1 -2
- package/build/abstraction/types/UDResolution.js.map +1 -1
- package/build/bridge/index.js +12 -33
- package/build/bridge/index.js.map +1 -1
- package/build/bridge/nativeBridge.js +16 -19
- package/build/bridge/nativeBridge.js.map +1 -1
- package/build/bridge/nativeBridgeTypes.js +6 -9
- package/build/bridge/nativeBridgeTypes.js.map +1 -1
- package/build/bridge/rubicBridge.js +1 -4
- package/build/bridge/rubicBridge.js.map +1 -1
- package/build/contracts/ContractDeployer.js +6 -43
- package/build/contracts/ContractDeployer.js.map +1 -1
- package/build/contracts/ContractFactory.js +8 -13
- package/build/contracts/ContractFactory.js.map +1 -1
- package/build/contracts/ContractInstance.js +3 -7
- package/build/contracts/ContractInstance.js.map +1 -1
- package/build/contracts/ContractInteractor.js +4 -41
- package/build/contracts/ContractInteractor.js.map +1 -1
- package/build/contracts/index.js +4 -12
- package/build/contracts/index.js.map +1 -1
- package/build/contracts/templates/TemplateRegistry.js +3 -7
- package/build/contracts/templates/TemplateRegistry.js.map +1 -1
- package/build/contracts/templates/TemplateValidator.js +1 -5
- package/build/contracts/templates/TemplateValidator.js.map +1 -1
- package/build/contracts/types/ContractABI.js +1 -2
- package/build/contracts/types/ContractABI.js.map +1 -1
- package/build/contracts/types/TypedContract.js +1 -2
- package/build/contracts/types/TypedContract.js.map +1 -1
- package/build/d402/client/D402Client.js +4 -41
- package/build/d402/client/D402Client.js.map +1 -1
- package/build/d402/client/index.js +1 -5
- package/build/d402/client/index.js.map +1 -1
- package/build/d402/client/types.js +1 -2
- package/build/d402/client/types.js.map +1 -1
- package/build/d402/index.js +2 -20
- package/build/d402/index.js.map +1 -1
- package/build/d402/server/D402Server.js +1 -5
- package/build/d402/server/D402Server.js.map +1 -1
- package/build/d402/server/index.js +2 -7
- package/build/d402/server/index.js.map +1 -1
- package/build/d402/server/middleware.js +3 -6
- package/build/d402/server/middleware.js.map +1 -1
- package/build/d402/server/types.js +1 -2
- package/build/d402/server/types.js.map +1 -1
- package/build/demoswork/executor/index.js +1 -4
- package/build/demoswork/executor/index.js.map +1 -1
- package/build/demoswork/executor/stepexecutor.js +2 -6
- package/build/demoswork/executor/stepexecutor.js.map +1 -1
- package/build/demoswork/index.js +8 -25
- package/build/demoswork/index.js.map +1 -1
- package/build/demoswork/operations/baseoperation.js +2 -6
- package/build/demoswork/operations/baseoperation.js.map +1 -1
- package/build/demoswork/operations/conditional/condition.js +7 -11
- package/build/demoswork/operations/conditional/condition.js.map +1 -1
- package/build/demoswork/operations/conditional/index.js +9 -13
- package/build/demoswork/operations/conditional/index.js.map +1 -1
- package/build/demoswork/operations/index.js +5 -9
- package/build/demoswork/operations/index.js.map +1 -1
- package/build/demoswork/utils/createTestWorkScript.js +22 -28
- package/build/demoswork/utils/createTestWorkScript.js.map +1 -1
- package/build/demoswork/utils/index.js +3 -8
- package/build/demoswork/utils/index.js.map +1 -1
- package/build/demoswork/validator/index.js +3 -6
- package/build/demoswork/validator/index.js.map +1 -1
- package/build/demoswork/validator/steps.validator.js +3 -6
- package/build/demoswork/validator/steps.validator.js.map +1 -1
- package/build/demoswork/work.js +6 -11
- package/build/demoswork/work.js.map +1 -1
- package/build/demoswork/workstep.js +16 -26
- package/build/demoswork/workstep.js.map +1 -1
- package/build/encryption/Cryptography.js +36 -71
- package/build/encryption/Cryptography.js.map +1 -1
- package/build/encryption/FHE/index.js +3 -9
- package/build/encryption/FHE/index.js.map +1 -1
- package/build/encryption/Hashing.js +8 -15
- package/build/encryption/Hashing.js.map +1 -1
- package/build/encryption/PQC/enigma.js +22 -59
- package/build/encryption/PQC/enigma.js.map +1 -1
- package/build/encryption/PQC/falconts/falcon.js +3 -6
- package/build/encryption/PQC/falconts/falcon.js.map +1 -1
- package/build/encryption/PQC/falconts/index.js +3 -15
- package/build/encryption/PQC/falconts/index.js.map +1 -1
- package/build/encryption/PQC/falconts/mnemonic.js +9 -15
- package/build/encryption/PQC/falconts/mnemonic.js.map +1 -1
- package/build/encryption/PQC/falconts/wordlist.js +1 -4
- package/build/encryption/PQC/falconts/wordlist.js.map +1 -1
- package/build/encryption/PQC/utils.js +2 -7
- package/build/encryption/PQC/utils.js.map +1 -1
- package/build/encryption/index.js +7 -50
- package/build/encryption/index.js.map +1 -1
- package/build/encryption/unifiedCrypto.js +23 -63
- package/build/encryption/unifiedCrypto.js.map +1 -1
- package/build/encryption/zK/identity/CommitmentService.js +5 -10
- package/build/encryption/zK/identity/CommitmentService.js.map +1 -1
- package/build/encryption/zK/identity/ProofGenerator.js +3 -40
- package/build/encryption/zK/identity/ProofGenerator.js.map +1 -1
- package/build/encryption/zK/identity/ZKIdentity.js +3 -40
- package/build/encryption/zK/identity/ZKIdentity.js.map +1 -1
- package/build/encryption/zK/identity/index.js +3 -40
- package/build/encryption/zK/identity/index.js.map +1 -1
- package/build/encryption/zK/index.js +2 -38
- package/build/encryption/zK/index.js.map +1 -1
- package/build/encryption/zK/interactive/index.js +4 -12
- package/build/encryption/zK/interactive/index.js.map +1 -1
- package/build/encryption/zK/primer.js +7 -13
- package/build/encryption/zK/primer.js.map +1 -1
- package/build/escrow/EscrowQueries.js +1 -5
- package/build/escrow/EscrowQueries.js.map +1 -1
- package/build/escrow/EscrowTransaction.js +8 -45
- package/build/escrow/EscrowTransaction.js.map +1 -1
- package/build/escrow/index.js +2 -7
- package/build/escrow/index.js.map +1 -1
- package/build/index.js +18 -54
- package/build/index.js.map +1 -1
- package/build/instant_messaging/index.js +13 -17
- package/build/instant_messaging/index.js.map +1 -1
- package/build/ipfs/IPFSOperations.js +5 -9
- package/build/ipfs/IPFSOperations.js.map +1 -1
- package/build/ipfs/index.js +1 -6
- package/build/ipfs/index.js.map +1 -1
- package/build/keyserver/KeyServerClient.js +10 -14
- package/build/keyserver/KeyServerClient.js.map +1 -1
- package/build/keyserver/errors.js +1 -5
- package/build/keyserver/errors.js.map +1 -1
- package/build/keyserver/index.js +3 -10
- package/build/keyserver/index.js.map +1 -1
- package/build/keyserver/types.js +1 -2
- package/build/keyserver/types.js.map +1 -1
- package/build/keyserver/verification.js +4 -8
- package/build/keyserver/verification.js.map +1 -1
- package/build/l2ps/index.js +2 -8
- package/build/l2ps/index.js.map +1 -1
- package/build/l2ps/l2ps.js +6 -41
- package/build/l2ps/l2ps.js.map +1 -1
- package/build/multichain/core/aptos.js +40 -77
- package/build/multichain/core/aptos.js.map +1 -1
- package/build/multichain/core/btc.js +22 -62
- package/build/multichain/core/btc.js.map +1 -1
- package/build/multichain/core/evm.js +24 -61
- package/build/multichain/core/evm.js.map +1 -1
- package/build/multichain/core/ibc.js +34 -71
- package/build/multichain/core/ibc.js.map +1 -1
- package/build/multichain/core/index.js +12 -28
- package/build/multichain/core/index.js.map +1 -1
- package/build/multichain/core/multiversx.js +34 -41
- package/build/multichain/core/multiversx.js.map +1 -1
- package/build/multichain/core/near.js +44 -84
- package/build/multichain/core/near.js.map +1 -1
- package/build/multichain/core/solana.js +51 -91
- package/build/multichain/core/solana.js.map +1 -1
- package/build/multichain/core/ten.js +11 -48
- package/build/multichain/core/ten.js.map +1 -1
- package/build/multichain/core/ton.d.ts +1 -1
- package/build/multichain/core/ton.js +30 -37
- package/build/multichain/core/ton.js.map +1 -1
- package/build/multichain/core/tron.js +34 -41
- package/build/multichain/core/tron.js.map +1 -1
- package/build/multichain/core/types/SolanaPhantomProvider.js +1 -2
- package/build/multichain/core/types/SolanaPhantomProvider.js.map +1 -1
- package/build/multichain/core/types/defaultChain.js +1 -5
- package/build/multichain/core/types/defaultChain.js.map +1 -1
- package/build/multichain/core/types/interfaces.js +2 -5
- package/build/multichain/core/types/interfaces.js.map +1 -1
- package/build/multichain/core/utils.js +1 -4
- package/build/multichain/core/utils.js.map +1 -1
- package/build/multichain/core/xrp.js +17 -22
- package/build/multichain/core/xrp.js.map +1 -1
- package/build/multichain/index.js +3 -39
- package/build/multichain/index.js.map +1 -1
- package/build/multichain/localsdk/aptos.js +11 -15
- package/build/multichain/localsdk/aptos.js.map +1 -1
- package/build/multichain/localsdk/btc.js +10 -50
- package/build/multichain/localsdk/btc.js.map +1 -1
- package/build/multichain/localsdk/evm.js +6 -10
- package/build/multichain/localsdk/evm.js.map +1 -1
- package/build/multichain/localsdk/ibc.js +5 -9
- package/build/multichain/localsdk/ibc.js.map +1 -1
- package/build/multichain/localsdk/index.js +10 -23
- package/build/multichain/localsdk/index.js.map +1 -1
- package/build/multichain/localsdk/multiversx.js +12 -16
- package/build/multichain/localsdk/multiversx.js.map +1 -1
- package/build/multichain/localsdk/near.js +9 -13
- package/build/multichain/localsdk/near.js.map +1 -1
- package/build/multichain/localsdk/solana.js +5 -9
- package/build/multichain/localsdk/solana.js.map +1 -1
- package/build/multichain/localsdk/ten.js +8 -45
- package/build/multichain/localsdk/ten.js.map +1 -1
- package/build/multichain/localsdk/ton.js +9 -13
- package/build/multichain/localsdk/ton.js.map +1 -1
- package/build/multichain/localsdk/tron.js +2 -6
- package/build/multichain/localsdk/tron.js.map +1 -1
- package/build/multichain/localsdk/xrp.js +6 -43
- package/build/multichain/localsdk/xrp.js.map +1 -1
- package/build/multichain/websdk/aptos.js +1 -5
- package/build/multichain/websdk/aptos.js.map +1 -1
- package/build/multichain/websdk/btc.js +2 -6
- package/build/multichain/websdk/btc.js.map +1 -1
- package/build/multichain/websdk/evm.js +2 -6
- package/build/multichain/websdk/evm.js.map +1 -1
- package/build/multichain/websdk/ibc.js +2 -6
- package/build/multichain/websdk/ibc.js.map +1 -1
- package/build/multichain/websdk/index.js +9 -21
- package/build/multichain/websdk/index.js.map +1 -1
- package/build/multichain/websdk/multiversx.js +9 -13
- package/build/multichain/websdk/multiversx.js.map +1 -1
- package/build/multichain/websdk/near.js +2 -6
- package/build/multichain/websdk/near.js.map +1 -1
- package/build/multichain/websdk/solana.js +10 -18
- package/build/multichain/websdk/solana.js.map +1 -1
- package/build/multichain/websdk/ton.js +2 -6
- package/build/multichain/websdk/ton.js.map +1 -1
- package/build/multichain/websdk/xrp.js +2 -6
- package/build/multichain/websdk/xrp.js.map +1 -1
- package/build/storage/StorageProgram.js +11 -18
- package/build/storage/StorageProgram.js.map +1 -1
- package/build/storage/index.js +2 -10
- package/build/storage/index.js.map +1 -1
- package/build/tlsnotary/TLSNotary.js +11 -52
- package/build/tlsnotary/TLSNotary.js.map +1 -1
- package/build/tlsnotary/TLSNotaryService.js +21 -25
- package/build/tlsnotary/TLSNotaryService.js.map +1 -1
- package/build/tlsnotary/auto-init.js +11 -17
- package/build/tlsnotary/auto-init.js.map +1 -1
- package/build/tlsnotary/helpers.js +1 -4
- package/build/tlsnotary/helpers.js.map +1 -1
- package/build/tlsnotary/index.js +8 -25
- package/build/tlsnotary/index.js.map +1 -1
- package/build/tlsnotary/service.js +2 -7
- package/build/tlsnotary/service.js.map +1 -1
- package/build/tlsnotary/types.js +1 -2
- package/build/tlsnotary/types.js.map +1 -1
- package/build/tlsnotary/webpack.js +10 -52
- package/build/tlsnotary/webpack.js.map +1 -1
- package/build/tlsnotary/worker.js +5 -40
- package/build/tlsnotary/worker.js.map +1 -1
- package/build/types/abstraction/index.d.ts +64 -1
- package/build/types/abstraction/index.js +1 -2
- package/build/types/abstraction/index.js.map +1 -1
- package/build/types/blockchain/Confirmation.js +1 -4
- package/build/types/blockchain/Confirmation.js.map +1 -1
- package/build/types/blockchain/CustomCharges.js +2 -6
- package/build/types/blockchain/CustomCharges.js.map +1 -1
- package/build/types/blockchain/GCREdit.d.ts +1 -1
- package/build/types/blockchain/GCREdit.js +1 -2
- package/build/types/blockchain/GCREdit.js.map +1 -1
- package/build/types/blockchain/ISignature.js +1 -2
- package/build/types/blockchain/Transaction.js +1 -17
- package/build/types/blockchain/Transaction.js.map +1 -1
- package/build/types/blockchain/TransactionSubtypes/ContractCallTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/ContractDeployTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/CrosschainTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/D402PaymentTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/DemosworkTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/EscrowTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/IPFSTransaction.js +5 -12
- package/build/types/blockchain/TransactionSubtypes/IPFSTransaction.js.map +1 -1
- package/build/types/blockchain/TransactionSubtypes/IdentityTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/InstantMessagingTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/L2PSHashTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/L2PSTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/NativeBridgeTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/NativeTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/StorageProgramTransaction.js +4 -10
- package/build/types/blockchain/TransactionSubtypes/StorageProgramTransaction.js.map +1 -1
- package/build/types/blockchain/TransactionSubtypes/StorageTransaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/Web2Transaction.js +1 -2
- package/build/types/blockchain/TransactionSubtypes/index.js +16 -32
- package/build/types/blockchain/TransactionSubtypes/index.js.map +1 -1
- package/build/types/blockchain/TransactionSubtypes/utils.js +2 -6
- package/build/types/blockchain/TransactionSubtypes/utils.js.map +1 -1
- package/build/types/blockchain/TxFee.js +1 -2
- package/build/types/blockchain/ValidityData.js +1 -5
- package/build/types/blockchain/ValidityData.js.map +1 -1
- package/build/types/blockchain/WalletTypes.js +1 -2
- package/build/types/blockchain/address.js +1 -2
- package/build/types/blockchain/addressInfo.js +1 -2
- package/build/types/blockchain/blocks.js +1 -2
- package/build/types/blockchain/blocks.js.map +1 -1
- package/build/types/blockchain/encryptedTransaction.js +1 -2
- package/build/types/blockchain/genesisTypes.js +1 -2
- package/build/types/blockchain/genesisTypes.js.map +1 -1
- package/build/types/blockchain/identities.js +1 -2
- package/build/types/blockchain/identities.js.map +1 -1
- package/build/types/blockchain/rawTransaction.js +1 -2
- package/build/types/blockchain/rawTransaction.js.map +1 -1
- package/build/types/blockchain/statusNative.js +1 -2
- package/build/types/blockchain/statusProperties.js +1 -2
- package/build/types/bridge/bridgeTradePayload.js +1 -2
- package/build/types/bridge/constants.js +3 -6
- package/build/types/bridge/constants.js.map +1 -1
- package/build/types/communication/demosWork.js +1 -2
- package/build/types/communication/rpc.js +1 -4
- package/build/types/communication/rpc.js.map +1 -1
- package/build/types/communication/transmit.js +1 -2
- package/build/types/communication/transmit.js.map +1 -1
- package/build/types/cryptography.js +1 -2
- package/build/types/demoswork/datatypes.js +2 -5
- package/build/types/demoswork/datatypes.js.map +1 -1
- package/build/types/demoswork/index.js +1 -2
- package/build/types/demoswork/operations.js +1 -2
- package/build/types/demoswork/steps.js +4 -7
- package/build/types/demoswork/steps.js.map +1 -1
- package/build/types/gls/Operation.js +1 -2
- package/build/types/gls/StateChange.js +1 -2
- package/build/types/gls/StateChange.js.map +1 -1
- package/build/types/gls/account.js +1 -2
- package/build/types/index.js +10 -30
- package/build/types/index.js.map +1 -1
- package/build/types/instantMessaging/index.js +1 -2
- package/build/types/native/INativePayload.js +1 -2
- package/build/types/native/INativePayload.js.map +1 -1
- package/build/types/native/index.js +1 -17
- package/build/types/native/index.js.map +1 -1
- package/build/types/network/ExecutionResult.js +1 -2
- package/build/types/network/SecurityTypes.js +1 -2
- package/build/types/peers/Peer.js +1 -2
- package/build/types/peers/Peer.js.map +1 -1
- package/build/types/web2/discord.js +1 -2
- package/build/types/web2/index.js +2 -5
- package/build/types/web2/index.js.map +1 -1
- package/build/types/web2/telegram.js +1 -2
- package/build/types/web2/telegram.js.map +1 -1
- package/build/types/web2/twitter.js +1 -2
- package/build/types/xm/apiTools.js +1 -2
- package/build/types/xm/index.js +1 -2
- package/build/utils/dataManipulation.js +5 -12
- package/build/utils/dataManipulation.js.map +1 -1
- package/build/utils/getRemoteIP.js +3 -9
- package/build/utils/getRemoteIP.js.map +1 -1
- package/build/utils/index.js +4 -44
- package/build/utils/index.js.map +1 -1
- package/build/utils/pprint.js +3 -9
- package/build/utils/pprint.js.map +1 -1
- package/build/utils/uint8Serialize.js +2 -6
- package/build/utils/uint8Serialize.js.map +1 -1
- package/build/wallet/Wallet.js +11 -46
- package/build/wallet/Wallet.js.map +1 -1
- package/build/wallet/index.js +1 -37
- package/build/wallet/index.js.map +1 -1
- package/build/wallet/passkeys/passkeys.js +9 -16
- package/build/wallet/passkeys/passkeys.js.map +1 -1
- package/build/websdk/DemosContracts.d.ts +1 -1
- package/build/websdk/DemosContracts.js +9 -13
- package/build/websdk/DemosContracts.js.map +1 -1
- package/build/websdk/DemosTransactions.js +33 -69
- package/build/websdk/DemosTransactions.js.map +1 -1
- package/build/websdk/DemosWebAuth.js +17 -24
- package/build/websdk/DemosWebAuth.js.map +1 -1
- package/build/websdk/GCRGeneration.js +31 -19
- package/build/websdk/GCRGeneration.js.map +1 -1
- package/build/websdk/Web2Calls.js +14 -18
- package/build/websdk/Web2Calls.js.map +1 -1
- package/build/websdk/XMTransactions.js +8 -13
- package/build/websdk/XMTransactions.js.map +1 -1
- package/build/websdk/bridge.js +1 -5
- package/build/websdk/bridge.js.map +1 -1
- package/build/websdk/demos.js +2 -5
- package/build/websdk/demos.js.map +1 -1
- package/build/websdk/demosclass.js +55 -95
- package/build/websdk/demosclass.js.map +1 -1
- package/build/websdk/examples/tryWeb2.js +4 -6
- package/build/websdk/examples/tryWeb2.js.map +1 -1
- package/build/websdk/index.js +14 -69
- package/build/websdk/index.js.map +1 -1
- package/build/websdk/rsa.js +17 -24
- package/build/websdk/rsa.js.map +1 -1
- package/build/websdk/types/IBuffer.js +1 -2
- package/build/websdk/types/KeyPair.js +1 -2
- package/build/websdk/utils/bufferizer.js +1 -4
- package/build/websdk/utils/bufferizer.js.map +1 -1
- package/build/websdk/utils/canonicalJson.js +3 -8
- package/build/websdk/utils/canonicalJson.js.map +1 -1
- package/build/websdk/utils/forge_converter.js +4 -7
- package/build/websdk/utils/forge_converter.js.map +1 -1
- package/build/websdk/utils/required.js +2 -6
- package/build/websdk/utils/required.js.map +1 -1
- package/build/websdk/utils/sha256.js +1 -4
- package/build/websdk/utils/sha256.js.map +1 -1
- package/build/websdk/utils/skeletons.js +3 -8
- package/build/websdk/utils/skeletons.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const skeletons_1 = require("./utils/skeletons");
|
|
6
|
-
const DemosTransactions_1 = require("./DemosTransactions");
|
|
7
|
-
const canonicalJson_1 = require("./utils/canonicalJson");
|
|
1
|
+
import { EnumWeb2Actions } from "../types/index.js";
|
|
2
|
+
import { web2_request } from "./utils/skeletons.js";
|
|
3
|
+
import { DemosTransactions } from "./DemosTransactions.js";
|
|
4
|
+
import { canonicalJSONStringify, validatePureJson, looksLikeJsonString, } from "./utils/canonicalJson.js";
|
|
8
5
|
class Web2InvalidUrlError extends Error {
|
|
9
6
|
constructor(message, code) {
|
|
10
7
|
super(message);
|
|
@@ -42,7 +39,7 @@ function getCanonicalHttpUrlOrThrow(input) {
|
|
|
42
39
|
}
|
|
43
40
|
return u.toString(); // canonical form
|
|
44
41
|
}
|
|
45
|
-
class Web2Proxy {
|
|
42
|
+
export class Web2Proxy {
|
|
46
43
|
constructor(sessionId, demos) {
|
|
47
44
|
this._sessionId = sessionId;
|
|
48
45
|
this._demos = demos;
|
|
@@ -66,12 +63,12 @@ class Web2Proxy {
|
|
|
66
63
|
}, }) {
|
|
67
64
|
const canonicalUrl = getCanonicalHttpUrlOrThrow(url);
|
|
68
65
|
// Create a fresh copy of web2Request for each call
|
|
69
|
-
const freshWeb2Request = { ...
|
|
66
|
+
const freshWeb2Request = { ...web2_request };
|
|
70
67
|
// Shallow-merge headers without mutating caller's object
|
|
71
68
|
const callerHeaders = options?.headers ? { ...options.headers } : {};
|
|
72
69
|
freshWeb2Request.raw = {
|
|
73
70
|
...freshWeb2Request.raw,
|
|
74
|
-
action:
|
|
71
|
+
action: EnumWeb2Actions.START_PROXY,
|
|
75
72
|
method,
|
|
76
73
|
url: canonicalUrl,
|
|
77
74
|
headers: callerHeaders,
|
|
@@ -80,8 +77,8 @@ class Web2Proxy {
|
|
|
80
77
|
let canonicalPayload = undefined;
|
|
81
78
|
if (options?.payload !== undefined) {
|
|
82
79
|
if (typeof options.payload === "object") {
|
|
83
|
-
|
|
84
|
-
canonicalPayload =
|
|
80
|
+
validatePureJson(options.payload);
|
|
81
|
+
canonicalPayload = canonicalJSONStringify(options.payload);
|
|
85
82
|
// Only set JSON content-type if not already set by caller
|
|
86
83
|
if (!Object.keys(callerHeaders).some(h => h.toLowerCase() === "content-type")) {
|
|
87
84
|
callerHeaders["Content-Type"] = "application/json";
|
|
@@ -89,7 +86,7 @@ class Web2Proxy {
|
|
|
89
86
|
}
|
|
90
87
|
else if (typeof options.payload === "string") {
|
|
91
88
|
// Heuristic warning for accidental double-stringify
|
|
92
|
-
if (
|
|
89
|
+
if (looksLikeJsonString(options.payload)) {
|
|
93
90
|
console.warn("[Web2Calls] String payload looks like JSON. It will be used as raw bytes; if you intended object canonicalization, pass the object instead.");
|
|
94
91
|
}
|
|
95
92
|
canonicalPayload = options.payload;
|
|
@@ -132,7 +129,7 @@ class Web2Proxy {
|
|
|
132
129
|
},
|
|
133
130
|
};
|
|
134
131
|
// Create a transaction to store the web2 payload in the blockchain.
|
|
135
|
-
const web2Tx =
|
|
132
|
+
const web2Tx = DemosTransactions.empty();
|
|
136
133
|
web2Tx.content.to = await this._demos.getEd25519Address();
|
|
137
134
|
web2Tx.content.type = "web2Request";
|
|
138
135
|
web2Tx.content.data = ["web2Request", web2Payload];
|
|
@@ -148,11 +145,10 @@ class Web2Proxy {
|
|
|
148
145
|
return result;
|
|
149
146
|
}
|
|
150
147
|
}
|
|
151
|
-
exports.Web2Proxy = Web2Proxy;
|
|
152
148
|
/**
|
|
153
149
|
* The Web2Calls object provides functions for creating and managing Web2 proxies.
|
|
154
150
|
*/
|
|
155
|
-
|
|
151
|
+
export const web2Calls = {
|
|
156
152
|
/**
|
|
157
153
|
* Create a new DAHR instance.
|
|
158
154
|
* @param {Demos} demos - The demos instance to use for the request.
|
|
@@ -164,10 +160,10 @@ exports.web2Calls = {
|
|
|
164
160
|
throw new Error("No keypair provided and no wallet connected");
|
|
165
161
|
}
|
|
166
162
|
// Create a fresh copy of web2Request for creation
|
|
167
|
-
const freshWeb2Request = { ...
|
|
163
|
+
const freshWeb2Request = { ...web2_request };
|
|
168
164
|
freshWeb2Request.raw = {
|
|
169
165
|
...freshWeb2Request.raw,
|
|
170
|
-
action:
|
|
166
|
+
action: EnumWeb2Actions.CREATE,
|
|
171
167
|
};
|
|
172
168
|
const response = await demos.call("web2ProxyRequest", {
|
|
173
169
|
web2Request: freshWeb2Request,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Web2Calls.js","sourceRoot":"","sources":["../../../src/websdk/Web2Calls.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Web2Calls.js","sourceRoot":"","sources":["../../../src/websdk/Web2Calls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,GACtB,MAAM,uBAAuB,CAAA;AAQ9B,MAAM,mBAAoB,SAAQ,KAAK;IAEnC,YAAY,OAAe,EAAE,IAAY;QACrC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;QACjC,IAAI,CAAC,IAAI,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AAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;QAEzC,MAAM,MAAM,GAAgB;YACxB,GAAG,QAAQ,CAAC,QAAQ;YACpB,MAAM;SACT,CAAA;QACD,OAAO,MAAM,CAAA;IACjB,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB;;;;OAIG;IACH,UAAU,EAAE,KAAK,EAAE,KAAY,EAAsB,EAAE;QACnD,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAA;QAEjC,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;QAClE,CAAC;QAED,kDAAkD;QAClD,MAAM,gBAAgB,GAAG,EAAE,GAAG,YAAY,EAAE,CAAA;QAC5C,gBAAgB,CAAC,GAAG,GAAG;YACnB,GAAG,gBAAgB,CAAC,GAAG;YACvB,MAAM,EAAE,eAAe,CAAC,MAAM;SACjC,CAAA;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAClD,WAAW,EAAE,gBAAgB;SAChC,CAAC,CAAA;QAEF,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAA;QACpD,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QACrD,CAAC;QAED,OAAO,IAAI,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;IAC1C,CAAC;CACJ,CAAA"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// INFO Use the src/features/multichain/chainscript/chainscript.chs for the specs
|
|
3
2
|
// NOTE This module is meant to be used with the demos websdk
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.prepareXMPayload = prepareXMPayload;
|
|
8
|
-
const utils_1 = require("../demoswork/utils");
|
|
9
|
-
const DemosTransactions_1 = require("./DemosTransactions");
|
|
10
|
-
const unifiedCrypto_1 = require("../encryption/unifiedCrypto");
|
|
3
|
+
import { getNewUID } from "../demoswork/utils/index.js";
|
|
4
|
+
import { DemosTransactions } from "./DemosTransactions.js";
|
|
5
|
+
import { uint8ArrayToHex } from "../encryption/unifiedCrypto.js";
|
|
11
6
|
// INFO Using the methods below to create, manage and send chainscript-like scripts
|
|
12
7
|
const XMTransactions = {
|
|
13
8
|
schemas: {
|
|
@@ -114,9 +109,8 @@ const XMTransactions = {
|
|
|
114
109
|
},
|
|
115
110
|
},
|
|
116
111
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const id = (0, utils_1.getNewUID)();
|
|
112
|
+
export function prepareXMScript({ chain, is_evm, subchain, signedPayloads, type, params, rpc, }) {
|
|
113
|
+
const id = getNewUID();
|
|
120
114
|
return {
|
|
121
115
|
operations: {
|
|
122
116
|
[id]: {
|
|
@@ -135,9 +129,9 @@ function prepareXMScript({ chain, is_evm, subchain, signedPayloads, type, params
|
|
|
135
129
|
};
|
|
136
130
|
}
|
|
137
131
|
async function prepareXMPayload(xm_payload, demos) {
|
|
138
|
-
const tx =
|
|
132
|
+
const tx = DemosTransactions.empty();
|
|
139
133
|
const ed25519 = await demos.crypto.getIdentity("ed25519");
|
|
140
|
-
const ed25519_address =
|
|
134
|
+
const ed25519_address = uint8ArrayToHex(ed25519.publicKey);
|
|
141
135
|
tx.content.to = ed25519_address;
|
|
142
136
|
// Setting the type and data
|
|
143
137
|
tx.content.type = "crosschainOperation";
|
|
@@ -147,4 +141,5 @@ async function prepareXMPayload(xm_payload, demos) {
|
|
|
147
141
|
// Signing the transaction
|
|
148
142
|
return await demos.sign(tx);
|
|
149
143
|
}
|
|
144
|
+
export { prepareXMPayload, XMTransactions };
|
|
150
145
|
//# sourceMappingURL=XMTransactions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XMTransactions.js","sourceRoot":"","sources":["../../../src/websdk/XMTransactions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"XMTransactions.js","sourceRoot":"","sources":["../../../src/websdk/XMTransactions.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,6DAA6D;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGvD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,mFAAmF;AACnF,MAAM,cAAc,GAAG;IACnB,OAAO,EAAE;QACL,cAAc,EAAE;YACZ,KAAK,EAAE,EAAE;YACT,QAAQ,EAAE,EAAE;YACZ,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,EAAE;YACP,WAAW,EAAE,KAAK;YAClB,IAAI,EAAE;gBACF,IAAI,EAAE,EAAE;gBACR,MAAM,EAAE,EAAE;gBACV,cAAc,EAAS,EAAE;aAC5B;SACJ;QACD,mBAAmB,EAAE;YACjB,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,WAAW,EAAE,EAAE;SAClB;KACJ;IAED,IAAI,EAAE;QACF,qFAAqF;QACrF,iBAAiB,EAA0B,EAAE;QAC7C,gBAAgB,EAAuB,EAAE;KAC5C;IAED,IAAI,EAAE,EAAE;IAER,SAAS,EAAE;QACP,iBAAiB;QAEjB,uEAAuE;QACvE,yGAAyG;QACzG,MAAM,EAAE,UACJ,IAAqB,EACrB,KAAa,EACb,QAAgB,EAChB,MAAe,EACf,GAAW,EACX,IAAyD,EACzD,WAAW,GAAG,KAAK;YAEnB,gCAAgC;YAChC,MAAM,SAAS,GAAG,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC,cAAc,EAAE,CAAA;YAC9D,SAAS,CAAC,KAAK,GAAG,KAAK,CAAA;YACvB,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAA;YAC7B,SAAS,CAAC,MAAM,GAAG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,CAAA;IACxE,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,eAAe,CAAA;IAE/B,4BAA4B;IAC5B,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACvC,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAA;IACrD,wBAAwB;IACxB,EAAE,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IACjC,0BAA0B;IAC1B,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAC/B,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAA"}
|
package/build/websdk/bridge.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RubicBridge = void 0;
|
|
4
|
-
class RubicBridge {
|
|
1
|
+
export class RubicBridge {
|
|
5
2
|
async getTrade(demos, chain, payload) {
|
|
6
3
|
const request = {
|
|
7
4
|
method: "bridge",
|
|
@@ -42,5 +39,4 @@ class RubicBridge {
|
|
|
42
39
|
return await demos.rpcCall(request, true);
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
|
-
exports.RubicBridge = RubicBridge;
|
|
46
42
|
//# sourceMappingURL=bridge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../../src/websdk/bridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../../src/websdk/bridge.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,WAAW;IACpB,KAAK,CAAC,QAAQ,CACV,KAAY,EACZ,KAAa,EACb,OAA2B;QAE3B,MAAM,OAAO,GAAG;YACZ,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACJ;oBACI,MAAM,EAAE,WAAW;oBACnB,KAAK,EAAE,KAAK;oBACZ,MAAM,EAAE,CAAC,OAAO,CAAC;iBACpB;aACJ;SACJ,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC7C,CAAC;IAED,KAAK,CAAC,YAAY,CACd,KAAY,EACZ,KAAa,EACb,OAA2B;QAE3B,MAAM,OAAO,GAAG;YACZ,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACJ;oBACI,MAAM,EAAE,eAAe;oBACvB,KAAK,EAAE,KAAK;oBACZ,MAAM,EAAE,CAAC,OAAO,CAAC;iBACpB;aACJ;SACJ,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC7C,CAAC;IAED,KAAK,CAAC,gBAAgB,CAClB,KAAY,EACZ,KAAa,EACb,OAA+B;QAE/B,MAAM,OAAO,GAAG;YACZ,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACJ;oBACI,MAAM,EAAE,oBAAoB;oBAC5B,KAAK,EAAE,KAAK;oBACZ,MAAM,EAAE,CAAC,OAAO,CAAC;iBACpB;aACJ;SACJ,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC7C,CAAC;CACJ"}
|
package/build/websdk/demos.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.demos = void 0;
|
|
4
|
-
const demosclass_1 = require("./demosclass");
|
|
1
|
+
import { Demos } from "./demosclass.js";
|
|
5
2
|
/**
|
|
6
3
|
* A global instance of the Demos class.
|
|
7
4
|
*
|
|
8
5
|
* @see Demos class
|
|
9
6
|
*/
|
|
10
|
-
|
|
7
|
+
export const demos = Demos.instance;
|
|
11
8
|
//# sourceMappingURL=demos.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"demos.js","sourceRoot":"","sources":["../../../src/websdk/demos.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"demos.js","sourceRoot":"","sources":["../../../src/websdk/demos.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEpC;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAA"}
|
|
@@ -1,60 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* INFO
|
|
3
2
|
This library contains all the functions that are used to interact with the demos blockchain.
|
|
4
3
|
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.Demos = void 0;
|
|
43
4
|
/* eslint-disable no-unused-vars */
|
|
44
5
|
/* eslint-disable no-undef */
|
|
45
|
-
|
|
46
|
-
|
|
6
|
+
import axios from "axios";
|
|
7
|
+
import * as skeletons from "./utils/skeletons.js";
|
|
47
8
|
// NOTE Including custom libraries from Demos
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
9
|
+
import { DemosTransactions } from "./DemosTransactions.js";
|
|
10
|
+
import { DemosWebAuth } from "./DemosWebAuth.js";
|
|
11
|
+
import { prepareXMPayload } from "./XMTransactions.js";
|
|
12
|
+
import { _required as required } from "./utils/required.js";
|
|
13
|
+
import { web2Calls } from "./Web2Calls.js";
|
|
14
|
+
import { hexToUint8Array, uint8ArrayToHex, UnifiedCrypto } from "../encryption/unifiedCrypto.js";
|
|
15
|
+
import { GCRGeneration } from "./GCRGeneration.js";
|
|
16
|
+
import { Hashing } from "../encryption/Hashing.js";
|
|
17
|
+
import * as bip39 from "@scure/bip39";
|
|
18
|
+
import { wordList } from "../encryption/PQC/falconts/index.js";
|
|
58
19
|
async function sleep(ms) {
|
|
59
20
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
60
21
|
}
|
|
@@ -62,7 +23,7 @@ async function sleep(ms) {
|
|
|
62
23
|
/**
|
|
63
24
|
* This class provides methods to interact with the DEMOS blockchain.
|
|
64
25
|
*/
|
|
65
|
-
class Demos {
|
|
26
|
+
export class Demos {
|
|
66
27
|
/** Connection status of the wallet */
|
|
67
28
|
get walletConnected() {
|
|
68
29
|
// return this.keypair !== null && this.keypair.privateKey !== null
|
|
@@ -96,9 +57,9 @@ class Demos {
|
|
|
96
57
|
this.dual_sign = false;
|
|
97
58
|
// ANCHOR Web2 Endpoints
|
|
98
59
|
this.web2 = {
|
|
99
|
-
...
|
|
60
|
+
...web2Calls,
|
|
100
61
|
createDahr: async () => {
|
|
101
|
-
return await
|
|
62
|
+
return await web2Calls.createDahr(this);
|
|
102
63
|
},
|
|
103
64
|
getTweet: async (tweetUrl) => {
|
|
104
65
|
return await this.nodeCall("getTweet", {
|
|
@@ -153,11 +114,11 @@ class Demos {
|
|
|
153
114
|
if (!usedKeypair) {
|
|
154
115
|
throw new Error("No keypair provided and no wallet connected");
|
|
155
116
|
}
|
|
156
|
-
return
|
|
117
|
+
return prepareXMPayload(xm_payload, this);
|
|
157
118
|
},
|
|
158
119
|
};
|
|
159
120
|
this.tx = {
|
|
160
|
-
...
|
|
121
|
+
...DemosTransactions,
|
|
161
122
|
/**
|
|
162
123
|
* Same as `demos.sign`.
|
|
163
124
|
* Signs a transaction after hashing its content.
|
|
@@ -170,13 +131,13 @@ class Demos {
|
|
|
170
131
|
};
|
|
171
132
|
// ANCHOR Supporting txs
|
|
172
133
|
// REVIEW: These two are deprecated, in favor of `demos.tx` (but kept to avoid breaking references)
|
|
173
|
-
this.DemosTransactions =
|
|
174
|
-
this.transactions =
|
|
134
|
+
this.DemosTransactions = DemosTransactions;
|
|
135
|
+
this.transactions = DemosTransactions;
|
|
175
136
|
// INFO DemosWebAuthenticator
|
|
176
|
-
this.DemosWebAuth =
|
|
137
|
+
this.DemosWebAuth = DemosWebAuth;
|
|
177
138
|
// INFO Calling demos.skeletons.NAME provides an empty skeleton that can be used for reference while calling other demos functions
|
|
178
139
|
this.skeletons = skeletons;
|
|
179
|
-
this.crypto =
|
|
140
|
+
this.crypto = UnifiedCrypto.getInstance();
|
|
180
141
|
}
|
|
181
142
|
static get instance() {
|
|
182
143
|
if (!Demos._instance) {
|
|
@@ -191,7 +152,7 @@ class Demos {
|
|
|
191
152
|
* @returns The mnemonic
|
|
192
153
|
*/
|
|
193
154
|
newMnemonic(strength = 128) {
|
|
194
|
-
return bip39.generateMnemonic(
|
|
155
|
+
return bip39.generateMnemonic(wordList, strength);
|
|
195
156
|
}
|
|
196
157
|
/**
|
|
197
158
|
* Connects to a RPC URL. Throws an error if the connection fails.
|
|
@@ -200,7 +161,7 @@ class Demos {
|
|
|
200
161
|
* @returns Whether the connection was successful
|
|
201
162
|
*/
|
|
202
163
|
async connect(rpc_url) {
|
|
203
|
-
const response = await
|
|
164
|
+
const response = await axios.get(rpc_url);
|
|
204
165
|
if (response.status == 200) {
|
|
205
166
|
this.rpc_url = rpc_url;
|
|
206
167
|
}
|
|
@@ -233,7 +194,7 @@ class Demos {
|
|
|
233
194
|
let hashable = null;
|
|
234
195
|
if (typeof masterSeed === "string") {
|
|
235
196
|
masterSeed = masterSeed.trim();
|
|
236
|
-
if (!bip39.validateMnemonic(masterSeed,
|
|
197
|
+
if (!bip39.validateMnemonic(masterSeed, wordList)) {
|
|
237
198
|
hashable = bip39.mnemonicToSeedSync(masterSeed);
|
|
238
199
|
}
|
|
239
200
|
else {
|
|
@@ -247,9 +208,9 @@ class Demos {
|
|
|
247
208
|
hashable = masterSeed;
|
|
248
209
|
}
|
|
249
210
|
if (hashable) {
|
|
250
|
-
const seedHash =
|
|
211
|
+
const seedHash = Hashing.sha3_512(hashable);
|
|
251
212
|
// remove the 0x prefix
|
|
252
|
-
const seedHashHex =
|
|
213
|
+
const seedHashHex = uint8ArrayToHex(seedHash).slice(2);
|
|
253
214
|
seed = new TextEncoder().encode(seedHashHex);
|
|
254
215
|
}
|
|
255
216
|
else {
|
|
@@ -260,7 +221,7 @@ class Demos {
|
|
|
260
221
|
await this.crypto.generateIdentity("ed25519", seed);
|
|
261
222
|
}
|
|
262
223
|
await this.crypto.generateIdentity(this.algorithm, seed);
|
|
263
|
-
return
|
|
224
|
+
return uint8ArrayToHex(this.keypair.publicKey);
|
|
264
225
|
}
|
|
265
226
|
/**
|
|
266
227
|
* Returns the public key of the connected wallet.
|
|
@@ -268,8 +229,8 @@ class Demos {
|
|
|
268
229
|
* @returns The public key of the wallet
|
|
269
230
|
*/
|
|
270
231
|
getAddress() {
|
|
271
|
-
(
|
|
272
|
-
return
|
|
232
|
+
required(this.walletConnected, "Wallet not connected");
|
|
233
|
+
return uint8ArrayToHex(this.keypair.publicKey);
|
|
273
234
|
}
|
|
274
235
|
/**
|
|
275
236
|
* Returns the ed25519 address of the connected wallet.
|
|
@@ -277,7 +238,7 @@ class Demos {
|
|
|
277
238
|
*/
|
|
278
239
|
async getEd25519Address() {
|
|
279
240
|
const { publicKey } = await this.crypto.getIdentity("ed25519");
|
|
280
|
-
return
|
|
241
|
+
return uint8ArrayToHex(publicKey);
|
|
281
242
|
}
|
|
282
243
|
// !SECTION Connection and listeners
|
|
283
244
|
/**
|
|
@@ -302,8 +263,8 @@ class Demos {
|
|
|
302
263
|
* @returns The signed transaction.
|
|
303
264
|
*/
|
|
304
265
|
pay(to, amount) {
|
|
305
|
-
(
|
|
306
|
-
return
|
|
266
|
+
required(this.keypair, "Wallet not connected");
|
|
267
|
+
return DemosTransactions.pay(to, amount, this);
|
|
307
268
|
}
|
|
308
269
|
/**
|
|
309
270
|
* Create a signed DEMOS transaction to send native tokens to a given address.
|
|
@@ -314,8 +275,8 @@ class Demos {
|
|
|
314
275
|
* @returns The signed transaction.
|
|
315
276
|
*/
|
|
316
277
|
transfer(to, amount) {
|
|
317
|
-
(
|
|
318
|
-
return
|
|
278
|
+
required(this.keypair, "Wallet not connected");
|
|
279
|
+
return DemosTransactions.pay(to, amount, this);
|
|
319
280
|
}
|
|
320
281
|
/**
|
|
321
282
|
* Create a signed DEMOS transaction to store binary data on the blockchain.
|
|
@@ -326,8 +287,8 @@ class Demos {
|
|
|
326
287
|
* @returns The signed storage transaction.
|
|
327
288
|
*/
|
|
328
289
|
store(bytes) {
|
|
329
|
-
(
|
|
330
|
-
return
|
|
290
|
+
required(this.keypair, "Wallet not connected");
|
|
291
|
+
return DemosTransactions.store(bytes, this);
|
|
331
292
|
}
|
|
332
293
|
/**
|
|
333
294
|
* Confirms a transaction.
|
|
@@ -336,7 +297,7 @@ class Demos {
|
|
|
336
297
|
* @returns The validity data of the transaction containing the gas information.
|
|
337
298
|
*/
|
|
338
299
|
confirm(transaction) {
|
|
339
|
-
return
|
|
300
|
+
return DemosTransactions.confirm(transaction, this);
|
|
340
301
|
}
|
|
341
302
|
/**
|
|
342
303
|
* Broadcasts a transaction for execution.
|
|
@@ -345,7 +306,7 @@ class Demos {
|
|
|
345
306
|
* @returns The response from the node
|
|
346
307
|
*/
|
|
347
308
|
broadcast(validationData) {
|
|
348
|
-
return
|
|
309
|
+
return DemosTransactions.broadcast(validationData, this);
|
|
349
310
|
}
|
|
350
311
|
/**
|
|
351
312
|
* Signs a transaction.
|
|
@@ -355,16 +316,16 @@ class Demos {
|
|
|
355
316
|
* @returns The signed transaction
|
|
356
317
|
*/
|
|
357
318
|
async sign(raw_tx) {
|
|
358
|
-
(
|
|
319
|
+
required(this.keypair, "Wallet not connected");
|
|
359
320
|
if (!raw_tx.content.timestamp || raw_tx.content.timestamp === 0) {
|
|
360
321
|
raw_tx.content.timestamp = Date.now();
|
|
361
322
|
}
|
|
362
323
|
// INFO: Use the connected algorithm's public key as the sender
|
|
363
|
-
raw_tx.content.from =
|
|
324
|
+
raw_tx.content.from = uint8ArrayToHex(this.keypair.publicKey);
|
|
364
325
|
// INFO: If no ed25519 address is provided, use the connected master seed's ed25519 address
|
|
365
326
|
if (!raw_tx.content.from_ed25519_address) {
|
|
366
327
|
const { publicKey } = await this.crypto.getIdentity("ed25519");
|
|
367
|
-
raw_tx.content.from_ed25519_address =
|
|
328
|
+
raw_tx.content.from_ed25519_address = uint8ArrayToHex(publicKey);
|
|
368
329
|
}
|
|
369
330
|
// INFO: Client-side enforcement of reflexive transactions
|
|
370
331
|
const reflexive = ["identity", "crosschainOperation", "web2Request", "nativeBridge"];
|
|
@@ -404,7 +365,7 @@ class Demos {
|
|
|
404
365
|
if (!raw_tx.content.from.startsWith("0x")) {
|
|
405
366
|
raw_tx.content.from = "0x" + raw_tx.content.from;
|
|
406
367
|
}
|
|
407
|
-
raw_tx.content.gcr_edits = await
|
|
368
|
+
raw_tx.content.gcr_edits = await GCRGeneration.generate(raw_tx);
|
|
408
369
|
// We derive the network fee from GCR edits (sum of sender balance removals minus `amount`).
|
|
409
370
|
// This is a pragmatic interim approach; ideally the node should authoritatively return fees
|
|
410
371
|
// to avoid drift between SDK and node logic.
|
|
@@ -415,17 +376,17 @@ class Demos {
|
|
|
415
376
|
// Non-fatal: if fee derivation fails, continue without modifying fees
|
|
416
377
|
console.warn("[demos] fee derivation skipped:", e);
|
|
417
378
|
}
|
|
418
|
-
raw_tx.hash =
|
|
379
|
+
raw_tx.hash = Hashing.sha256(JSON.stringify(raw_tx.content));
|
|
419
380
|
const signature = await this.crypto.sign(this.algorithm, new TextEncoder().encode(raw_tx.hash));
|
|
420
381
|
// INFO: We only dual-sign when signing with PQC keypairs
|
|
421
382
|
let dual_sign = this.dual_sign && this.algorithm !== "ed25519";
|
|
422
383
|
if (dual_sign) {
|
|
423
384
|
const ed25519_signature = await this.crypto.sign("ed25519", new TextEncoder().encode(raw_tx.hash));
|
|
424
|
-
raw_tx.ed25519_signature =
|
|
385
|
+
raw_tx.ed25519_signature = uint8ArrayToHex(ed25519_signature.signature);
|
|
425
386
|
}
|
|
426
387
|
raw_tx.signature = {
|
|
427
388
|
type: this.algorithm,
|
|
428
|
-
data:
|
|
389
|
+
data: uint8ArrayToHex(signature.signature),
|
|
429
390
|
};
|
|
430
391
|
return raw_tx;
|
|
431
392
|
}
|
|
@@ -451,7 +412,7 @@ class Demos {
|
|
|
451
412
|
messageBuffer = message;
|
|
452
413
|
}
|
|
453
414
|
const signature = await this.crypto.sign(algorithm, messageBuffer);
|
|
454
|
-
return { type: algorithm, data:
|
|
415
|
+
return { type: algorithm, data: uint8ArrayToHex(signature.signature) };
|
|
455
416
|
}
|
|
456
417
|
/**
|
|
457
418
|
* Verifies a message.
|
|
@@ -475,8 +436,8 @@ class Demos {
|
|
|
475
436
|
}
|
|
476
437
|
const verified = await this.crypto.verify({
|
|
477
438
|
algorithm: algorithm,
|
|
478
|
-
signature:
|
|
479
|
-
publicKey:
|
|
439
|
+
signature: hexToUint8Array(signature),
|
|
440
|
+
publicKey: hexToUint8Array(publicKey),
|
|
480
441
|
message: messageBuffer,
|
|
481
442
|
});
|
|
482
443
|
return verified;
|
|
@@ -541,12 +502,12 @@ class Demos {
|
|
|
541
502
|
let publicKey = "";
|
|
542
503
|
let signature = "";
|
|
543
504
|
if (isAuthenticated) {
|
|
544
|
-
publicKey =
|
|
505
|
+
publicKey = uint8ArrayToHex(this.keypair.publicKey);
|
|
545
506
|
const _signature = await this.crypto.sign(this.algorithm, new TextEncoder().encode(publicKey));
|
|
546
|
-
signature =
|
|
507
|
+
signature = uint8ArrayToHex(_signature.signature);
|
|
547
508
|
}
|
|
548
509
|
try {
|
|
549
|
-
const response = await
|
|
510
|
+
const response = await axios.post(this.rpc_url, request, {
|
|
550
511
|
headers: {
|
|
551
512
|
"Content-Type": "application/json",
|
|
552
513
|
identity: this.algorithm + ":" + publicKey,
|
|
@@ -603,13 +564,13 @@ class Demos {
|
|
|
603
564
|
if (!this.walletConnected) {
|
|
604
565
|
throw new Error("Error: Wallet not connected! Please connect a private key using demos.connectWallet(privateKey) or provide one via the privateKey parameter");
|
|
605
566
|
}
|
|
606
|
-
const publicKey =
|
|
567
|
+
const publicKey = uint8ArrayToHex(this.keypair.publicKey);
|
|
607
568
|
const signature = await this.crypto.sign(this.algorithm, new TextEncoder().encode(publicKey));
|
|
608
569
|
pubkey_string = this.algorithm + ":" + publicKey;
|
|
609
|
-
pubkey_signature =
|
|
570
|
+
pubkey_signature = uint8ArrayToHex(signature.signature);
|
|
610
571
|
}
|
|
611
572
|
try {
|
|
612
|
-
const response = await
|
|
573
|
+
const response = await axios.post(this.rpc_url, request, {
|
|
613
574
|
headers: {
|
|
614
575
|
"Content-Type": "application/json",
|
|
615
576
|
identity: pubkey_string,
|
|
@@ -827,7 +788,7 @@ class Demos {
|
|
|
827
788
|
}
|
|
828
789
|
// Dynamic import to avoid bundling issues with webpack
|
|
829
790
|
// The TLSNotary class uses Web Workers and WASM which require runtime loading
|
|
830
|
-
const { TLSNotary } = await
|
|
791
|
+
const { TLSNotary } = await import("../tlsnotary/index.js");
|
|
831
792
|
let tlsnConfig;
|
|
832
793
|
if (config) {
|
|
833
794
|
// Use explicit configuration (don't cache explicit configs)
|
|
@@ -859,6 +820,5 @@ class Demos {
|
|
|
859
820
|
return tlsn;
|
|
860
821
|
}
|
|
861
822
|
}
|
|
862
|
-
exports.Demos = Demos;
|
|
863
823
|
Demos._instance = null;
|
|
864
824
|
//# sourceMappingURL=demosclass.js.map
|