@paimaexample/wallets 0.3.117 → 0.3.121
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/esm/concise/src/batcher.d.ts.map +1 -1
- package/esm/concise/src/batcher.js +7 -25
- package/esm/concise/src/delegate.d.ts.map +1 -1
- package/esm/concise/src/delegate.js +14 -38
- package/esm/concise/src/v2/builtins/batcher.d.ts +2 -2
- package/esm/crypto/src/CryptoManager.d.ts +24 -0
- package/esm/crypto/src/CryptoManager.d.ts.map +1 -0
- package/esm/crypto/src/CryptoManager.js +72 -0
- package/esm/crypto/src/IVerify.d.ts +7 -0
- package/esm/crypto/src/IVerify.d.ts.map +1 -0
- package/esm/crypto/src/Prando.d.ts +59 -0
- package/esm/crypto/src/Prando.d.ts.map +1 -0
- package/esm/crypto/src/Prando.js +123 -0
- package/esm/crypto/src/chains/algorand.d.ts +11 -0
- package/esm/crypto/src/chains/algorand.d.ts.map +1 -0
- package/esm/crypto/src/chains/algorand.js +86 -0
- package/esm/crypto/src/chains/cardano.d.ts +8 -0
- package/esm/crypto/src/chains/cardano.d.ts.map +1 -0
- package/esm/crypto/src/chains/cardano.js +30 -0
- package/esm/crypto/src/chains/evm.d.ts +9 -0
- package/esm/crypto/src/chains/evm.d.ts.map +1 -0
- package/esm/crypto/src/chains/evm.js +29 -0
- package/esm/crypto/src/chains/midnight.d.ts +9 -0
- package/esm/crypto/src/chains/midnight.d.ts.map +1 -0
- package/esm/crypto/src/chains/midnight.js +25 -0
- package/esm/crypto/src/chains/mina.d.ts +8 -0
- package/esm/crypto/src/chains/mina.d.ts.map +1 -0
- package/esm/crypto/src/chains/mina.js +32 -0
- package/esm/crypto/src/chains/polkadot.d.ts +9 -0
- package/esm/crypto/src/chains/polkadot.d.ts.map +1 -0
- package/esm/crypto/src/chains/polkadot.js +28 -0
- package/esm/crypto/src/mod.d.ts +5 -0
- package/esm/crypto/src/mod.d.ts.map +1 -0
- package/esm/crypto/src/mod.js +4 -0
- package/esm/crypto/src/paima-hash.d.ts +14 -0
- package/esm/crypto/src/paima-hash.d.ts.map +1 -0
- package/esm/crypto/src/paima-hash.js +13 -0
- package/esm/utils/src/types/nominal.d.ts +5 -1
- package/esm/utils/src/types/nominal.d.ts.map +1 -1
- package/esm/utils/src/types/typebox-helpers.d.ts +7 -6
- package/esm/utils/src/types/typebox-helpers.d.ts.map +1 -1
- package/esm/utils/src/types/typebox-helpers.js +8 -5
- package/esm/wallets/src/algorand/algorand.d.ts +26 -0
- package/esm/wallets/src/algorand/algorand.d.ts.map +1 -0
- package/esm/wallets/src/algorand/algorand.js +133 -0
- package/esm/wallets/src/algorand/wrapper.d.ts +6 -0
- package/esm/wallets/src/algorand/wrapper.d.ts.map +1 -0
- package/esm/wallets/src/algorand/wrapper.js +12 -0
- package/esm/wallets/src/cardano/cardano.js +1 -1
- package/esm/wallets/src/midnight/midnight.js +1 -1
- package/esm/wallets/src/mina/mina.js +1 -1
- package/esm/wallets/src/mod.d.ts +1 -0
- package/esm/wallets/src/mod.d.ts.map +1 -1
- package/esm/wallets/src/mod.js +1 -0
- package/esm/wallets/src/polkadot/polkadot.d.ts +26 -0
- package/esm/wallets/src/polkadot/polkadot.d.ts.map +1 -0
- package/esm/wallets/src/polkadot/polkadot.js +133 -0
- package/esm/wallets/src/polkadot/wrapper.d.ts +6 -0
- package/esm/wallets/src/polkadot/wrapper.d.ts.map +1 -0
- package/esm/wallets/src/polkadot/wrapper.js +19 -0
- package/esm/wallets/src/utils.d.ts +12 -4
- package/esm/wallets/src/utils.d.ts.map +1 -1
- package/esm/wallets/src/utils.js +12 -12
- package/esm/wallets/src/wallet-modes.d.ts +7 -1
- package/esm/wallets/src/wallet-modes.d.ts.map +1 -1
- package/esm/wallets/src/wallet-modes.js +26 -2
- package/esm/wallets/src/wallets.js +8 -9
- package/package.json +8 -3
- package/script/concise/src/batcher.d.ts.map +1 -1
- package/script/concise/src/batcher.js +7 -25
- package/script/concise/src/delegate.d.ts.map +1 -1
- package/script/concise/src/delegate.js +13 -37
- package/script/concise/src/v2/builtins/batcher.d.ts +2 -2
- package/script/crypto/src/CryptoManager.d.ts +24 -0
- package/script/crypto/src/CryptoManager.d.ts.map +1 -0
- package/script/crypto/src/CryptoManager.js +76 -0
- package/script/crypto/src/IVerify.d.ts +7 -0
- package/script/crypto/src/IVerify.d.ts.map +1 -0
- package/script/crypto/src/Prando.d.ts +59 -0
- package/script/crypto/src/Prando.d.ts.map +1 -0
- package/script/crypto/src/Prando.js +127 -0
- package/script/crypto/src/chains/algorand.d.ts +11 -0
- package/script/crypto/src/chains/algorand.d.ts.map +1 -0
- package/script/crypto/src/chains/algorand.js +90 -0
- package/script/crypto/src/chains/cardano.d.ts +8 -0
- package/script/crypto/src/chains/cardano.d.ts.map +1 -0
- package/script/crypto/src/chains/cardano.js +37 -0
- package/script/crypto/src/chains/evm.d.ts +9 -0
- package/script/crypto/src/chains/evm.d.ts.map +1 -0
- package/script/crypto/src/chains/evm.js +33 -0
- package/script/crypto/src/chains/midnight.d.ts +9 -0
- package/script/crypto/src/chains/midnight.d.ts.map +1 -0
- package/script/crypto/src/chains/midnight.js +29 -0
- package/script/crypto/src/chains/mina.d.ts +8 -0
- package/script/crypto/src/chains/mina.d.ts.map +1 -0
- package/script/crypto/src/chains/mina.js +39 -0
- package/script/crypto/src/chains/polkadot.d.ts +9 -0
- package/script/crypto/src/chains/polkadot.d.ts.map +1 -0
- package/script/crypto/src/chains/polkadot.js +32 -0
- package/script/crypto/src/mod.d.ts +5 -0
- package/script/crypto/src/mod.d.ts.map +1 -0
- package/script/{config → crypto}/src/mod.js +7 -2
- package/script/crypto/src/paima-hash.d.ts +14 -0
- package/script/crypto/src/paima-hash.d.ts.map +1 -0
- package/script/crypto/src/paima-hash.js +19 -0
- package/script/utils/src/types/nominal.d.ts +5 -1
- package/script/utils/src/types/nominal.d.ts.map +1 -1
- package/script/utils/src/types/typebox-helpers.d.ts +7 -6
- package/script/utils/src/types/typebox-helpers.d.ts.map +1 -1
- package/script/utils/src/types/typebox-helpers.js +8 -5
- package/script/wallets/src/algorand/algorand.d.ts +26 -0
- package/script/wallets/src/algorand/algorand.d.ts.map +1 -0
- package/script/wallets/src/algorand/algorand.js +138 -0
- package/script/wallets/src/algorand/wrapper.d.ts +6 -0
- package/script/wallets/src/algorand/wrapper.d.ts.map +1 -0
- package/script/wallets/src/algorand/wrapper.js +15 -0
- package/script/wallets/src/cardano/cardano.js +1 -1
- package/script/wallets/src/midnight/midnight.js +1 -1
- package/script/wallets/src/mina/mina.js +1 -1
- package/script/wallets/src/mod.d.ts +1 -0
- package/script/wallets/src/mod.d.ts.map +1 -1
- package/script/wallets/src/mod.js +3 -1
- package/script/wallets/src/polkadot/polkadot.d.ts +26 -0
- package/script/wallets/src/polkadot/polkadot.d.ts.map +1 -0
- package/script/wallets/src/polkadot/polkadot.js +138 -0
- package/script/wallets/src/polkadot/wrapper.d.ts +6 -0
- package/script/wallets/src/polkadot/wrapper.d.ts.map +1 -0
- package/script/wallets/src/polkadot/wrapper.js +22 -0
- package/script/wallets/src/utils.d.ts +12 -4
- package/script/wallets/src/utils.d.ts.map +1 -1
- package/script/wallets/src/utils.js +12 -12
- package/script/wallets/src/wallet-modes.d.ts +7 -1
- package/script/wallets/src/wallet-modes.d.ts.map +1 -1
- package/script/wallets/src/wallet-modes.js +26 -1
- package/script/wallets/src/wallets.js +17 -18
- package/esm/chain-types/src/hash.d.ts +0 -28
- package/esm/chain-types/src/hash.d.ts.map +0 -1
- package/esm/chain-types/src/hash.js +0 -29
- package/esm/chain-types/src/mod.d.ts +0 -3
- package/esm/chain-types/src/mod.d.ts.map +0 -1
- package/esm/chain-types/src/mod.js +0 -2
- package/esm/chain-types/src/types.d.ts +0 -70
- package/esm/chain-types/src/types.d.ts.map +0 -1
- package/esm/config/src/config/builder.d.ts +0 -33
- package/esm/config/src/config/builder.d.ts.map +0 -1
- package/esm/config/src/config/builder.js +0 -82
- package/esm/config/src/config/configCheck.d.ts +0 -32
- package/esm/config/src/config/configCheck.d.ts.map +0 -1
- package/esm/config/src/config/configCheck.js +0 -67
- package/esm/config/src/config/context.d.ts +0 -23
- package/esm/config/src/config/context.d.ts.map +0 -1
- package/esm/config/src/config/context.js +0 -25
- package/esm/config/src/config/mod.d.ts +0 -7
- package/esm/config/src/config/mod.d.ts.map +0 -1
- package/esm/config/src/config/mod.js +0 -4
- package/esm/config/src/config/parts/deployedAddresses.d.ts +0 -17
- package/esm/config/src/config/parts/deployedAddresses.d.ts.map +0 -1
- package/esm/config/src/config/parts/deployedAddresses.js +0 -24
- package/esm/config/src/config/parts/network.d.ts +0 -19
- package/esm/config/src/config/parts/network.d.ts.map +0 -1
- package/esm/config/src/config/parts/network.js +0 -29
- package/esm/config/src/config/parts/primitive.d.ts +0 -31
- package/esm/config/src/config/parts/primitive.d.ts.map +0 -1
- package/esm/config/src/config/parts/primitive.js +0 -28
- package/esm/config/src/config/parts/securityNamespace.d.ts +0 -14
- package/esm/config/src/config/parts/securityNamespace.d.ts.map +0 -1
- package/esm/config/src/config/parts/securityNamespace.js +0 -26
- package/esm/config/src/config/parts/syncProtocols.d.ts +0 -43
- package/esm/config/src/config/parts/syncProtocols.d.ts.map +0 -1
- package/esm/config/src/config/parts/syncProtocols.js +0 -66
- package/esm/config/src/config/utils.d.ts +0 -40
- package/esm/config/src/config/utils.d.ts.map +0 -1
- package/esm/config/src/config/utils.js +0 -55
- package/esm/config/src/mod.d.ts +0 -3
- package/esm/config/src/mod.d.ts.map +0 -1
- package/esm/config/src/mod.js +0 -2
- package/esm/config/src/schema/common.d.ts +0 -26
- package/esm/config/src/schema/common.d.ts.map +0 -1
- package/esm/config/src/schema/common.js +0 -51
- package/esm/config/src/schema/mod.d.ts +0 -7
- package/esm/config/src/schema/mod.d.ts.map +0 -1
- package/esm/config/src/schema/mod.js +0 -6
- package/esm/config/src/schema/namespace.d.ts +0 -39
- package/esm/config/src/schema/namespace.d.ts.map +0 -1
- package/esm/config/src/schema/namespace.js +0 -34
- package/esm/config/src/schema/network/algorand.d.ts +0 -12
- package/esm/config/src/schema/network/algorand.d.ts.map +0 -1
- package/esm/config/src/schema/network/algorand.js +0 -23
- package/esm/config/src/schema/network/all.d.ts +0 -175
- package/esm/config/src/schema/network/all.d.ts.map +0 -1
- package/esm/config/src/schema/network/all.js +0 -24
- package/esm/config/src/schema/network/bitcoin.d.ts +0 -19
- package/esm/config/src/schema/network/bitcoin.d.ts.map +0 -1
- package/esm/config/src/schema/network/bitcoin.js +0 -21
- package/esm/config/src/schema/network/cardano.d.ts +0 -12
- package/esm/config/src/schema/network/cardano.d.ts.map +0 -1
- package/esm/config/src/schema/network/cardano.js +0 -27
- package/esm/config/src/schema/network/evm.d.ts +0 -68
- package/esm/config/src/schema/network/evm.d.ts.map +0 -1
- package/esm/config/src/schema/network/evm.js +0 -70
- package/esm/config/src/schema/network/mina.d.ts +0 -14
- package/esm/config/src/schema/network/mina.d.ts.map +0 -1
- package/esm/config/src/schema/network/mina.js +0 -25
- package/esm/config/src/schema/network/mod.d.ts +0 -9
- package/esm/config/src/schema/network/mod.d.ts.map +0 -1
- package/esm/config/src/schema/network/mod.js +0 -8
- package/esm/config/src/schema/network/ntp.d.ts +0 -32
- package/esm/config/src/schema/network/ntp.d.ts.map +0 -1
- package/esm/config/src/schema/network/ntp.js +0 -39
- package/esm/config/src/schema/network/substrate/avail.d.ts +0 -14
- package/esm/config/src/schema/network/substrate/avail.d.ts.map +0 -1
- package/esm/config/src/schema/network/substrate/avail.js +0 -26
- package/esm/config/src/schema/network/substrate/common.d.ts +0 -18
- package/esm/config/src/schema/network/substrate/common.d.ts.map +0 -1
- package/esm/config/src/schema/network/substrate/common.js +0 -32
- package/esm/config/src/schema/network/substrate/midnight.d.ts +0 -20
- package/esm/config/src/schema/network/substrate/midnight.d.ts.map +0 -1
- package/esm/config/src/schema/network/substrate/midnight.js +0 -32
- package/esm/config/src/schema/network/substrate/mod.d.ts +0 -4
- package/esm/config/src/schema/network/substrate/mod.d.ts.map +0 -1
- package/esm/config/src/schema/network/substrate/mod.js +0 -3
- package/esm/config/src/schema/network/types.d.ts +0 -13
- package/esm/config/src/schema/network/types.d.ts.map +0 -1
- package/esm/config/src/schema/network/types.js +0 -13
- package/esm/config/src/schema/network/utils.d.ts +0 -5
- package/esm/config/src/schema/network/utils.d.ts.map +0 -1
- package/esm/config/src/schema/network/utils.js +0 -73
- package/esm/config/src/schema/primitive/mod.d.ts +0 -2
- package/esm/config/src/schema/primitive/mod.d.ts.map +0 -1
- package/esm/config/src/schema/primitive/mod.js +0 -1
- package/esm/config/src/schema/primitive/types.d.ts +0 -58
- package/esm/config/src/schema/primitive/types.d.ts.map +0 -1
- package/esm/config/src/schema/primitive/types.js +0 -1
- package/esm/config/src/schema/sync-protocols/all.d.ts +0 -583
- package/esm/config/src/schema/sync-protocols/all.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/all.js +0 -55
- package/esm/config/src/schema/sync-protocols/avail/rpc.d.ts +0 -76
- package/esm/config/src/schema/sync-protocols/avail/rpc.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/avail/rpc.js +0 -56
- package/esm/config/src/schema/sync-protocols/bitcoin/rpc.d.ts +0 -76
- package/esm/config/src/schema/sync-protocols/bitcoin/rpc.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/bitcoin/rpc.js +0 -47
- package/esm/config/src/schema/sync-protocols/cardano/carp.d.ts +0 -80
- package/esm/config/src/schema/sync-protocols/cardano/carp.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/cardano/carp.js +0 -62
- package/esm/config/src/schema/sync-protocols/cardano/mod.d.ts +0 -2
- package/esm/config/src/schema/sync-protocols/cardano/mod.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/cardano/mod.js +0 -1
- package/esm/config/src/schema/sync-protocols/cardano/utxorpc.d.ts +0 -56
- package/esm/config/src/schema/sync-protocols/cardano/utxorpc.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/cardano/utxorpc.js +0 -56
- package/esm/config/src/schema/sync-protocols/common.d.ts +0 -60
- package/esm/config/src/schema/sync-protocols/common.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/common.js +0 -54
- package/esm/config/src/schema/sync-protocols/decorators/all.d.ts +0 -17
- package/esm/config/src/schema/sync-protocols/decorators/all.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/decorators/all.js +0 -8
- package/esm/config/src/schema/sync-protocols/decorators/emulated.d.ts +0 -8
- package/esm/config/src/schema/sync-protocols/decorators/emulated.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/decorators/emulated.js +0 -12
- package/esm/config/src/schema/sync-protocols/decorators/mod.d.ts +0 -4
- package/esm/config/src/schema/sync-protocols/decorators/mod.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/decorators/mod.js +0 -3
- package/esm/config/src/schema/sync-protocols/decorators/types.d.ts +0 -4
- package/esm/config/src/schema/sync-protocols/decorators/types.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/decorators/types.js +0 -4
- package/esm/config/src/schema/sync-protocols/evm/rpc.d.ts +0 -68
- package/esm/config/src/schema/sync-protocols/evm/rpc.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/evm/rpc.js +0 -44
- package/esm/config/src/schema/sync-protocols/midnight/graphql.d.ts +0 -66
- package/esm/config/src/schema/sync-protocols/midnight/graphql.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/midnight/graphql.js +0 -50
- package/esm/config/src/schema/sync-protocols/mina/graphql.d.ts +0 -73
- package/esm/config/src/schema/sync-protocols/mina/graphql.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/mina/graphql.js +0 -59
- package/esm/config/src/schema/sync-protocols/mod.d.ts +0 -10
- package/esm/config/src/schema/sync-protocols/mod.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/mod.js +0 -9
- package/esm/config/src/schema/sync-protocols/ntp/rpc.d.ts +0 -45
- package/esm/config/src/schema/sync-protocols/ntp/rpc.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/ntp/rpc.js +0 -33
- package/esm/config/src/schema/sync-protocols/types.d.ts +0 -125
- package/esm/config/src/schema/sync-protocols/types.d.ts.map +0 -1
- package/esm/config/src/schema/sync-protocols/types.js +0 -22
- package/esm/config/src/schema/utils.d.ts +0 -53
- package/esm/config/src/schema/utils.d.ts.map +0 -1
- package/esm/config/src/schema/utils.js +0 -58
- package/script/chain-types/src/hash.d.ts +0 -28
- package/script/chain-types/src/hash.d.ts.map +0 -1
- package/script/chain-types/src/hash.js +0 -36
- package/script/chain-types/src/mod.d.ts +0 -3
- package/script/chain-types/src/mod.d.ts.map +0 -1
- package/script/chain-types/src/mod.js +0 -18
- package/script/chain-types/src/types.d.ts +0 -70
- package/script/chain-types/src/types.d.ts.map +0 -1
- package/script/config/src/config/builder.d.ts +0 -33
- package/script/config/src/config/builder.d.ts.map +0 -1
- package/script/config/src/config/builder.js +0 -86
- package/script/config/src/config/configCheck.d.ts +0 -32
- package/script/config/src/config/configCheck.d.ts.map +0 -1
- package/script/config/src/config/configCheck.js +0 -70
- package/script/config/src/config/context.d.ts +0 -23
- package/script/config/src/config/context.d.ts.map +0 -1
- package/script/config/src/config/context.js +0 -31
- package/script/config/src/config/mod.d.ts +0 -7
- package/script/config/src/config/mod.d.ts.map +0 -1
- package/script/config/src/config/mod.js +0 -22
- package/script/config/src/config/parts/deployedAddresses.d.ts +0 -17
- package/script/config/src/config/parts/deployedAddresses.d.ts.map +0 -1
- package/script/config/src/config/parts/deployedAddresses.js +0 -28
- package/script/config/src/config/parts/network.d.ts +0 -19
- package/script/config/src/config/parts/network.d.ts.map +0 -1
- package/script/config/src/config/parts/network.js +0 -33
- package/script/config/src/config/parts/primitive.d.ts +0 -31
- package/script/config/src/config/parts/primitive.d.ts.map +0 -1
- package/script/config/src/config/parts/primitive.js +0 -32
- package/script/config/src/config/parts/securityNamespace.d.ts +0 -14
- package/script/config/src/config/parts/securityNamespace.d.ts.map +0 -1
- package/script/config/src/config/parts/securityNamespace.js +0 -30
- package/script/config/src/config/parts/syncProtocols.d.ts +0 -43
- package/script/config/src/config/parts/syncProtocols.d.ts.map +0 -1
- package/script/config/src/config/parts/syncProtocols.js +0 -70
- package/script/config/src/config/utils.d.ts +0 -40
- package/script/config/src/config/utils.d.ts.map +0 -1
- package/script/config/src/config/utils.js +0 -62
- package/script/config/src/mod.d.ts +0 -3
- package/script/config/src/mod.d.ts.map +0 -1
- package/script/config/src/schema/common.d.ts +0 -26
- package/script/config/src/schema/common.d.ts.map +0 -1
- package/script/config/src/schema/common.js +0 -54
- package/script/config/src/schema/mod.d.ts +0 -7
- package/script/config/src/schema/mod.d.ts.map +0 -1
- package/script/config/src/schema/mod.js +0 -22
- package/script/config/src/schema/namespace.d.ts +0 -39
- package/script/config/src/schema/namespace.d.ts.map +0 -1
- package/script/config/src/schema/namespace.js +0 -38
- package/script/config/src/schema/network/algorand.d.ts +0 -12
- package/script/config/src/schema/network/algorand.d.ts.map +0 -1
- package/script/config/src/schema/network/algorand.js +0 -26
- package/script/config/src/schema/network/all.d.ts +0 -175
- package/script/config/src/schema/network/all.d.ts.map +0 -1
- package/script/config/src/schema/network/all.js +0 -28
- package/script/config/src/schema/network/bitcoin.d.ts +0 -19
- package/script/config/src/schema/network/bitcoin.d.ts.map +0 -1
- package/script/config/src/schema/network/bitcoin.js +0 -24
- package/script/config/src/schema/network/cardano.d.ts +0 -12
- package/script/config/src/schema/network/cardano.d.ts.map +0 -1
- package/script/config/src/schema/network/cardano.js +0 -30
- package/script/config/src/schema/network/evm.d.ts +0 -68
- package/script/config/src/schema/network/evm.d.ts.map +0 -1
- package/script/config/src/schema/network/evm.js +0 -75
- package/script/config/src/schema/network/mina.d.ts +0 -14
- package/script/config/src/schema/network/mina.d.ts.map +0 -1
- package/script/config/src/schema/network/mina.js +0 -28
- package/script/config/src/schema/network/mod.d.ts +0 -9
- package/script/config/src/schema/network/mod.d.ts.map +0 -1
- package/script/config/src/schema/network/mod.js +0 -24
- package/script/config/src/schema/network/ntp.d.ts +0 -32
- package/script/config/src/schema/network/ntp.d.ts.map +0 -1
- package/script/config/src/schema/network/ntp.js +0 -42
- package/script/config/src/schema/network/substrate/avail.d.ts +0 -14
- package/script/config/src/schema/network/substrate/avail.d.ts.map +0 -1
- package/script/config/src/schema/network/substrate/avail.js +0 -29
- package/script/config/src/schema/network/substrate/common.d.ts +0 -18
- package/script/config/src/schema/network/substrate/common.d.ts.map +0 -1
- package/script/config/src/schema/network/substrate/common.js +0 -35
- package/script/config/src/schema/network/substrate/midnight.d.ts +0 -20
- package/script/config/src/schema/network/substrate/midnight.d.ts.map +0 -1
- package/script/config/src/schema/network/substrate/midnight.js +0 -35
- package/script/config/src/schema/network/substrate/mod.d.ts +0 -4
- package/script/config/src/schema/network/substrate/mod.d.ts.map +0 -1
- package/script/config/src/schema/network/substrate/mod.js +0 -19
- package/script/config/src/schema/network/types.d.ts +0 -13
- package/script/config/src/schema/network/types.d.ts.map +0 -1
- package/script/config/src/schema/network/types.js +0 -16
- package/script/config/src/schema/network/utils.d.ts +0 -5
- package/script/config/src/schema/network/utils.d.ts.map +0 -1
- package/script/config/src/schema/network/utils.js +0 -76
- package/script/config/src/schema/primitive/mod.d.ts +0 -2
- package/script/config/src/schema/primitive/mod.d.ts.map +0 -1
- package/script/config/src/schema/primitive/mod.js +0 -17
- package/script/config/src/schema/primitive/types.d.ts +0 -58
- package/script/config/src/schema/primitive/types.d.ts.map +0 -1
- package/script/config/src/schema/primitive/types.js +0 -2
- package/script/config/src/schema/sync-protocols/all.d.ts +0 -583
- package/script/config/src/schema/sync-protocols/all.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/all.js +0 -62
- package/script/config/src/schema/sync-protocols/avail/rpc.d.ts +0 -76
- package/script/config/src/schema/sync-protocols/avail/rpc.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/avail/rpc.js +0 -59
- package/script/config/src/schema/sync-protocols/bitcoin/rpc.d.ts +0 -76
- package/script/config/src/schema/sync-protocols/bitcoin/rpc.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/bitcoin/rpc.js +0 -50
- package/script/config/src/schema/sync-protocols/cardano/carp.d.ts +0 -80
- package/script/config/src/schema/sync-protocols/cardano/carp.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/cardano/carp.js +0 -65
- package/script/config/src/schema/sync-protocols/cardano/mod.d.ts +0 -2
- package/script/config/src/schema/sync-protocols/cardano/mod.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/cardano/mod.js +0 -17
- package/script/config/src/schema/sync-protocols/cardano/utxorpc.d.ts +0 -56
- package/script/config/src/schema/sync-protocols/cardano/utxorpc.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/cardano/utxorpc.js +0 -59
- package/script/config/src/schema/sync-protocols/common.d.ts +0 -60
- package/script/config/src/schema/sync-protocols/common.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/common.js +0 -61
- package/script/config/src/schema/sync-protocols/decorators/all.d.ts +0 -17
- package/script/config/src/schema/sync-protocols/decorators/all.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/decorators/all.js +0 -12
- package/script/config/src/schema/sync-protocols/decorators/emulated.d.ts +0 -8
- package/script/config/src/schema/sync-protocols/decorators/emulated.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/decorators/emulated.js +0 -15
- package/script/config/src/schema/sync-protocols/decorators/mod.d.ts +0 -4
- package/script/config/src/schema/sync-protocols/decorators/mod.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/decorators/mod.js +0 -19
- package/script/config/src/schema/sync-protocols/decorators/types.d.ts +0 -4
- package/script/config/src/schema/sync-protocols/decorators/types.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/decorators/types.js +0 -7
- package/script/config/src/schema/sync-protocols/evm/rpc.d.ts +0 -68
- package/script/config/src/schema/sync-protocols/evm/rpc.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/evm/rpc.js +0 -47
- package/script/config/src/schema/sync-protocols/midnight/graphql.d.ts +0 -66
- package/script/config/src/schema/sync-protocols/midnight/graphql.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/midnight/graphql.js +0 -53
- package/script/config/src/schema/sync-protocols/mina/graphql.d.ts +0 -73
- package/script/config/src/schema/sync-protocols/mina/graphql.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/mina/graphql.js +0 -62
- package/script/config/src/schema/sync-protocols/mod.d.ts +0 -10
- package/script/config/src/schema/sync-protocols/mod.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/mod.js +0 -25
- package/script/config/src/schema/sync-protocols/ntp/rpc.d.ts +0 -45
- package/script/config/src/schema/sync-protocols/ntp/rpc.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/ntp/rpc.js +0 -36
- package/script/config/src/schema/sync-protocols/types.d.ts +0 -125
- package/script/config/src/schema/sync-protocols/types.d.ts.map +0 -1
- package/script/config/src/schema/sync-protocols/types.js +0 -25
- package/script/config/src/schema/utils.d.ts +0 -53
- package/script/config/src/schema/utils.d.ts.map +0 -1
- package/script/config/src/schema/utils.js +0 -62
- /package/esm/{chain-types/src/types.js → crypto/src/IVerify.js} +0 -0
- /package/script/{chain-types/src/types.js → crypto/src/IVerify.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../src/concise/src/batcher.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,SAAS,EACd,KAAK,cAAc,EAEnB,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAmBhC,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAEjD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,wBAAgB,oBAAoB,CAClC,oBAAoB,EAAE,cAAc,EACpC,cAAc,EAAE,aAAa,EAC7B,iBAAiB,EAAE,WAAW,EAC9B,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,MAAM,GAChB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../src/concise/src/batcher.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,SAAS,EACd,KAAK,cAAc,EAEnB,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAmBhC,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAEjD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,wBAAgB,oBAAoB,CAClC,oBAAoB,EAAE,cAAc,EACpC,cAAc,EAAE,aAAa,EAC7B,iBAAiB,EAAE,WAAW,EAC9B,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,MAAM,GAChB,mBAAmB,CAYrB;AAED,wDAAwD;AACxD,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,oBAAoB,EAAE,cAAc,EACpC,cAAc,EAAE,aAAa,EAC7B,iBAAiB,EAAE,WAAW,EAC9B,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,MAAM,GAAG,SAAqB,GACrC,cAAc,CAQhB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAOnE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,mBAAmB,EAAE,GAC5B;IACD,cAAc,EAAE,mBAAmB,EAAE,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;CACd,CAyCA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AACF,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,qBAAqB,EAAE,CA8BzE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CryptoManager } from "../../crypto/src/mod.js";
|
|
2
2
|
import { BatcherGrammar, BatcherGrammarPrefix, BatcherInnerGrammar,
|
|
3
3
|
// BuiltinGrammar,
|
|
4
4
|
// BuiltinGrammarPrefix,
|
|
@@ -6,17 +6,11 @@ generateStmInput, KeyedBatcherGrammar, KeyedBuiltinBatcherInnerGrammar,
|
|
|
6
6
|
// KeyedBuiltinGrammar,
|
|
7
7
|
parseRawStmInput, parseStmInput, } from "./v2/mod.js";
|
|
8
8
|
import sha3 from "js-sha3";
|
|
9
|
-
import { Value } from "@sinclair/typebox/value";
|
|
10
9
|
const { keccak_256 } = sha3;
|
|
11
10
|
export function createBatcherSubunit(millisecondTimestamp, _walletAddress, walletAddressType, signature, inputData) {
|
|
12
11
|
let walletAddress;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
walletAddress = Value.Decode(TypeboxHelpers.Evm.Address, _walletAddress);
|
|
16
|
-
break;
|
|
17
|
-
default:
|
|
18
|
-
throw new Error("NYI: Unsupported wallet address type: " + walletAddressType);
|
|
19
|
-
}
|
|
12
|
+
const cryptoManager = CryptoManager.getCryptoManager(walletAddressType);
|
|
13
|
+
walletAddress = cryptoManager.decodeAddress(_walletAddress);
|
|
20
14
|
return {
|
|
21
15
|
addressType: walletAddressType,
|
|
22
16
|
address: walletAddress,
|
|
@@ -27,14 +21,8 @@ export function createBatcherSubunit(millisecondTimestamp, _walletAddress, walle
|
|
|
27
21
|
}
|
|
28
22
|
/** This is what wallets sign when submitting a batch */
|
|
29
23
|
export function createMessageForBatcher(namespace, millisecondTimestamp, _walletAddress, walletAddressType, inputData, target = undefined) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
case AddressType.EVM:
|
|
33
|
-
walletAddress = Value.Decode(TypeboxHelpers.Evm.Address, _walletAddress);
|
|
34
|
-
break;
|
|
35
|
-
default:
|
|
36
|
-
throw new Error("NYI: Unsupported wallet address type: " + walletAddressType);
|
|
37
|
-
}
|
|
24
|
+
const cryptoManager = CryptoManager.getCryptoManager(walletAddressType);
|
|
25
|
+
const walletAddress = cryptoManager.decodeAddress(_walletAddress);
|
|
38
26
|
return ((namespace ?? "") + (target ?? "") + millisecondTimestamp +
|
|
39
27
|
walletAddress + inputData)
|
|
40
28
|
.replace(/[^a-zA-Z0-9]/g, "-")
|
|
@@ -48,14 +36,8 @@ export function createMessageForBatcher(namespace, millisecondTimestamp, _wallet
|
|
|
48
36
|
* So it contains the address indirectly
|
|
49
37
|
*/
|
|
50
38
|
export function hashBatchSubunit(input) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
case AddressType.EVM:
|
|
54
|
-
walletAddress = Value.Decode(TypeboxHelpers.Evm.Address, input.address);
|
|
55
|
-
break;
|
|
56
|
-
default:
|
|
57
|
-
throw new Error("NYI: Unsupported wallet address type: " + input.addressType);
|
|
58
|
-
}
|
|
39
|
+
const cryptoManager = CryptoManager.getCryptoManager(input.addressType);
|
|
40
|
+
const walletAddress = cryptoManager.decodeAddress(input.address);
|
|
59
41
|
return "0x" +
|
|
60
42
|
keccak_256(walletAddress + input.input + input.timestamp);
|
|
61
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate.d.ts","sourceRoot":"","sources":["../../../src/concise/src/delegate.ts"],"names":[],"mappings":"AAQA,OAAO,EACP,WAAW,EAGT,KAAK,UAAU,EAEf,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"delegate.d.ts","sourceRoot":"","sources":["../../../src/concise/src/delegate.ts"],"names":[],"mappings":"AAQA,OAAO,EACP,WAAW,EAGT,KAAK,UAAU,EAEf,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAIhC,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM;;;;yDAYtD;AAED,eAAO,MAAM,eAAe;8BAEZ,MAAM,iBACH,aAAa,kBACZ,OAAO;2CAOX,MAAM,iBACH,aAAa,gBACd,aAAa,GAAG,IAAI;CAIrC,CAAC;AAWF,eAAO,MAAM,WAAW,GACtB,SAAS,MAAM,EACf,YAAY,UAAU,2BAcvB,CAAC;AAEF,eAAO,MAAM,cAAc;yBACA,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC;4CAKxB,UAAU,6BACT,WAAW,wBAChB,UAAU,yBACT,WAAW,mBACjB,aAAa,eACjB,aAAa,aACf,MAAM,gBACH,OAAO,KACpB,OAAO,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;4BAoCxE,MAAM,KAChB,OAAO,CAAC,CAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;8CAc1D,UAAU,6BACT,WAAW,aAC3B,MAAM,kBACD,aAAa,qBACV,WAAW,eACjB,aAAa,GAAG,IAAI,kBACjB,WAAW,GAAG,IAAI,KACjC,OAAO,CAAC,CAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CA4BvF,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { BuiltinGrammar, BuiltinGrammarPrefix, KeyedBuiltinGrammar, parseStmInput, } from "./mod.js";
|
|
2
2
|
import { privateKeyToAccount } from "viem/accounts";
|
|
3
3
|
import { createWalletClient, http } from "viem";
|
|
4
|
-
import {
|
|
4
|
+
import { TypeboxHelpers, } from "../../utils/src/mod.js";
|
|
5
5
|
import { Value } from "@sinclair/typebox/value";
|
|
6
|
+
import { CryptoManager } from "../../crypto/src/mod.js";
|
|
6
7
|
export function extractDelegateWallet(inputData) {
|
|
7
8
|
const parsed = parseStmInput(inputData, BuiltinGrammar, KeyedBuiltinGrammar);
|
|
8
9
|
return parsed;
|
|
@@ -40,23 +41,10 @@ export const accountPayload = {
|
|
|
40
41
|
},
|
|
41
42
|
// TODO This should use the Wallet connector to sign the message
|
|
42
43
|
linkAddress: async (primaryAccountPrivateKey, primaryAccountAddressType, newAccountPrivateKey, newAccountAddressType, _primaryAddress, _newAddress, accountId, isNewPrimary) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
primaryAddress = Value.Decode(TypeboxHelpers.Evm.Address, _primaryAddress);
|
|
48
|
-
break;
|
|
49
|
-
default:
|
|
50
|
-
throw new Error("NYI: Primary account address type is not EVM");
|
|
51
|
-
}
|
|
52
|
-
let newAddress;
|
|
53
|
-
switch (newAccountAddressType) {
|
|
54
|
-
case AddressType.EVM:
|
|
55
|
-
newAddress = Value.Decode(TypeboxHelpers.Evm.Address, _newAddress);
|
|
56
|
-
break;
|
|
57
|
-
default:
|
|
58
|
-
throw new Error("NYI: New account address type is not EVM");
|
|
59
|
-
}
|
|
44
|
+
const primaryCryptoManager = CryptoManager.getCryptoManager(primaryAccountAddressType);
|
|
45
|
+
const primaryAddress = primaryCryptoManager.decodeAddress(_primaryAddress);
|
|
46
|
+
const newCryptoManager = CryptoManager.getCryptoManager(newAccountAddressType);
|
|
47
|
+
const newAddress = newCryptoManager.decodeAddress(_newAddress);
|
|
60
48
|
const signatureFromPrimary = await signMessage(accountMessages.linkAccount(accountId, newAddress, isNewPrimary), primaryAccountPrivateKey);
|
|
61
49
|
const signatureFromNewAddress = await signMessage(accountMessages.linkAccount(accountId, primaryAddress, isNewPrimary), newAccountPrivateKey);
|
|
62
50
|
return [
|
|
@@ -84,26 +72,14 @@ export const accountPayload = {
|
|
|
84
72
|
},
|
|
85
73
|
// TODO This should use the Wallet connector to sign the message
|
|
86
74
|
unlinkAddress: async (primaryAccountPrivateKey, primaryAccountAddressType, accountId, _targetAddress, targetAddressType, _newPrimary, newPrimaryType) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
default:
|
|
94
|
-
throw new Error("NYI: Target address type is not EVM");
|
|
95
|
-
}
|
|
96
|
-
let newPrimary = null;
|
|
97
|
-
if (_newPrimary) {
|
|
98
|
-
switch (newPrimaryType) {
|
|
99
|
-
case AddressType.EVM:
|
|
100
|
-
newPrimary = Value.Decode(TypeboxHelpers.Evm.Address, _newPrimary);
|
|
101
|
-
break;
|
|
102
|
-
default:
|
|
103
|
-
throw new Error("NYI: New primary address type is not EVM");
|
|
104
|
-
}
|
|
75
|
+
const targetCryptoManager = CryptoManager.getCryptoManager(targetAddressType);
|
|
76
|
+
const targetAddress = targetCryptoManager.decodeAddress(_targetAddress);
|
|
77
|
+
let newPrimaryAddress = null;
|
|
78
|
+
if (_newPrimary && newPrimaryType !== null) {
|
|
79
|
+
const newPrimaryCryptoManager = CryptoManager.getCryptoManager(newPrimaryType);
|
|
80
|
+
newPrimaryAddress = newPrimaryCryptoManager.decodeAddress(_newPrimary);
|
|
105
81
|
}
|
|
106
|
-
const signatureFromPrimary = await signMessage(accountMessages.unlinkAccountWithPrimary(accountId, targetAddress,
|
|
82
|
+
const signatureFromPrimary = await signMessage(accountMessages.unlinkAccountWithPrimary(accountId, targetAddress, newPrimaryAddress), primaryAccountPrivateKey);
|
|
107
83
|
return [
|
|
108
84
|
BuiltinGrammarPrefix.unlinkAddress,
|
|
109
85
|
accountId,
|
|
@@ -111,7 +87,7 @@ export const accountPayload = {
|
|
|
111
87
|
primaryAccountAddressType,
|
|
112
88
|
targetAddress,
|
|
113
89
|
targetAddressType,
|
|
114
|
-
|
|
90
|
+
newPrimaryAddress ?? "",
|
|
115
91
|
newPrimaryType ?? -1,
|
|
116
92
|
];
|
|
117
93
|
},
|
|
@@ -11,7 +11,7 @@ export declare const BatcherInnerGrammar: {
|
|
|
11
11
|
readonly "3": readonly [["userAddress", import("@sinclair/typebox").TUnsafe<import("../../../../utils/src/mod.js").AlgorandAddress>], readonly ["userSignature", import("@sinclair/typebox").TString], readonly ["conciseInput", import("@sinclair/typebox").TString], readonly ["millisecondTimestamp", import("@sinclair/typebox").TString]];
|
|
12
12
|
readonly "4": readonly [["userAddress", import("@sinclair/typebox").TUnsafe<import("../../../../utils/src/mod.js").MinaAddress>], readonly ["userSignature", import("@sinclair/typebox").TString], readonly ["conciseInput", import("@sinclair/typebox").TString], readonly ["millisecondTimestamp", import("@sinclair/typebox").TString]];
|
|
13
13
|
readonly "5": readonly [["userAddress", import("@sinclair/typebox").TUnsafe<import("../../../../utils/src/mod.js").MidnightAddress>], readonly ["userSignature", import("@sinclair/typebox").TString], readonly ["conciseInput", import("@sinclair/typebox").TString], readonly ["millisecondTimestamp", import("@sinclair/typebox").TString]];
|
|
14
|
-
readonly "7": readonly [["userAddress", import("@sinclair/typebox").TUnsafe<import("../../../../utils/src/mod.js").
|
|
14
|
+
readonly "7": readonly [["userAddress", import("@sinclair/typebox").TUnsafe<import("../../../../utils/src/mod.js").SubstrateAddress>], readonly ["userSignature", import("@sinclair/typebox").TString], readonly ["conciseInput", import("@sinclair/typebox").TString], readonly ["millisecondTimestamp", import("@sinclair/typebox").TString]];
|
|
15
15
|
};
|
|
16
16
|
export declare const KeyedBuiltinBatcherInnerGrammar: import("../types.js").CommandTuples<{
|
|
17
17
|
readonly "-1": readonly [["userAddress", import("@sinclair/typebox").TLiteral<"0x0">], readonly ["userSignature", import("@sinclair/typebox").TString], readonly ["conciseInput", import("@sinclair/typebox").TString], readonly ["millisecondTimestamp", import("@sinclair/typebox").TString]];
|
|
@@ -22,6 +22,6 @@ export declare const KeyedBuiltinBatcherInnerGrammar: import("../types.js").Comm
|
|
|
22
22
|
readonly "3": readonly [["userAddress", import("@sinclair/typebox").TUnsafe<import("../../../../utils/src/mod.js").AlgorandAddress>], readonly ["userSignature", import("@sinclair/typebox").TString], readonly ["conciseInput", import("@sinclair/typebox").TString], readonly ["millisecondTimestamp", import("@sinclair/typebox").TString]];
|
|
23
23
|
readonly "4": readonly [["userAddress", import("@sinclair/typebox").TUnsafe<import("../../../../utils/src/mod.js").MinaAddress>], readonly ["userSignature", import("@sinclair/typebox").TString], readonly ["conciseInput", import("@sinclair/typebox").TString], readonly ["millisecondTimestamp", import("@sinclair/typebox").TString]];
|
|
24
24
|
readonly "5": readonly [["userAddress", import("@sinclair/typebox").TUnsafe<import("../../../../utils/src/mod.js").MidnightAddress>], readonly ["userSignature", import("@sinclair/typebox").TString], readonly ["conciseInput", import("@sinclair/typebox").TString], readonly ["millisecondTimestamp", import("@sinclair/typebox").TString]];
|
|
25
|
-
readonly "7": readonly [["userAddress", import("@sinclair/typebox").TUnsafe<import("../../../../utils/src/mod.js").
|
|
25
|
+
readonly "7": readonly [["userAddress", import("@sinclair/typebox").TUnsafe<import("../../../../utils/src/mod.js").SubstrateAddress>], readonly ["userSignature", import("@sinclair/typebox").TString], readonly ["conciseInput", import("@sinclair/typebox").TString], readonly ["millisecondTimestamp", import("@sinclair/typebox").TString]];
|
|
26
26
|
}>;
|
|
27
27
|
//# sourceMappingURL=batcher.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AlgorandCrypto } from "./chains/algorand.js";
|
|
2
|
+
import { CardanoCrypto } from "./chains/cardano.js";
|
|
3
|
+
import { EvmCrypto } from "./chains/evm.js";
|
|
4
|
+
import { PolkadotCrypto } from "./chains/polkadot.js";
|
|
5
|
+
import { MinaCrypto } from "./chains/mina.js";
|
|
6
|
+
import { MidnightCrypto } from "./chains/midnight.js";
|
|
7
|
+
import { AddressType } from "../../utils/src/mod.js";
|
|
8
|
+
import { IVerify } from "./IVerify.js";
|
|
9
|
+
export declare class CryptoManager {
|
|
10
|
+
private static algorand;
|
|
11
|
+
private static cardano;
|
|
12
|
+
private static evm;
|
|
13
|
+
private static polkadot;
|
|
14
|
+
private static mina;
|
|
15
|
+
private static midnight;
|
|
16
|
+
static Algorand(): AlgorandCrypto;
|
|
17
|
+
static Cardano(): CardanoCrypto;
|
|
18
|
+
static Evm(): EvmCrypto;
|
|
19
|
+
static Polkadot(): PolkadotCrypto;
|
|
20
|
+
static Mina(): MinaCrypto;
|
|
21
|
+
static Midnight(): MidnightCrypto;
|
|
22
|
+
static getCryptoManager(addressType: AddressType): IVerify;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=CryptoManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CryptoManager.d.ts","sourceRoot":"","sources":["../../../src/crypto/src/CryptoManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,qBAAa,aAAa;IAKxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA6B;IACpD,OAAO,CAAC,MAAM,CAAC,OAAO,CAA4B;IAClD,OAAO,CAAC,MAAM,CAAC,GAAG,CAAwB;IAC1C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA6B;IACpD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAyB;IAC5C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA6B;IAEpD,MAAM,CAAC,QAAQ,IAAI,cAAc;IAOjC,MAAM,CAAC,OAAO,IAAI,aAAa;IAO/B,MAAM,CAAC,GAAG,IAAI,SAAS;IAOvB,MAAM,CAAC,QAAQ,IAAI,cAAc;IAOjC,MAAM,CAAC,IAAI,IAAI,UAAU;IAOzB,MAAM,CAAC,QAAQ,IAAI,cAAc;WAOnB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO;CAkBlE"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { AlgorandCrypto } from "./chains/algorand.js";
|
|
2
|
+
import { CardanoCrypto } from "./chains/cardano.js";
|
|
3
|
+
import { EvmCrypto } from "./chains/evm.js";
|
|
4
|
+
import { PolkadotCrypto } from "./chains/polkadot.js";
|
|
5
|
+
import { MinaCrypto } from "./chains/mina.js";
|
|
6
|
+
import { MidnightCrypto } from "./chains/midnight.js";
|
|
7
|
+
import { AddressType } from "../../utils/src/mod.js";
|
|
8
|
+
export class CryptoManager {
|
|
9
|
+
// TODO:
|
|
10
|
+
// careful: packages in these classes should be dynamically imported
|
|
11
|
+
// so that we don't have to import a bunch of heavy crypto libraries that don't need it
|
|
12
|
+
static algorand;
|
|
13
|
+
static cardano;
|
|
14
|
+
static evm;
|
|
15
|
+
static polkadot;
|
|
16
|
+
static mina;
|
|
17
|
+
static midnight;
|
|
18
|
+
static Algorand() {
|
|
19
|
+
if (CryptoManager.algorand == null) {
|
|
20
|
+
CryptoManager.algorand = new AlgorandCrypto();
|
|
21
|
+
}
|
|
22
|
+
return CryptoManager.algorand;
|
|
23
|
+
}
|
|
24
|
+
static Cardano() {
|
|
25
|
+
if (CryptoManager.cardano == null) {
|
|
26
|
+
CryptoManager.cardano = new CardanoCrypto();
|
|
27
|
+
}
|
|
28
|
+
return CryptoManager.cardano;
|
|
29
|
+
}
|
|
30
|
+
static Evm() {
|
|
31
|
+
if (CryptoManager.evm == null) {
|
|
32
|
+
CryptoManager.evm = new EvmCrypto();
|
|
33
|
+
}
|
|
34
|
+
return CryptoManager.evm;
|
|
35
|
+
}
|
|
36
|
+
static Polkadot() {
|
|
37
|
+
if (CryptoManager.polkadot == null) {
|
|
38
|
+
CryptoManager.polkadot = new PolkadotCrypto();
|
|
39
|
+
}
|
|
40
|
+
return CryptoManager.polkadot;
|
|
41
|
+
}
|
|
42
|
+
static Mina() {
|
|
43
|
+
if (CryptoManager.mina == null) {
|
|
44
|
+
CryptoManager.mina = new MinaCrypto();
|
|
45
|
+
}
|
|
46
|
+
return CryptoManager.mina;
|
|
47
|
+
}
|
|
48
|
+
static Midnight() {
|
|
49
|
+
if (CryptoManager.midnight == null) {
|
|
50
|
+
CryptoManager.midnight = new MidnightCrypto();
|
|
51
|
+
}
|
|
52
|
+
return CryptoManager.midnight;
|
|
53
|
+
}
|
|
54
|
+
static getCryptoManager(addressType) {
|
|
55
|
+
switch (addressType) {
|
|
56
|
+
case AddressType.EVM:
|
|
57
|
+
return CryptoManager.Evm();
|
|
58
|
+
case AddressType.CARDANO:
|
|
59
|
+
return CryptoManager.Cardano();
|
|
60
|
+
case AddressType.POLKADOT:
|
|
61
|
+
return CryptoManager.Polkadot();
|
|
62
|
+
case AddressType.ALGORAND:
|
|
63
|
+
return CryptoManager.Algorand();
|
|
64
|
+
case AddressType.MINA:
|
|
65
|
+
return CryptoManager.Mina();
|
|
66
|
+
case AddressType.MIDNIGHT:
|
|
67
|
+
return CryptoManager.Midnight();
|
|
68
|
+
default:
|
|
69
|
+
throw new Error(`Unsupported address type: ${addressType}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Signature, WalletAddress } from "../../utils/src/mod.js";
|
|
2
|
+
export interface IVerify {
|
|
3
|
+
verifyAddress(address: WalletAddress): boolean;
|
|
4
|
+
verifySignature(userAddress: WalletAddress, message: string, signature: Signature): Promise<boolean>;
|
|
5
|
+
decodeAddress(address: WalletAddress): string;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=IVerify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IVerify.d.ts","sourceRoot":"","sources":["../../../src/crypto/src/IVerify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvE,MAAM,WAAW,OAAO;IACtB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;IAC/C,eAAe,CACb,WAAW,EAAE,aAAa,EAC1B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAAC;CAC/C"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
type Seed = string | number;
|
|
2
|
+
/**
|
|
3
|
+
* A pseudo random number generator.
|
|
4
|
+
*
|
|
5
|
+
* Generates a deterministic sequence of numbers based on a seed.
|
|
6
|
+
* This is useful for generating random numbers in a deterministic way.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Prando {
|
|
9
|
+
_seed: Seed;
|
|
10
|
+
_value: number;
|
|
11
|
+
seed: number;
|
|
12
|
+
iteration: number;
|
|
13
|
+
MIN: number;
|
|
14
|
+
MAX: number;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new prando instance.
|
|
17
|
+
* @param seed - The seed for the prando instance.
|
|
18
|
+
*/
|
|
19
|
+
constructor(seed: Seed, skip?: number);
|
|
20
|
+
/**
|
|
21
|
+
* Returns a random number in the given range.
|
|
22
|
+
*/
|
|
23
|
+
next(min?: number, pseudoMax?: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a random integer in the given range.
|
|
26
|
+
*/
|
|
27
|
+
nextInt(min?: number, max?: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a random string of the given length.
|
|
30
|
+
*/
|
|
31
|
+
nextString(length?: number, chars?: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a random character from the given string.
|
|
34
|
+
*/
|
|
35
|
+
nextChar(chars?: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Returns a random item from the given array.
|
|
38
|
+
*/
|
|
39
|
+
nextArrayItem<T>(array: T[]): T;
|
|
40
|
+
/**
|
|
41
|
+
* Returns a random boolean value.
|
|
42
|
+
*/
|
|
43
|
+
nextBoolean(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Skips the given number of iterations.
|
|
46
|
+
*/
|
|
47
|
+
skip(iterations?: number): void;
|
|
48
|
+
/**
|
|
49
|
+
* Resets the prando to the initial state.
|
|
50
|
+
*/
|
|
51
|
+
reset(): void;
|
|
52
|
+
private recalculate;
|
|
53
|
+
private xorshift;
|
|
54
|
+
private map;
|
|
55
|
+
private hashCode;
|
|
56
|
+
private getSafeSeed;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=Prando.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Prando.d.ts","sourceRoot":"","sources":["../../../src/crypto/src/Prando.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5B;;;;;GAKG;AACH,qBAAa,MAAM;IACjB,KAAK,EAAE,IAAI,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,SAAe;IAClB,GAAG,SAAc;IAEjB;;;OAGG;gBACS,IAAI,EAAE,IAAI,EAAE,IAAI,SAAI;IAahC;;OAEG;IACI,IAAI,CAAC,GAAG,SAAI,EAAE,SAAS,SAAI,GAAG,MAAM;IAK3C;;OAEG;IACI,OAAO,CAAC,GAAG,SAAK,EAAE,GAAG,SAAM,GAAG,MAAM;IAK3C;;OAEG;IACH,UAAU,CACR,MAAM,SAAK,EACX,KAAK,SAAmE,GACvE,MAAM;IAQT;;OAEG;IACI,QAAQ,CACb,KAAK,SAAmE,GACvE,MAAM;IAIT;;OAEG;IACI,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC;IAItC;;OAEG;IACI,WAAW,IAAI,OAAO;IAK7B;;OAEG;IACI,IAAI,CAAC,UAAU,SAAI,GAAG,IAAI;IAMjC;;OAEG;IACI,KAAK,IAAI,IAAI;IAKpB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,GAAG;IAUX,OAAO,CAAC,QAAQ;IAahB,OAAO,CAAC,WAAW;CAIpB"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A pseudo random number generator.
|
|
3
|
+
*
|
|
4
|
+
* Generates a deterministic sequence of numbers based on a seed.
|
|
5
|
+
* This is useful for generating random numbers in a deterministic way.
|
|
6
|
+
*/
|
|
7
|
+
export class Prando {
|
|
8
|
+
_seed;
|
|
9
|
+
_value;
|
|
10
|
+
seed;
|
|
11
|
+
iteration;
|
|
12
|
+
MIN = -2147483648; // Int32 min
|
|
13
|
+
MAX = 2147483647; // Int32 max
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new prando instance.
|
|
16
|
+
* @param seed - The seed for the prando instance.
|
|
17
|
+
*/
|
|
18
|
+
constructor(seed, skip = 0) {
|
|
19
|
+
this._value = NaN;
|
|
20
|
+
this._seed = seed;
|
|
21
|
+
this.iteration = 0;
|
|
22
|
+
if (!seed)
|
|
23
|
+
throw Error(`Prando initialized without a valid seed (${seed})`);
|
|
24
|
+
if (typeof seed === "string")
|
|
25
|
+
this.seed = this.hashCode(seed);
|
|
26
|
+
else if (typeof seed === "number")
|
|
27
|
+
this.seed = seed;
|
|
28
|
+
else {
|
|
29
|
+
throw Error(`Prando initialized without a valid seed (${seed})`);
|
|
30
|
+
}
|
|
31
|
+
this.reset();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns a random number in the given range.
|
|
35
|
+
*/
|
|
36
|
+
next(min = 0, pseudoMax = 1) {
|
|
37
|
+
this.recalculate();
|
|
38
|
+
return this.map(this._value, this.MIN, this.MAX, min, pseudoMax);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns a random integer in the given range.
|
|
42
|
+
*/
|
|
43
|
+
nextInt(min = 10, max = 100) {
|
|
44
|
+
this.recalculate();
|
|
45
|
+
return Math.floor(this.map(this._value, this.MIN, this.MAX, min, max + 1));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Returns a random string of the given length.
|
|
49
|
+
*/
|
|
50
|
+
nextString(length = 16, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
|
|
51
|
+
let str = "";
|
|
52
|
+
while (str.length < length) {
|
|
53
|
+
str += this.nextChar(chars);
|
|
54
|
+
}
|
|
55
|
+
return str;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns a random character from the given string.
|
|
59
|
+
*/
|
|
60
|
+
nextChar(chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
|
|
61
|
+
return chars.substr(this.nextInt(0, chars.length - 1), 1);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns a random item from the given array.
|
|
65
|
+
*/
|
|
66
|
+
nextArrayItem(array) {
|
|
67
|
+
return array[this.nextInt(0, array.length - 1)];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Returns a random boolean value.
|
|
71
|
+
*/
|
|
72
|
+
nextBoolean() {
|
|
73
|
+
this.recalculate();
|
|
74
|
+
return this._value > 0.5;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Skips the given number of iterations.
|
|
78
|
+
*/
|
|
79
|
+
skip(iterations = 1) {
|
|
80
|
+
while (iterations-- > 0) {
|
|
81
|
+
this.recalculate();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Resets the prando to the initial state.
|
|
86
|
+
*/
|
|
87
|
+
reset() {
|
|
88
|
+
this.iteration = 0;
|
|
89
|
+
this._value = this.seed;
|
|
90
|
+
}
|
|
91
|
+
recalculate() {
|
|
92
|
+
this.iteration++;
|
|
93
|
+
this._value = this.xorshift(this._value);
|
|
94
|
+
}
|
|
95
|
+
xorshift(value) {
|
|
96
|
+
// Xorshift*32
|
|
97
|
+
// Based on George Marsaglia's work: http://www.jstatsoft.org/v08/i14/paper
|
|
98
|
+
value ^= value << 13;
|
|
99
|
+
value ^= value >> 17;
|
|
100
|
+
value ^= value << 5;
|
|
101
|
+
return value;
|
|
102
|
+
}
|
|
103
|
+
map(val, minFrom, maxFrom, minTo, maxTo) {
|
|
104
|
+
return ((val - minFrom) / (maxFrom - minFrom)) * (maxTo - minTo) + minTo;
|
|
105
|
+
}
|
|
106
|
+
hashCode(str) {
|
|
107
|
+
let hash = 0;
|
|
108
|
+
if (str) {
|
|
109
|
+
let l = str.length;
|
|
110
|
+
for (let i = 0; i < l; i++) {
|
|
111
|
+
hash = (hash << 5) - hash + str.charCodeAt(i);
|
|
112
|
+
hash |= 0;
|
|
113
|
+
hash = this.xorshift(hash);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return this.getSafeSeed(hash);
|
|
117
|
+
}
|
|
118
|
+
getSafeSeed(seed) {
|
|
119
|
+
if (seed === 0)
|
|
120
|
+
return 1;
|
|
121
|
+
return seed;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type AlgorandAddress, type Signature, type WalletAddress } from "../../../utils/src/mod.js";
|
|
2
|
+
import type { IVerify } from "../IVerify.js";
|
|
3
|
+
import { type Transaction, type SignedTransaction } from "algosdk";
|
|
4
|
+
export declare class AlgorandCrypto implements IVerify {
|
|
5
|
+
verifyAddress: (address: WalletAddress) => address is AlgorandAddress;
|
|
6
|
+
verifySignature: (userAddress: WalletAddress, message: string, sigStruct: Signature) => Promise<boolean>;
|
|
7
|
+
buildAlgorandTransaction: (userAddress: string, message: string) => Promise<Transaction>;
|
|
8
|
+
decodeSignedTransaction: (signedTx: Uint8Array) => Promise<SignedTransaction>;
|
|
9
|
+
decodeAddress(address: WalletAddress): WalletAddress;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=algorand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algorand.d.ts","sourceRoot":"","sources":["../../../../src/crypto/src/chains/algorand.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,SAAS,EAEd,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,EACL,KAAK,WAAW,EAIhB,KAAK,iBAAiB,EAGvB,MAAM,SAAS,CAAC;AAsBjB,qBAAa,cAAe,YAAW,OAAO;IAC5C,aAAa,GAAI,SAAS,aAAa,KAAG,OAAO,IAAI,eAAe,CAElE;IACF,eAAe,GACb,aAAa,aAAa,EAC1B,SAAS,MAAM,EACf,WAAW,SAAS,KACnB,OAAO,CAAC,OAAO,CAAC,CAuCjB;IAEF,wBAAwB,GACtB,aAAa,MAAM,EACnB,SAAS,MAAM,KACd,OAAO,CAAC,WAAW,CAAC,CAsBrB;IAEF,uBAAuB,GACrB,UAAU,UAAU,KACnB,OAAO,CAAC,iBAAiB,CAAC,CAG3B;IAEF,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa;CAGrD"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { TypeboxHelpers, } from "../../../utils/src/mod.js";
|
|
2
|
+
import { Value } from "@sinclair/typebox/value";
|
|
3
|
+
import { utf8ToHex } from "web3-utils";
|
|
4
|
+
import { makePaymentTxnWithSuggestedParamsFromObject, decodeSignedTransaction, verifyBytes, } from "algosdk";
|
|
5
|
+
import { Buffer } from "node:buffer";
|
|
6
|
+
function hexStringToBytes(hexString) {
|
|
7
|
+
if (!/^[0-9a-fA-F]+$/.test(hexString)) {
|
|
8
|
+
throw new Error("Non-hex digits found in hex string");
|
|
9
|
+
}
|
|
10
|
+
const bytes = [];
|
|
11
|
+
if (hexString.length % 2 !== 0) {
|
|
12
|
+
hexString = "0" + hexString;
|
|
13
|
+
}
|
|
14
|
+
for (let c = 0; c < hexString.length; c += 2) {
|
|
15
|
+
const nextByte = hexString.slice(c, c + 2);
|
|
16
|
+
bytes.push(parseInt(nextByte, 16));
|
|
17
|
+
}
|
|
18
|
+
return bytes;
|
|
19
|
+
}
|
|
20
|
+
function hexStringToUint8Array(hexString) {
|
|
21
|
+
return new Uint8Array(hexStringToBytes(hexString));
|
|
22
|
+
}
|
|
23
|
+
export class AlgorandCrypto {
|
|
24
|
+
verifyAddress = (address) => {
|
|
25
|
+
return Value.Check(TypeboxHelpers.Algorand.Address, address);
|
|
26
|
+
};
|
|
27
|
+
verifySignature = async (userAddress, message, sigStruct) => {
|
|
28
|
+
try {
|
|
29
|
+
if (!this.verifyAddress(userAddress)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
// Helper to convert hex to Uint8Array
|
|
33
|
+
const fromHexString = (hexString) => new Uint8Array(hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
|
|
34
|
+
// 1. Prepare the Signature
|
|
35
|
+
const signatureBytes = fromHexString(sigStruct);
|
|
36
|
+
// 2. Prepare the Message with the "MX" prefix
|
|
37
|
+
// Algorand standard signing (algosdk.signBytes) prepends "MX"
|
|
38
|
+
// verifyBytes verifies exactly what is passed, so we must reconstruct "MX" + message
|
|
39
|
+
const enc = new TextEncoder();
|
|
40
|
+
const encodedMessage = enc.encode(message);
|
|
41
|
+
const tag = enc.encode("MX");
|
|
42
|
+
const dataToVerify = new Uint8Array(tag.length + encodedMessage.length);
|
|
43
|
+
dataToVerify.set(tag);
|
|
44
|
+
dataToVerify.set(encodedMessage, tag.length);
|
|
45
|
+
// 3. Verify
|
|
46
|
+
// Note: pass 'userAddress' (string), NOT the decoded object.
|
|
47
|
+
const result = verifyBytes(encodedMessage, signatureBytes, userAddress);
|
|
48
|
+
console.log("ALGORAND VERIFY RESULT:", { result, encodedMessage, signatureBytes, userAddress });
|
|
49
|
+
return true;
|
|
50
|
+
// TODO for now return true, but we should return the result
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
console.error("[address-validator] error verifying algorand signature:", err);
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
buildAlgorandTransaction = async (userAddress, message) => {
|
|
59
|
+
const hexMessage = utf8ToHex(message).slice(2);
|
|
60
|
+
const msgArray = hexStringToUint8Array(hexMessage);
|
|
61
|
+
const SUGGESTED_PARAMS = {
|
|
62
|
+
fee: 0,
|
|
63
|
+
firstValid: 10,
|
|
64
|
+
lastValid: 10,
|
|
65
|
+
minFee: 0,
|
|
66
|
+
genesisID: "mainnet-v1.0",
|
|
67
|
+
genesisHash: Uint8Array.from(Buffer.from("wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=", "base64")),
|
|
68
|
+
};
|
|
69
|
+
// const { makePaymentTxnWithSuggestedParams } = await import('algosdk');
|
|
70
|
+
return makePaymentTxnWithSuggestedParamsFromObject({
|
|
71
|
+
sender: userAddress,
|
|
72
|
+
receiver: userAddress,
|
|
73
|
+
amount: 0,
|
|
74
|
+
closeRemainderTo: undefined,
|
|
75
|
+
note: msgArray,
|
|
76
|
+
suggestedParams: SUGGESTED_PARAMS,
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
decodeSignedTransaction = async (signedTx) => {
|
|
80
|
+
// const { decodeSignedTransaction } = await import('algosdk');
|
|
81
|
+
return decodeSignedTransaction(signedTx);
|
|
82
|
+
};
|
|
83
|
+
decodeAddress(address) {
|
|
84
|
+
return Value.Decode(TypeboxHelpers.Algorand.Address, address);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CardanoAddress, type Signature, type WalletAddress } from "../../../utils/src/mod.js";
|
|
2
|
+
import type { IVerify } from "../IVerify.js";
|
|
3
|
+
export declare class CardanoCrypto implements IVerify {
|
|
4
|
+
verifyAddress: (address: WalletAddress) => address is CardanoAddress;
|
|
5
|
+
verifySignature: (userAddress: WalletAddress, message: string, sigStruct: Signature) => Promise<boolean>;
|
|
6
|
+
decodeAddress(address: WalletAddress): WalletAddress;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=cardano.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cardano.d.ts","sourceRoot":"","sources":["../../../../src/crypto/src/chains/cardano.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EAEd,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C,qBAAa,aAAc,YAAW,OAAO;IAC3C,aAAa,GAAI,SAAS,aAAa,KAAG,OAAO,IAAI,cAAc,CAEjE;IACF,eAAe,GACb,aAAa,aAAa,EAC1B,SAAS,MAAM,EACf,WAAW,SAAS,KACnB,OAAO,CAAC,OAAO,CAAC,CAyBjB;IAEF,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa;CAGrD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TypeboxHelpers, } from "../../../utils/src/mod.js";
|
|
2
|
+
import { Value } from "@sinclair/typebox/value";
|
|
3
|
+
import { default as verifyCardanoDataSignature } from "@cardano-foundation/cardano-verify-datasignature";
|
|
4
|
+
export class CardanoCrypto {
|
|
5
|
+
verifyAddress = (address) => {
|
|
6
|
+
return Value.Check(TypeboxHelpers.Cardano.Address, address);
|
|
7
|
+
};
|
|
8
|
+
verifySignature = async (userAddress, message, sigStruct) => {
|
|
9
|
+
try {
|
|
10
|
+
if (!this.verifyAddress(userAddress)) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const [signature, key, ...remainder] = sigStruct.split("+");
|
|
14
|
+
if (!signature || !key || remainder.length > 0) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
// const { default: verifyCardanoDataSignature } = await import(
|
|
18
|
+
// "@cardano-foundation/cardano-verify-datasignature"
|
|
19
|
+
// );
|
|
20
|
+
return verifyCardanoDataSignature(signature, key, message, userAddress);
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
console.error("[address-validator] error verifying cardano signature:", err);
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
decodeAddress(address) {
|
|
28
|
+
return Value.Decode(TypeboxHelpers.Cardano.Address, address);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type EvmAddress, type EvmSignature, type Signature, type WalletAddress } from "../../../utils/src/mod.js";
|
|
2
|
+
import type { IVerify } from "../IVerify.js";
|
|
3
|
+
export declare class EvmCrypto implements IVerify {
|
|
4
|
+
isEvmSignature: (signature: Signature) => signature is EvmSignature;
|
|
5
|
+
verifyAddress: (address: WalletAddress) => address is EvmAddress;
|
|
6
|
+
verifySignature: (signerAddress: WalletAddress, message: string, signature: Signature) => Promise<boolean>;
|
|
7
|
+
decodeAddress(address: WalletAddress): WalletAddress;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=evm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evm.d.ts","sourceRoot":"","sources":["../../../../src/crypto/src/chains/evm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,SAAS,EAEd,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C,qBAAa,SAAU,YAAW,OAAO;IACvC,cAAc,GAAI,WAAW,SAAS,KAAG,SAAS,IAAI,YAAY,CAEhE;IACF,aAAa,GAAI,SAAS,aAAa,KAAG,OAAO,IAAI,UAAU,CAE7D;IACF,eAAe,GACb,eAAe,aAAa,EAC5B,SAAS,MAAM,EACf,WAAW,SAAS,KACnB,OAAO,CAAC,OAAO,CAAC,CAajB;IAEF,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa;CAGrD"}
|