@unconfirmed/effect-sui 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +10 -2
- package/dist/Address.d.ts +18 -0
- package/dist/Address.d.ts.map +1 -0
- package/dist/Address.js +33 -0
- package/dist/Address.js.map +1 -0
- package/dist/AddressAlias.d.ts +107 -0
- package/dist/AddressAlias.d.ts.map +1 -0
- package/dist/AddressAlias.js +104 -0
- package/dist/AddressAlias.js.map +1 -0
- package/dist/Bip32.d.ts +6 -0
- package/dist/Bip32.d.ts.map +1 -0
- package/dist/Bip32.js +34 -0
- package/dist/Bip32.js.map +1 -0
- package/dist/Chain.d.ts +23 -0
- package/dist/Chain.d.ts.map +1 -0
- package/dist/Chain.js +7 -0
- package/dist/Chain.js.map +1 -0
- package/dist/CheckpointData.d.ts +74 -0
- package/dist/CheckpointData.d.ts.map +1 -0
- package/dist/CheckpointData.js +48 -0
- package/dist/CheckpointData.js.map +1 -0
- package/dist/Checkpoints.d.ts +23 -0
- package/dist/Checkpoints.d.ts.map +1 -0
- package/dist/Checkpoints.js +7 -0
- package/dist/Checkpoints.js.map +1 -0
- package/dist/CoinReservation.d.ts +18 -0
- package/dist/CoinReservation.d.ts.map +1 -0
- package/dist/CoinReservation.js +58 -0
- package/dist/CoinReservation.js.map +1 -0
- package/dist/Coins.d.ts +42 -0
- package/dist/Coins.d.ts.map +1 -0
- package/dist/Coins.js +49 -0
- package/dist/Coins.js.map +1 -0
- package/dist/DynamicFields.d.ts +115 -0
- package/dist/DynamicFields.d.ts.map +1 -0
- package/dist/DynamicFields.js +101 -0
- package/dist/DynamicFields.js.map +1 -0
- package/dist/Ecdsa.d.ts +39 -0
- package/dist/Ecdsa.d.ts.map +1 -0
- package/dist/Ecdsa.js +76 -0
- package/dist/Ecdsa.js.map +1 -0
- package/dist/Ed25519.d.ts +22 -0
- package/dist/Ed25519.d.ts.map +1 -0
- package/dist/Ed25519.js +77 -0
- package/dist/Ed25519.js.map +1 -0
- package/dist/Events.d.ts +105 -0
- package/dist/Events.d.ts.map +1 -0
- package/dist/Events.js +51 -0
- package/dist/Events.js.map +1 -0
- package/dist/Hash.d.ts +16 -0
- package/dist/Hash.d.ts.map +1 -0
- package/dist/Hash.js +32 -0
- package/dist/Hash.js.map +1 -0
- package/dist/MlDsa65.d.ts +17 -0
- package/dist/MlDsa65.d.ts.map +1 -0
- package/dist/MlDsa65.js +84 -0
- package/dist/MlDsa65.js.map +1 -0
- package/dist/Mnemonic.d.ts +20 -0
- package/dist/Mnemonic.d.ts.map +1 -0
- package/dist/Mnemonic.js +71 -0
- package/dist/Mnemonic.js.map +1 -0
- package/dist/Move.d.ts +261 -0
- package/dist/Move.d.ts.map +1 -0
- package/dist/Move.js +232 -0
- package/dist/Move.js.map +1 -0
- package/dist/MultiSig.d.ts +106 -0
- package/dist/MultiSig.d.ts.map +1 -0
- package/dist/MultiSig.js +254 -0
- package/dist/MultiSig.js.map +1 -0
- package/dist/Objects.d.ts +95 -0
- package/dist/Objects.d.ts.map +1 -0
- package/dist/Objects.js +57 -0
- package/dist/Objects.js.map +1 -0
- package/dist/Packages.d.ts +49 -0
- package/dist/Packages.d.ts.map +1 -0
- package/dist/Packages.js +16 -0
- package/dist/Packages.js.map +1 -0
- package/dist/Passkey.d.ts +11 -0
- package/dist/Passkey.d.ts.map +1 -0
- package/dist/Passkey.js +11 -0
- package/dist/Passkey.js.map +1 -0
- package/dist/PrivateKey.d.ts +39 -0
- package/dist/PrivateKey.d.ts.map +1 -0
- package/dist/PrivateKey.js +118 -0
- package/dist/PrivateKey.js.map +1 -0
- package/dist/Ptb.d.ts +413 -0
- package/dist/Ptb.d.ts.map +1 -0
- package/dist/Ptb.js +338 -0
- package/dist/Ptb.js.map +1 -0
- package/dist/Resolve.d.ts +502 -0
- package/dist/Resolve.d.ts.map +1 -0
- package/dist/Resolve.js +1188 -0
- package/dist/Resolve.js.map +1 -0
- package/dist/RpcError.d.ts +19 -0
- package/dist/RpcError.d.ts.map +1 -0
- package/dist/RpcError.js +37 -0
- package/dist/RpcError.js.map +1 -0
- package/dist/Secp256k1.d.ts +11 -0
- package/dist/Secp256k1.d.ts.map +1 -0
- package/dist/Secp256k1.js +23 -0
- package/dist/Secp256k1.js.map +1 -0
- package/dist/Secp256r1.d.ts +11 -0
- package/dist/Secp256r1.d.ts.map +1 -0
- package/dist/Secp256r1.js +23 -0
- package/dist/Secp256r1.js.map +1 -0
- package/dist/SignatureScheme.d.ts +103 -0
- package/dist/SignatureScheme.d.ts.map +1 -0
- package/dist/SignatureScheme.js +93 -0
- package/dist/SignatureScheme.js.map +1 -0
- package/dist/Signer.d.ts +54 -0
- package/dist/Signer.d.ts.map +1 -0
- package/dist/Signer.js +31 -0
- package/dist/Signer.js.map +1 -0
- package/dist/Testing.d.ts +171 -0
- package/dist/Testing.d.ts.map +1 -0
- package/dist/Testing.js +531 -0
- package/dist/Testing.js.map +1 -0
- package/dist/TransactionData.d.ts +3218 -0
- package/dist/TransactionData.d.ts.map +1 -0
- package/dist/TransactionData.js +105 -0
- package/dist/TransactionData.js.map +1 -0
- package/dist/TransactionJson.d.ts +1544 -0
- package/dist/TransactionJson.d.ts.map +1 -0
- package/dist/TransactionJson.js +926 -0
- package/dist/TransactionJson.js.map +1 -0
- package/dist/Transactions.d.ts +181 -0
- package/dist/Transactions.d.ts.map +1 -0
- package/dist/Transactions.js +49 -0
- package/dist/Transactions.js.map +1 -0
- package/dist/Tx.d.ts +1419 -0
- package/dist/Tx.d.ts.map +1 -0
- package/dist/Tx.js +266 -0
- package/dist/Tx.js.map +1 -0
- package/dist/TypeTag.d.ts +42 -0
- package/dist/TypeTag.d.ts.map +1 -0
- package/dist/TypeTag.js +110 -0
- package/dist/TypeTag.js.map +1 -0
- package/dist/Verify.d.ts +23 -0
- package/dist/Verify.d.ts.map +1 -0
- package/dist/Verify.js +29 -0
- package/dist/Verify.js.map +1 -0
- package/dist/enoki/EnokiClient.d.ts +184 -0
- package/dist/enoki/EnokiClient.d.ts.map +1 -0
- package/dist/enoki/EnokiClient.js +105 -0
- package/dist/enoki/EnokiClient.js.map +1 -0
- package/dist/enoki/EnokiHttp.d.ts +33 -0
- package/dist/enoki/EnokiHttp.d.ts.map +1 -0
- package/dist/enoki/EnokiHttp.js +160 -0
- package/dist/enoki/EnokiHttp.js.map +1 -0
- package/dist/enoki/Sponsor.d.ts +119 -0
- package/dist/enoki/Sponsor.d.ts.map +1 -0
- package/dist/enoki/Sponsor.js +170 -0
- package/dist/enoki/Sponsor.js.map +1 -0
- package/dist/enoki/ZkLoginFlow.d.ts +84 -0
- package/dist/enoki/ZkLoginFlow.d.ts.map +1 -0
- package/dist/enoki/ZkLoginFlow.js +138 -0
- package/dist/enoki/ZkLoginFlow.js.map +1 -0
- package/dist/enoki/index.d.ts +9 -0
- package/dist/enoki/index.d.ts.map +1 -0
- package/dist/enoki/index.js +9 -0
- package/dist/enoki/index.js.map +1 -0
- package/dist/graphql/ChainGraphQL.d.ts +35 -0
- package/dist/graphql/ChainGraphQL.d.ts.map +1 -0
- package/dist/graphql/ChainGraphQL.js +62 -0
- package/dist/graphql/ChainGraphQL.js.map +1 -0
- package/dist/graphql/CheckpointDataGraphQL.d.ts +785 -0
- package/dist/graphql/CheckpointDataGraphQL.d.ts.map +1 -0
- package/dist/graphql/CheckpointDataGraphQL.js +157 -0
- package/dist/graphql/CheckpointDataGraphQL.js.map +1 -0
- package/dist/graphql/CheckpointsGraphQL.d.ts +91 -0
- package/dist/graphql/CheckpointsGraphQL.d.ts.map +1 -0
- package/dist/graphql/CheckpointsGraphQL.js +80 -0
- package/dist/graphql/CheckpointsGraphQL.js.map +1 -0
- package/dist/graphql/CoinsGraphQL.d.ts +81 -0
- package/dist/graphql/CoinsGraphQL.d.ts.map +1 -0
- package/dist/graphql/CoinsGraphQL.js +63 -0
- package/dist/graphql/CoinsGraphQL.js.map +1 -0
- package/dist/graphql/DynamicFieldsGraphQL.d.ts +94 -0
- package/dist/graphql/DynamicFieldsGraphQL.d.ts.map +1 -0
- package/dist/graphql/DynamicFieldsGraphQL.js +126 -0
- package/dist/graphql/DynamicFieldsGraphQL.js.map +1 -0
- package/dist/graphql/EventsGraphQL.d.ts +266 -0
- package/dist/graphql/EventsGraphQL.d.ts.map +1 -0
- package/dist/graphql/EventsGraphQL.js +249 -0
- package/dist/graphql/EventsGraphQL.js.map +1 -0
- package/dist/graphql/ObjectsGraphQL.d.ts +130 -0
- package/dist/graphql/ObjectsGraphQL.d.ts.map +1 -0
- package/dist/graphql/ObjectsGraphQL.js +79 -0
- package/dist/graphql/ObjectsGraphQL.js.map +1 -0
- package/dist/graphql/PackagesGraphQL.d.ts +82 -0
- package/dist/graphql/PackagesGraphQL.d.ts.map +1 -0
- package/dist/graphql/PackagesGraphQL.js +145 -0
- package/dist/graphql/PackagesGraphQL.js.map +1 -0
- package/dist/graphql/SuiGraphQL.d.ts +37 -0
- package/dist/graphql/SuiGraphQL.d.ts.map +1 -0
- package/dist/graphql/SuiGraphQL.js +47 -0
- package/dist/graphql/SuiGraphQL.js.map +1 -0
- package/dist/graphql/TransactionsGraphQL.d.ts +1309 -0
- package/dist/graphql/TransactionsGraphQL.d.ts.map +1 -0
- package/dist/graphql/TransactionsGraphQL.js +206 -0
- package/dist/graphql/TransactionsGraphQL.js.map +1 -0
- package/dist/graphql/convert.d.ts +505 -0
- package/dist/graphql/convert.d.ts.map +1 -0
- package/dist/graphql/convert.js +384 -0
- package/dist/graphql/convert.js.map +1 -0
- package/dist/graphql/index.d.ts +41 -0
- package/dist/graphql/index.d.ts.map +1 -0
- package/dist/graphql/index.js +20 -0
- package/dist/graphql/index.js.map +1 -0
- package/dist/graphql/merge.d.ts +8 -0
- package/dist/graphql/merge.d.ts.map +1 -0
- package/dist/graphql/merge.js +55 -0
- package/dist/graphql/merge.js.map +1 -0
- package/dist/graphql/paging.d.ts +219 -0
- package/dist/graphql/paging.d.ts.map +1 -0
- package/dist/graphql/paging.js +74 -0
- package/dist/graphql/paging.js.map +1 -0
- package/dist/graphql/subscription.d.ts +27 -0
- package/dist/graphql/subscription.d.ts.map +1 -0
- package/dist/graphql/subscription.js +47 -0
- package/dist/graphql/subscription.js.map +1 -0
- package/dist/graphql/tip.d.ts +31 -0
- package/dist/graphql/tip.d.ts.map +1 -0
- package/dist/graphql/tip.js +29 -0
- package/dist/graphql/tip.js.map +1 -0
- package/dist/grpc/ChainGrpc.d.ts +11 -0
- package/dist/grpc/ChainGrpc.d.ts.map +1 -0
- package/dist/grpc/ChainGrpc.js +40 -0
- package/dist/grpc/ChainGrpc.js.map +1 -0
- package/dist/grpc/CheckpointDataGrpc.d.ts +6 -0
- package/dist/grpc/CheckpointDataGrpc.d.ts.map +1 -0
- package/dist/grpc/CheckpointDataGrpc.js +27 -0
- package/dist/grpc/CheckpointDataGrpc.js.map +1 -0
- package/dist/grpc/CheckpointsGrpc.d.ts +6 -0
- package/dist/grpc/CheckpointsGrpc.d.ts.map +1 -0
- package/dist/grpc/CheckpointsGrpc.js +25 -0
- package/dist/grpc/CheckpointsGrpc.js.map +1 -0
- package/dist/grpc/CoinsGrpc.d.ts +7 -0
- package/dist/grpc/CoinsGrpc.d.ts.map +1 -0
- package/dist/grpc/CoinsGrpc.js +34 -0
- package/dist/grpc/CoinsGrpc.js.map +1 -0
- package/dist/grpc/DynamicFieldsGrpc.d.ts +11 -0
- package/dist/grpc/DynamicFieldsGrpc.d.ts.map +1 -0
- package/dist/grpc/DynamicFieldsGrpc.js +91 -0
- package/dist/grpc/DynamicFieldsGrpc.js.map +1 -0
- package/dist/grpc/EventsGrpc.d.ts +13 -0
- package/dist/grpc/EventsGrpc.d.ts.map +1 -0
- package/dist/grpc/EventsGrpc.js +88 -0
- package/dist/grpc/EventsGrpc.js.map +1 -0
- package/dist/grpc/GrpcWeb.d.ts +71 -0
- package/dist/grpc/GrpcWeb.d.ts.map +1 -0
- package/dist/grpc/GrpcWeb.js +243 -0
- package/dist/grpc/GrpcWeb.js.map +1 -0
- package/dist/grpc/ObjectsGrpc.d.ts +10 -0
- package/dist/grpc/ObjectsGrpc.d.ts.map +1 -0
- package/dist/grpc/ObjectsGrpc.js +72 -0
- package/dist/grpc/ObjectsGrpc.js.map +1 -0
- package/dist/grpc/PackagesGrpc.d.ts +9 -0
- package/dist/grpc/PackagesGrpc.d.ts.map +1 -0
- package/dist/grpc/PackagesGrpc.js +78 -0
- package/dist/grpc/PackagesGrpc.js.map +1 -0
- package/dist/grpc/Rpc.d.ts +46 -0
- package/dist/grpc/Rpc.d.ts.map +1 -0
- package/dist/grpc/Rpc.js +111 -0
- package/dist/grpc/Rpc.js.map +1 -0
- package/dist/grpc/TransactionsGrpc.d.ts +6 -0
- package/dist/grpc/TransactionsGrpc.d.ts.map +1 -0
- package/dist/grpc/TransactionsGrpc.js +56 -0
- package/dist/grpc/TransactionsGrpc.js.map +1 -0
- package/dist/grpc/cache.d.ts +7 -0
- package/dist/grpc/cache.d.ts.map +1 -0
- package/dist/grpc/cache.js +55 -0
- package/dist/grpc/cache.js.map +1 -0
- package/dist/grpc/convert.d.ts +43 -0
- package/dist/grpc/convert.d.ts.map +1 -0
- package/dist/grpc/convert.js +198 -0
- package/dist/grpc/convert.js.map +1 -0
- package/dist/grpc/generated/lean.d.ts +36 -0
- package/dist/grpc/generated/lean.d.ts.map +1 -0
- package/dist/grpc/generated/lean.js +205 -0
- package/dist/grpc/generated/lean.js.map +1 -0
- package/dist/grpc/generated/proto.d.ts +2000 -0
- package/dist/grpc/generated/proto.d.ts.map +1 -0
- package/dist/grpc/generated/proto.js +356 -0
- package/dist/grpc/generated/proto.js.map +1 -0
- package/dist/grpc/generated/rpc.d.ts +62 -0
- package/dist/grpc/generated/rpc.d.ts.map +1 -0
- package/dist/grpc/generated/rpc.js +324 -0
- package/dist/grpc/generated/rpc.js.map +1 -0
- package/dist/grpc/index.d.ts +58 -0
- package/dist/grpc/index.d.ts.map +1 -0
- package/dist/grpc/index.js +43 -0
- package/dist/grpc/index.js.map +1 -0
- package/dist/grpc/scan.d.ts +79 -0
- package/dist/grpc/scan.d.ts.map +1 -0
- package/dist/grpc/scan.js +126 -0
- package/dist/grpc/scan.js.map +1 -0
- package/dist/grpc/transaction.d.ts +9 -0
- package/dist/grpc/transaction.d.ts.map +1 -0
- package/dist/grpc/transaction.js +168 -0
- package/dist/grpc/transaction.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/allowances.d.ts +18 -0
- package/dist/internal/allowances.d.ts.map +1 -0
- package/dist/internal/allowances.js +194 -0
- package/dist/internal/allowances.js.map +1 -0
- package/dist/internal/mnemonic.d.ts +53 -0
- package/dist/internal/mnemonic.d.ts.map +1 -0
- package/dist/internal/mnemonic.js +66 -0
- package/dist/internal/mnemonic.js.map +1 -0
- package/dist/internal/passkey/BrowserProvider.d.ts +10 -0
- package/dist/internal/passkey/BrowserProvider.d.ts.map +1 -0
- package/dist/internal/passkey/BrowserProvider.js +101 -0
- package/dist/internal/passkey/BrowserProvider.js.map +1 -0
- package/dist/internal/passkey/Passkey.d.ts +104 -0
- package/dist/internal/passkey/Passkey.d.ts.map +1 -0
- package/dist/internal/passkey/Passkey.js +333 -0
- package/dist/internal/passkey/Passkey.js.map +1 -0
- package/dist/internal/passkey/SoftwareProvider.d.ts +23 -0
- package/dist/internal/passkey/SoftwareProvider.d.ts.map +1 -0
- package/dist/internal/passkey/SoftwareProvider.js +61 -0
- package/dist/internal/passkey/SoftwareProvider.js.map +1 -0
- package/dist/lifecycle/Evidence.d.ts +62 -0
- package/dist/lifecycle/Evidence.d.ts.map +1 -0
- package/dist/lifecycle/Evidence.js +30 -0
- package/dist/lifecycle/Evidence.js.map +1 -0
- package/dist/lifecycle/EvidenceGraphQL.d.ts +59 -0
- package/dist/lifecycle/EvidenceGraphQL.d.ts.map +1 -0
- package/dist/lifecycle/EvidenceGraphQL.js +53 -0
- package/dist/lifecycle/EvidenceGraphQL.js.map +1 -0
- package/dist/lifecycle/EvidenceGrpc.d.ts +4 -0
- package/dist/lifecycle/EvidenceGrpc.d.ts.map +1 -0
- package/dist/lifecycle/EvidenceGrpc.js +37 -0
- package/dist/lifecycle/EvidenceGrpc.js.map +1 -0
- package/dist/lifecycle/Journal.d.ts +69 -0
- package/dist/lifecycle/Journal.d.ts.map +1 -0
- package/dist/lifecycle/Journal.js +70 -0
- package/dist/lifecycle/Journal.js.map +1 -0
- package/dist/lifecycle/JournalEntry.d.ts +67 -0
- package/dist/lifecycle/JournalEntry.d.ts.map +1 -0
- package/dist/lifecycle/JournalEntry.js +45 -0
- package/dist/lifecycle/JournalEntry.js.map +1 -0
- package/dist/lifecycle/JournalKeyValueStore.d.ts +30 -0
- package/dist/lifecycle/JournalKeyValueStore.d.ts.map +1 -0
- package/dist/lifecycle/JournalKeyValueStore.js +217 -0
- package/dist/lifecycle/JournalKeyValueStore.js.map +1 -0
- package/dist/lifecycle/KeyValueStoreIndexedDb.d.ts +54 -0
- package/dist/lifecycle/KeyValueStoreIndexedDb.d.ts.map +1 -0
- package/dist/lifecycle/KeyValueStoreIndexedDb.js +321 -0
- package/dist/lifecycle/KeyValueStoreIndexedDb.js.map +1 -0
- package/dist/lifecycle/KeyValueStoreOpfs.d.ts +65 -0
- package/dist/lifecycle/KeyValueStoreOpfs.d.ts.map +1 -0
- package/dist/lifecycle/KeyValueStoreOpfs.js +207 -0
- package/dist/lifecycle/KeyValueStoreOpfs.js.map +1 -0
- package/dist/lifecycle/Lifecycle.d.ts +416 -0
- package/dist/lifecycle/Lifecycle.d.ts.map +1 -0
- package/dist/lifecycle/Lifecycle.js +666 -0
- package/dist/lifecycle/Lifecycle.js.map +1 -0
- package/dist/lifecycle/Outcome.d.ts +132 -0
- package/dist/lifecycle/Outcome.d.ts.map +1 -0
- package/dist/lifecycle/Outcome.js +106 -0
- package/dist/lifecycle/Outcome.js.map +1 -0
- package/dist/lifecycle/SenderLock.d.ts +37 -0
- package/dist/lifecycle/SenderLock.d.ts.map +1 -0
- package/dist/lifecycle/SenderLock.js +57 -0
- package/dist/lifecycle/SenderLock.js.map +1 -0
- package/dist/lifecycle/SenderLockWebLocks.d.ts +37 -0
- package/dist/lifecycle/SenderLockWebLocks.d.ts.map +1 -0
- package/dist/lifecycle/SenderLockWebLocks.js +100 -0
- package/dist/lifecycle/SenderLockWebLocks.js.map +1 -0
- package/dist/lifecycle/SignedTransaction.d.ts +55 -0
- package/dist/lifecycle/SignedTransaction.d.ts.map +1 -0
- package/dist/lifecycle/SignedTransaction.js +109 -0
- package/dist/lifecycle/SignedTransaction.js.map +1 -0
- package/dist/lifecycle/SubmitConfig.d.ts +44 -0
- package/dist/lifecycle/SubmitConfig.d.ts.map +1 -0
- package/dist/lifecycle/SubmitConfig.js +39 -0
- package/dist/lifecycle/SubmitConfig.js.map +1 -0
- package/dist/lifecycle/index.d.ts +13 -0
- package/dist/lifecycle/index.d.ts.map +1 -0
- package/dist/lifecycle/index.js +13 -0
- package/dist/lifecycle/index.js.map +1 -0
- package/dist/wallet/Features.d.ts +91 -0
- package/dist/wallet/Features.d.ts.map +1 -0
- package/dist/wallet/Features.js +14 -0
- package/dist/wallet/Features.js.map +1 -0
- package/dist/wallet/Wallet.d.ts +151 -0
- package/dist/wallet/Wallet.d.ts.map +1 -0
- package/dist/wallet/Wallet.js +399 -0
- package/dist/wallet/Wallet.js.map +1 -0
- package/dist/wallet/index.d.ts +6 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +6 -0
- package/dist/wallet/index.js.map +1 -0
- package/dist/zklogin/AddressSeed.d.ts +40 -0
- package/dist/zklogin/AddressSeed.d.ts.map +1 -0
- package/dist/zklogin/AddressSeed.js +91 -0
- package/dist/zklogin/AddressSeed.js.map +1 -0
- package/dist/zklogin/Errors.d.ts +24 -0
- package/dist/zklogin/Errors.d.ts.map +1 -0
- package/dist/zklogin/Errors.js +25 -0
- package/dist/zklogin/Errors.js.map +1 -0
- package/dist/zklogin/Jwt.d.ts +51 -0
- package/dist/zklogin/Jwt.d.ts.map +1 -0
- package/dist/zklogin/Jwt.js +159 -0
- package/dist/zklogin/Jwt.js.map +1 -0
- package/dist/zklogin/Nonce.d.ts +9 -0
- package/dist/zklogin/Nonce.d.ts.map +1 -0
- package/dist/zklogin/Nonce.js +34 -0
- package/dist/zklogin/Nonce.js.map +1 -0
- package/dist/zklogin/Poseidon.d.ts +24 -0
- package/dist/zklogin/Poseidon.d.ts.map +1 -0
- package/dist/zklogin/Poseidon.js +54 -0
- package/dist/zklogin/Poseidon.js.map +1 -0
- package/dist/zklogin/PublicIdentifier.d.ts +49 -0
- package/dist/zklogin/PublicIdentifier.d.ts.map +1 -0
- package/dist/zklogin/PublicIdentifier.js +90 -0
- package/dist/zklogin/PublicIdentifier.js.map +1 -0
- package/dist/zklogin/Signature.d.ts +55 -0
- package/dist/zklogin/Signature.d.ts.map +1 -0
- package/dist/zklogin/Signature.js +70 -0
- package/dist/zklogin/Signature.js.map +1 -0
- package/dist/zklogin/ZkLogin.d.ts +41 -0
- package/dist/zklogin/ZkLogin.d.ts.map +1 -0
- package/dist/zklogin/ZkLogin.js +87 -0
- package/dist/zklogin/ZkLogin.js.map +1 -0
- package/dist/zklogin/ZkLoginAddress.d.ts +30 -0
- package/dist/zklogin/ZkLoginAddress.d.ts.map +1 -0
- package/dist/zklogin/ZkLoginAddress.js +31 -0
- package/dist/zklogin/ZkLoginAddress.js.map +1 -0
- package/dist/zklogin/ZkLoginVerifier.d.ts +37 -0
- package/dist/zklogin/ZkLoginVerifier.d.ts.map +1 -0
- package/dist/zklogin/ZkLoginVerifier.js +4 -0
- package/dist/zklogin/ZkLoginVerifier.js.map +1 -0
- package/dist/zklogin/ZkLoginVerifierGrpc.d.ts +12 -0
- package/dist/zklogin/ZkLoginVerifierGrpc.d.ts.map +1 -0
- package/dist/zklogin/ZkLoginVerifierGrpc.js +53 -0
- package/dist/zklogin/ZkLoginVerifierGrpc.js.map +1 -0
- package/dist/zklogin/index.d.ts +17 -0
- package/dist/zklogin/index.d.ts.map +1 -0
- package/dist/zklogin/index.js +17 -0
- package/dist/zklogin/index.js.map +1 -0
- package/dist/zklogin/internal/parse.d.ts +9 -0
- package/dist/zklogin/internal/parse.d.ts.map +1 -0
- package/dist/zklogin/internal/parse.js +33 -0
- package/dist/zklogin/internal/parse.js.map +1 -0
- package/dist/zklogin/internal/poseidon.d.ts +21 -0
- package/dist/zklogin/internal/poseidon.d.ts.map +1 -0
- package/dist/zklogin/internal/poseidon.js +40 -0
- package/dist/zklogin/internal/poseidon.js.map +1 -0
- package/package.json +69 -4
- package/src/Address.ts +45 -0
- package/src/AddressAlias.ts +160 -0
- package/src/Bip32.ts +37 -0
- package/src/Chain.ts +21 -0
- package/src/CheckpointData.ts +106 -0
- package/src/Checkpoints.ts +18 -0
- package/src/CoinReservation.ts +65 -0
- package/src/Coins.ts +86 -0
- package/src/DynamicFields.ts +179 -0
- package/src/Ecdsa.ts +103 -0
- package/src/Ed25519.ts +84 -0
- package/src/Events.ts +133 -0
- package/src/Hash.ts +39 -0
- package/src/MlDsa65.ts +92 -0
- package/src/Mnemonic.ts +109 -0
- package/src/Move.ts +440 -0
- package/src/MultiSig.ts +320 -0
- package/src/Objects.ts +112 -0
- package/src/Packages.ts +52 -0
- package/src/Passkey.ts +10 -0
- package/src/PrivateKey.ts +138 -0
- package/src/Ptb.ts +579 -0
- package/src/Resolve.ts +1367 -0
- package/src/RpcError.ts +41 -0
- package/src/Secp256k1.ts +29 -0
- package/src/Secp256r1.ts +29 -0
- package/src/SignatureScheme.ts +166 -0
- package/src/Signer.ts +62 -0
- package/src/Testing.ts +830 -0
- package/src/TransactionData.ts +134 -0
- package/src/TransactionJson.ts +1002 -0
- package/src/Transactions.ts +211 -0
- package/src/Tx.ts +367 -0
- package/src/TypeTag.ts +123 -0
- package/src/Verify.ts +42 -0
- package/src/enoki/EnokiClient.ts +204 -0
- package/src/enoki/EnokiHttp.ts +222 -0
- package/src/enoki/Sponsor.ts +280 -0
- package/src/enoki/ZkLoginFlow.ts +176 -0
- package/src/enoki/index.ts +8 -0
- package/src/graphql/ChainGraphQL.ts +76 -0
- package/src/graphql/CheckpointDataGraphQL.ts +191 -0
- package/src/graphql/CheckpointsGraphQL.ts +96 -0
- package/src/graphql/CoinsGraphQL.ts +85 -0
- package/src/graphql/DynamicFieldsGraphQL.ts +167 -0
- package/src/graphql/EventsGraphQL.ts +301 -0
- package/src/graphql/ObjectsGraphQL.ts +112 -0
- package/src/graphql/PackagesGraphQL.ts +173 -0
- package/src/graphql/SuiGraphQL.ts +77 -0
- package/src/graphql/TransactionsGraphQL.ts +292 -0
- package/src/graphql/convert.ts +450 -0
- package/src/graphql/index.ts +74 -0
- package/src/graphql/merge.ts +62 -0
- package/src/graphql/paging.ts +110 -0
- package/src/graphql/subscription.ts +58 -0
- package/src/graphql/tip.ts +38 -0
- package/src/grpc/ChainGrpc.ts +51 -0
- package/src/grpc/CheckpointDataGrpc.ts +47 -0
- package/src/grpc/CheckpointsGrpc.ts +37 -0
- package/src/grpc/CoinsGrpc.ts +50 -0
- package/src/grpc/DynamicFieldsGrpc.ts +128 -0
- package/src/grpc/EventsGrpc.ts +101 -0
- package/src/grpc/GrpcWeb.ts +343 -0
- package/src/grpc/ObjectsGrpc.ts +95 -0
- package/src/grpc/PackagesGrpc.ts +98 -0
- package/src/grpc/Rpc.ts +156 -0
- package/src/grpc/TransactionsGrpc.ts +88 -0
- package/src/grpc/cache.ts +68 -0
- package/src/grpc/convert.ts +227 -0
- package/src/grpc/generated/lean.ts +276 -0
- package/src/grpc/generated/proto.ts +2130 -0
- package/src/grpc/generated/rpc.ts +417 -0
- package/src/grpc/index.ts +97 -0
- package/src/grpc/scan.ts +183 -0
- package/src/grpc/transaction.ts +182 -0
- package/src/index.ts +35 -0
- package/src/internal/allowances.ts +238 -0
- package/src/internal/mnemonic.ts +99 -0
- package/src/internal/passkey/BrowserProvider.ts +131 -0
- package/src/internal/passkey/Passkey.ts +408 -0
- package/src/internal/passkey/SoftwareProvider.ts +90 -0
- package/src/lifecycle/Evidence.ts +85 -0
- package/src/lifecycle/EvidenceGraphQL.ts +67 -0
- package/src/lifecycle/EvidenceGrpc.ts +47 -0
- package/src/lifecycle/Journal.ts +117 -0
- package/src/lifecycle/JournalEntry.ts +68 -0
- package/src/lifecycle/JournalKeyValueStore.ts +276 -0
- package/src/lifecycle/KeyValueStoreIndexedDb.ts +361 -0
- package/src/lifecycle/KeyValueStoreOpfs.ts +230 -0
- package/src/lifecycle/Lifecycle.ts +990 -0
- package/src/lifecycle/Outcome.ts +130 -0
- package/src/lifecycle/SenderLock.ts +73 -0
- package/src/lifecycle/SenderLockWebLocks.ts +136 -0
- package/src/lifecycle/SignedTransaction.ts +133 -0
- package/src/lifecycle/SubmitConfig.ts +77 -0
- package/src/lifecycle/index.ts +12 -0
- package/src/wallet/Features.ts +114 -0
- package/src/wallet/Wallet.ts +550 -0
- package/src/wallet/index.ts +5 -0
- package/src/zklogin/AddressSeed.ts +130 -0
- package/src/zklogin/Errors.ts +27 -0
- package/src/zklogin/Jwt.ts +186 -0
- package/src/zklogin/Nonce.ts +46 -0
- package/src/zklogin/Poseidon.ts +62 -0
- package/src/zklogin/PublicIdentifier.ts +111 -0
- package/src/zklogin/Signature.ts +88 -0
- package/src/zklogin/ZkLogin.ts +145 -0
- package/src/zklogin/ZkLoginAddress.ts +72 -0
- package/src/zklogin/ZkLoginVerifier.ts +37 -0
- package/src/zklogin/ZkLoginVerifierGrpc.ts +66 -0
- package/src/zklogin/index.ts +16 -0
- package/src/zklogin/internal/parse.ts +30 -0
- package/src/zklogin/internal/poseidon.ts +47 -0
package/src/Mnemonic.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BIP39 mnemonics and Sui's key derivation paths, matching the Sui CLI,
|
|
3
|
+
* wallets and `@mysten/sui`.
|
|
4
|
+
*
|
|
5
|
+
* | Scheme | Derivation | Path | Module |
|
|
6
|
+
* |-----------|-------------|----------------------------------|------------|
|
|
7
|
+
* | Ed25519 | SLIP-0010 | `m/44'/784'/{a}'/{c}'/{i}'` | `Mnemonic` |
|
|
8
|
+
* | Secp256k1 | BIP32 | `m/54'/784'/{a}'/{c}/{i}` | `Bip32` |
|
|
9
|
+
* | Secp256r1 | BIP32 | `m/74'/784'/{a}'/{c}/{i}` | `Bip32` |
|
|
10
|
+
* | ML-DSA-65 | SLIP-0010 | `m/94'/784'/{a}'/{c}'/{i}'` | `Mnemonic` |
|
|
11
|
+
*
|
|
12
|
+
* This module never imports `@scure/bip32`, so Ed25519 or ML-DSA-65 use alone
|
|
13
|
+
* doesn't load it; the Secp256k1/r1 derivations are in `Bip32`. The package
|
|
14
|
+
* root re-exports both.
|
|
15
|
+
*
|
|
16
|
+
* Every function answers 32-byte secret keys, so this package doesn't depend on
|
|
17
|
+
* the scheme packages; compose with theirs:
|
|
18
|
+
*
|
|
19
|
+
* const m = yield* Mnemonic.generate()
|
|
20
|
+
* const signer = yield* Mnemonic.ed25519Signer(m) // Ed25519 is core
|
|
21
|
+
* const k1 = yield* Secp256k1.fromSecretKey(yield* Bip32.secp256k1SecretKey(m, { account: 1 }))
|
|
22
|
+
*
|
|
23
|
+
* Derivation takes the mnemonic or its seed (`toSeed`); pass the seed when
|
|
24
|
+
* deriving many keys, since every mnemonic -> seed is 2048 rounds of PBKDF2.
|
|
25
|
+
*/
|
|
26
|
+
import { hmac } from "@noble/hashes/hmac.js"
|
|
27
|
+
import { sha512 } from "@noble/hashes/sha2.js"
|
|
28
|
+
import { generateMnemonic, validateMnemonic } from "@scure/bip39"
|
|
29
|
+
import { wordlist } from "@scure/bip39/wordlists/english.js"
|
|
30
|
+
import * as Ed25519 from "./Ed25519.ts"
|
|
31
|
+
import type * as Signer from "./Signer.ts"
|
|
32
|
+
import * as Effect from "effect/Effect"
|
|
33
|
+
import {
|
|
34
|
+
type Derived,
|
|
35
|
+
ED25519,
|
|
36
|
+
format,
|
|
37
|
+
HARDENED,
|
|
38
|
+
type InvalidMnemonic,
|
|
39
|
+
type InvalidPath,
|
|
40
|
+
MLDSA65,
|
|
41
|
+
normalize,
|
|
42
|
+
type Path,
|
|
43
|
+
type PathIndex,
|
|
44
|
+
resolve,
|
|
45
|
+
type Rule,
|
|
46
|
+
SECP256K1,
|
|
47
|
+
SECP256R1,
|
|
48
|
+
seedOf,
|
|
49
|
+
type Source
|
|
50
|
+
} from "./internal/mnemonic.ts"
|
|
51
|
+
|
|
52
|
+
export { InvalidMnemonic, InvalidPath, normalize, parse, type Path, type PathIndex, type Source, toSeed } from "./internal/mnemonic.ts"
|
|
53
|
+
|
|
54
|
+
// -----------------------------------------------------------------------------
|
|
55
|
+
// Mnemonics
|
|
56
|
+
// -----------------------------------------------------------------------------
|
|
57
|
+
|
|
58
|
+
export type WordCount = 12 | 15 | 18 | 21 | 24
|
|
59
|
+
|
|
60
|
+
/** A fresh English mnemonic (12 words by default, as the Sui CLI does). */
|
|
61
|
+
export const generate = (words: WordCount = 12): Effect.Effect<string> =>
|
|
62
|
+
Effect.sync(() => generateMnemonic(wordlist, (words / 3) * 32))
|
|
63
|
+
|
|
64
|
+
/** Whether a mnemonic (after `normalize`) has valid English words and checksum. */
|
|
65
|
+
export const isValid = (mnemonic: string): boolean => validateMnemonic(normalize(mnemonic), wordlist)
|
|
66
|
+
|
|
67
|
+
// -----------------------------------------------------------------------------
|
|
68
|
+
// Paths
|
|
69
|
+
// -----------------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
export const ed25519Path = (i: PathIndex = {}): string => format(ED25519, i)
|
|
72
|
+
export const secp256k1Path = (i: PathIndex = {}): string => format(SECP256K1, i)
|
|
73
|
+
export const secp256r1Path = (i: PathIndex = {}): string => format(SECP256R1, i)
|
|
74
|
+
export const mldsa65Path = (i: PathIndex = {}): string => format(MLDSA65, i)
|
|
75
|
+
|
|
76
|
+
// -----------------------------------------------------------------------------
|
|
77
|
+
// Derivation (SLIP-0010)
|
|
78
|
+
// -----------------------------------------------------------------------------
|
|
79
|
+
|
|
80
|
+
/** SLIP-0010, hardened only: the node secret is the key (Ed25519 seed, FIPS 204 keygen seed). */
|
|
81
|
+
const slip10 = (curve: string, seed: Uint8Array, indices: ReadonlyArray<number>): Uint8Array => {
|
|
82
|
+
let I = hmac(sha512, new TextEncoder().encode(curve), seed)
|
|
83
|
+
for (const index of indices) {
|
|
84
|
+
const data = new Uint8Array(37)
|
|
85
|
+
data.set(I.subarray(0, 32), 1)
|
|
86
|
+
new DataView(data.buffer).setUint32(33, (index | HARDENED) >>> 0)
|
|
87
|
+
const next = hmac(sha512, I.subarray(32), data)
|
|
88
|
+
I.fill(0)
|
|
89
|
+
data.fill(0)
|
|
90
|
+
I = next
|
|
91
|
+
}
|
|
92
|
+
const key = I.slice(0, 32)
|
|
93
|
+
I.fill(0)
|
|
94
|
+
return key
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const deriveSlip10 = (rule: Rule, curve: string, source: Source, path: Path | undefined): Derived =>
|
|
98
|
+
Effect.flatMap(resolve(rule, path), ({ indices }) =>
|
|
99
|
+
Effect.flatMap(seedOf(source), (seed) => Effect.sync(() => slip10(curve, seed, indices))))
|
|
100
|
+
|
|
101
|
+
/** The Ed25519 secret key at a path (default `m/44'/784'/0'/0'/0'`). */
|
|
102
|
+
export const ed25519SecretKey = (source: Source, path?: Path): Derived => deriveSlip10(ED25519, "ed25519 seed", source, path)
|
|
103
|
+
|
|
104
|
+
/** The ML-DSA-65 secret key (keygen seed) at a path (default `m/94'/784'/0'/0'/0'`). Use with `MlDsa65.fromSecretKey`. */
|
|
105
|
+
export const mldsa65SecretKey = (source: Source, path?: Path): Derived => deriveSlip10(MLDSA65, "ML-DSA-65 seed", source, path)
|
|
106
|
+
|
|
107
|
+
/** An Ed25519 signer at a path (default `m/44'/784'/0'/0'/0'`). */
|
|
108
|
+
export const ed25519Signer = (source: Source, path?: Path): Effect.Effect<Signer.Signer, InvalidMnemonic | InvalidPath> =>
|
|
109
|
+
Effect.flatMap(ed25519SecretKey(source, path), (sk) => Effect.orDie(Ed25519.fromSecretKey(sk)))
|
package/src/Move.ts
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime support for Move bindings generated by `@unconfirmed/effect-sui-codegen`,
|
|
3
|
+
* also usable by hand.
|
|
4
|
+
*
|
|
5
|
+
* - Built-in BCS schemas for well-known framework types (`UID`, `Coin`,
|
|
6
|
+
* `Balance`, `Table`, `VecMap`, ...). Generated code refers to these instead
|
|
7
|
+
* of regenerating the framework in every project.
|
|
8
|
+
* - Argument helpers that turn plain TS values (or `Ptb` arguments) into
|
|
9
|
+
* inputs: `obj`, `pure`, `option`, `param` (a generic `T`), and the
|
|
10
|
+
* auto-filled system objects (`clock`, `random`, `denyList`, `system`,
|
|
11
|
+
* `accumulatorRoot`), which match what `@mysten/sui` fills in.
|
|
12
|
+
* - `call`: one Move call against a package id held in a `Context.Reference`.
|
|
13
|
+
* - `type`: a datatype's type string, built from its defining package: a
|
|
14
|
+
* fixed address (framework packages) or a package's `Origins` reference, so
|
|
15
|
+
* it follows the deployment provided at run time.
|
|
16
|
+
* - `datatype` / `object` / `generic` / `genericObject`: attach the type
|
|
17
|
+
* string (and, for `key` structs, a `get` that reads the object, checks its
|
|
18
|
+
* type and decodes it) to a schema.
|
|
19
|
+
*
|
|
20
|
+
* Nothing here reflects over Move metadata at runtime: the generator emits the
|
|
21
|
+
* schemas and argument kinds; these helpers only do the plumbing.
|
|
22
|
+
*/
|
|
23
|
+
import type * as Context from "effect/Context"
|
|
24
|
+
import * as Effect from "effect/Effect"
|
|
25
|
+
import * as Option from "effect/Option"
|
|
26
|
+
import * as Schema from "effect/Schema"
|
|
27
|
+
import * as Bcs from "@unconfirmed/effect-bcs/Bcs"
|
|
28
|
+
import * as Address from "./Address.ts"
|
|
29
|
+
import * as Objects from "./Objects.ts"
|
|
30
|
+
import * as Ptb from "./Ptb.ts"
|
|
31
|
+
import type { RpcError } from "./RpcError.ts"
|
|
32
|
+
import type * as T from "./TransactionData.ts"
|
|
33
|
+
import * as TypeTag from "./TypeTag.ts"
|
|
34
|
+
|
|
35
|
+
// -----------------------------------------------------------------------------
|
|
36
|
+
// Well-known framework types
|
|
37
|
+
// -----------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
/** `0x2::object::UID`, flattened to its address. */
|
|
40
|
+
export const UID = Bcs.Address
|
|
41
|
+
/** `0x2::object::ID`, flattened to its address. */
|
|
42
|
+
export const ID = Bcs.Address
|
|
43
|
+
/** `0x1::type_name::TypeName`. */
|
|
44
|
+
export const TypeName = /* @__PURE__ */ Bcs.struct({ name: Bcs.string })
|
|
45
|
+
/** `0x2::url::Url`. */
|
|
46
|
+
export const Url = /* @__PURE__ */ Bcs.struct({ url: Bcs.string })
|
|
47
|
+
/** `0x2::balance::Balance<phantom T>`. */
|
|
48
|
+
export const Balance = /* @__PURE__ */ Bcs.struct({ value: Bcs.u64 })
|
|
49
|
+
/** `0x2::coin::Coin<phantom T>`. */
|
|
50
|
+
export const Coin = /* @__PURE__ */ Bcs.struct({ id: UID, balance: Balance })
|
|
51
|
+
/** `0x2::table::Table<phantom K, phantom V>`: a handle; entries are dynamic fields of `id`. */
|
|
52
|
+
export const Table = /* @__PURE__ */ Bcs.struct({ id: UID, size: Bcs.u64 })
|
|
53
|
+
/** `0x2::bag::Bag`. */
|
|
54
|
+
export const Bag = Table
|
|
55
|
+
/** `0x2::object_table::ObjectTable<phantom K, phantom V>`. */
|
|
56
|
+
export const ObjectTable = Table
|
|
57
|
+
/** `0x2::object_bag::ObjectBag`. */
|
|
58
|
+
export const ObjectBag = Table
|
|
59
|
+
/** `0x2::table_vec::TableVec<phantom E>`. */
|
|
60
|
+
export const TableVec = /* @__PURE__ */ Bcs.struct({ contents: Table })
|
|
61
|
+
/** `0x2::vec_map::VecMap<K, V>`. */
|
|
62
|
+
export const VecMap = <K extends Schema.Top, V extends Schema.Top>(K: K, V: V) =>
|
|
63
|
+
Bcs.struct({ contents: Bcs.vector(Bcs.struct({ key: K, value: V })) })
|
|
64
|
+
/** `0x2::vec_set::VecSet<K>`. */
|
|
65
|
+
export const VecSet = <K extends Schema.Top>(K: K) => Bcs.struct({ contents: Bcs.vector(K) })
|
|
66
|
+
/** `0x2::linked_table::LinkedTable<K, phantom V>`. */
|
|
67
|
+
export const LinkedTable = <K extends Schema.Top>(K: K) =>
|
|
68
|
+
Bcs.struct({ id: UID, size: Bcs.u64, head: Bcs.option(K), tail: Bcs.option(K) })
|
|
69
|
+
/** `0x2::borrow::Referent<T: key + store>`. */
|
|
70
|
+
export const Referent = <T extends Schema.Top>(T: T) => Bcs.struct({ id: Bcs.Address, value: Bcs.option(T) })
|
|
71
|
+
/** `0x2::dynamic_field::Field<N, V>`. */
|
|
72
|
+
export const Field = <N extends Schema.Top, V extends Schema.Top>(N: N, V: V) =>
|
|
73
|
+
Bcs.struct({ id: UID, name: N, value: V })
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* An address as a pure argument: any `0x` hex (`"0x2"` included), normalized
|
|
77
|
+
* when encoded. Invalid hex is a typed `InvalidPureValue`.
|
|
78
|
+
*/
|
|
79
|
+
export const address: Bcs.BcsSchema<string, string> = /* @__PURE__ */ Bcs.transform(
|
|
80
|
+
Bcs.Address,
|
|
81
|
+
/* @__PURE__ */ Schema.String.check(/* @__PURE__ */ Schema.isPattern(/^(0x|0X)?[0-9a-fA-F]{1,64}$/)),
|
|
82
|
+
{ decode: (a) => a, encode: (s) => Address.normalize(s) }
|
|
83
|
+
) as any
|
|
84
|
+
|
|
85
|
+
// -----------------------------------------------------------------------------
|
|
86
|
+
// Type strings and object reads
|
|
87
|
+
// -----------------------------------------------------------------------------
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Where a package's datatypes are defined on one deployment: its original
|
|
91
|
+
* (first published) id, and the defining ids of datatypes added by upgrades.
|
|
92
|
+
*/
|
|
93
|
+
export interface Origins {
|
|
94
|
+
readonly originalId: string
|
|
95
|
+
/** `{ "module::Type": id }` for datatypes an upgrade added; the others use `originalId`. */
|
|
96
|
+
readonly typeOrigins?: Readonly<Record<string, string>> | undefined
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** A datatype's defining package: a fixed address (framework packages) or a package's `Origins` reference. */
|
|
100
|
+
export type Defining = string | Context.Reference<Origins>
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* A datatype's Move type string from its type arguments (all of them, phantom
|
|
104
|
+
* ones included): `yield* Pair.type("0x2::sui::SUI", "u8", "u64")`. The address
|
|
105
|
+
* comes from the package's `Origins` reference, so it is the deployment's
|
|
106
|
+
* provided at run time (by default the one the bindings were generated from).
|
|
107
|
+
*/
|
|
108
|
+
export interface TypeFn<P extends ReadonlyArray<string> = readonly []> {
|
|
109
|
+
(...typeArguments: P): Effect.Effect<string>
|
|
110
|
+
/** `module::Name`. */
|
|
111
|
+
readonly path: string
|
|
112
|
+
/** The type without type arguments: as a filter, it matches every instantiation. */
|
|
113
|
+
readonly base: Effect.Effect<string>
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** The type string of the datatype `path` (`module::Name`) defined by `defining`. */
|
|
117
|
+
export const type = <P extends ReadonlyArray<string> = readonly []>(defining: Defining, path: string): TypeFn<P> => {
|
|
118
|
+
const base = typeof defining === "string"
|
|
119
|
+
? Effect.sync(() => `${Address.normalize(defining)}::${path}`)
|
|
120
|
+
: Effect.map(defining, (o) => `${Address.normalize(o.typeOrigins?.[path] ?? o.originalId)}::${path}`)
|
|
121
|
+
const fn = (...typeArguments: P) =>
|
|
122
|
+
typeArguments.length === 0 ? base : Effect.map(base, (b) => `${b}<${typeArguments.join(", ")}>`)
|
|
123
|
+
return Object.assign(fn, { path, base })
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* `Thing.get(objectId)`: read an object, check its type, decode it. Without
|
|
128
|
+
* type arguments any instantiation of a generic type matches; with them (all
|
|
129
|
+
* of them, phantom ones included), only that instantiation.
|
|
130
|
+
*/
|
|
131
|
+
export type Get<A, P extends ReadonlyArray<string> = readonly []> = (
|
|
132
|
+
objectId: string,
|
|
133
|
+
...typeArguments: P | readonly []
|
|
134
|
+
) => Effect.Effect<
|
|
135
|
+
A,
|
|
136
|
+
Objects.ObjectNotFound | Objects.ObjectTypeMismatch | Objects.ObjectDecodeError | RpcError,
|
|
137
|
+
Objects.Objects
|
|
138
|
+
>
|
|
139
|
+
|
|
140
|
+
/** Read an object, check its type against `type` and decode it (`Objects.getAs`), with a lenient id. */
|
|
141
|
+
export const get = <A, E>(objectId: string, schema: Schema.Codec<A, E>, type: string) =>
|
|
142
|
+
Effect.suspend(() => Objects.getAs(Address.normalize(objectId), schema, { type }))
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* A datatype schema with its Move type string: `Status.type()`. The schema is
|
|
146
|
+
* built by a thunk so that, under `/* @__PURE__ *\/`, an unused datatype is
|
|
147
|
+
* dropped whole by every bundler (esbuild keeps unannotated nested calls).
|
|
148
|
+
*/
|
|
149
|
+
export const datatype = <P extends ReadonlyArray<string>, S extends Schema.Top>(
|
|
150
|
+
type: TypeFn<P>,
|
|
151
|
+
schema: () => S
|
|
152
|
+
): S & { readonly type: TypeFn<P> } => Object.assign(copy(schema()), { type })
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* A shallow copy of a schema (same prototype, same AST), so attaching `type` or
|
|
156
|
+
* `get` never rewrites a schema shared elsewhere (`Move.Table` is also `Bag`).
|
|
157
|
+
*/
|
|
158
|
+
const copy = <S extends Schema.Top>(schema: S): S => Object.assign(Object.create(Object.getPrototypeOf(schema)), schema)
|
|
159
|
+
|
|
160
|
+
/** Attach `get` for objects of type `type` to a `key` struct's schema (a copy; the given schema is unchanged). */
|
|
161
|
+
export const withGet = <P extends ReadonlyArray<string>, S extends Schema.Top>(
|
|
162
|
+
type: TypeFn<P>,
|
|
163
|
+
schema: S
|
|
164
|
+
): S & { readonly get: Get<S["Type"], P> } => {
|
|
165
|
+
const codec = schema as unknown as Schema.Codec<S["Type"]>
|
|
166
|
+
const getter = (objectId: string, ...typeArguments: P | readonly []) =>
|
|
167
|
+
Effect.flatMap(typeArguments.length === 0 ? type.base : type(...(typeArguments as P)), (t) => get(objectId, codec, t))
|
|
168
|
+
return Object.assign(copy(schema), { get: getter })
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** A `key` struct: `Thing.type()` and `Thing.get(objectId)`. */
|
|
172
|
+
export const object = <P extends ReadonlyArray<string>, S extends Schema.Top>(
|
|
173
|
+
type: TypeFn<P>,
|
|
174
|
+
schema: () => S
|
|
175
|
+
): S & { readonly type: TypeFn<P>; readonly get: Get<S["Type"], P> } => datatype(type, () => withGet(type, schema()))
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* A generic datatype: a function of its non-phantom type parameters' schemas,
|
|
179
|
+
* plus `type(...allTypeArguments)`.
|
|
180
|
+
*/
|
|
181
|
+
export const generic = <P extends ReadonlyArray<string>, Make extends (...schemas: ReadonlyArray<any>) => Schema.Top>(
|
|
182
|
+
type: TypeFn<P>,
|
|
183
|
+
make: Make
|
|
184
|
+
): Make & { readonly type: TypeFn<P> } => Object.assign(((...schemas: ReadonlyArray<any>) => make(...schemas)) as Make, { type })
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* A generic `key` struct: as `generic`, and each instantiation has
|
|
188
|
+
* `get(objectId, ...typeArguments)`. `make` is handed the `withGet` to wrap
|
|
189
|
+
* its schema in, so its own generic signature is kept.
|
|
190
|
+
*/
|
|
191
|
+
export const genericObject = <P extends ReadonlyArray<string>, Make extends (...schemas: ReadonlyArray<any>) => Schema.Top>(
|
|
192
|
+
type: TypeFn<P>,
|
|
193
|
+
make: (withGet: <S extends Schema.Top>(schema: S) => S & { readonly get: Get<S["Type"], P> }) => Make
|
|
194
|
+
): Make & { readonly type: TypeFn<P> } => {
|
|
195
|
+
let built: Make | undefined
|
|
196
|
+
return generic(type, ((...schemas: ReadonlyArray<any>) => (built ??= make((schema) => withGet(type, schema)))(...schemas)) as Make)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
/** The decoded type of a schema: `Move.TypeOf<typeof Pair<Schema.Codec<number>, ...>>`. */
|
|
201
|
+
export type TypeOf<F> = F extends (...args: ReadonlyArray<any>) => infer S ? S extends Schema.Top ? S["Type"] : never
|
|
202
|
+
: F extends Schema.Top ? F["Type"]
|
|
203
|
+
: never
|
|
204
|
+
|
|
205
|
+
// -----------------------------------------------------------------------------
|
|
206
|
+
// Arguments
|
|
207
|
+
// -----------------------------------------------------------------------------
|
|
208
|
+
|
|
209
|
+
export type Argument = T.Argument
|
|
210
|
+
|
|
211
|
+
/** A shared object whose initial shared version is known: no lookup, and the input is added in parameter order. */
|
|
212
|
+
export interface SharedRef {
|
|
213
|
+
readonly objectId: string
|
|
214
|
+
readonly initialSharedVersion: bigint
|
|
215
|
+
readonly mutable: boolean
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* An object parameter:
|
|
220
|
+
* - an object id (the resolver looks it up);
|
|
221
|
+
* - a `SharedRef` (`{ objectId, initialSharedVersion, mutable }`) or an owned
|
|
222
|
+
* `Ptb.ObjectReference` (`{ objectId, version, digest }`), used as given;
|
|
223
|
+
* - an argument (an earlier result, an input already added);
|
|
224
|
+
* - an unrun step that makes the argument (`Ptb.receiving(ref)`,
|
|
225
|
+
* `Ptb.sharedObject(...)`, `Ptb.object(id, { mutable })`).
|
|
226
|
+
*
|
|
227
|
+
* Everything but an argument becomes an input when the call adds its
|
|
228
|
+
* arguments, in parameter order, so the inputs line up as `@mysten/sui` adds
|
|
229
|
+
* them for the same call. Inputs are deduplicated by object id.
|
|
230
|
+
*/
|
|
231
|
+
export type ObjectInput =
|
|
232
|
+
| string
|
|
233
|
+
| Argument
|
|
234
|
+
| SharedRef
|
|
235
|
+
| Ptb.ObjectReference
|
|
236
|
+
| Effect.Effect<Argument, Ptb.InvalidPureValue, Ptb.PtbBuilder>
|
|
237
|
+
|
|
238
|
+
/** A pure parameter: the plain value, or an argument. */
|
|
239
|
+
export type Input<V> = V | Argument
|
|
240
|
+
|
|
241
|
+
/** An `Option<T>` parameter: an `Option`, a bare value (`Some`), `undefined` (`None`), or an argument. */
|
|
242
|
+
export type OptionInput<V> = Option.Option<V> | V | undefined | Argument
|
|
243
|
+
|
|
244
|
+
/** A value for a generic `T` parameter: encoded by the type argument when it's pure, else an object (`ObjectInput`). */
|
|
245
|
+
export type GenericInput =
|
|
246
|
+
| ObjectInput
|
|
247
|
+
| string
|
|
248
|
+
| number
|
|
249
|
+
| bigint
|
|
250
|
+
| boolean
|
|
251
|
+
| Uint8Array
|
|
252
|
+
| ReadonlyArray<unknown>
|
|
253
|
+
| Option.Option<unknown>
|
|
254
|
+
| undefined
|
|
255
|
+
|
|
256
|
+
type Arg<E = never> = Effect.Effect<Argument, E, Ptb.PtbBuilder>
|
|
257
|
+
|
|
258
|
+
const ARGUMENT_TAGS = new Set(["GasCoin", "Input", "Result", "NestedResult"])
|
|
259
|
+
|
|
260
|
+
export const isArgument = (u: unknown): u is Argument =>
|
|
261
|
+
typeof u === "object" && u !== null && !Array.isArray(u) && ARGUMENT_TAGS.has((u as { _tag?: unknown })._tag as string)
|
|
262
|
+
|
|
263
|
+
/** Pick the positional or named form of `arguments`. */
|
|
264
|
+
export const isTuple = <A>(a: A): a is Extract<A, ReadonlyArray<unknown>> => Array.isArray(a)
|
|
265
|
+
|
|
266
|
+
/** An object parameter (`ObjectInput`). An id becomes an object input the resolver looks up. */
|
|
267
|
+
export const obj = (input: ObjectInput): Arg<Ptb.InvalidPureValue> =>
|
|
268
|
+
typeof input === "string"
|
|
269
|
+
? Ptb.object(input)
|
|
270
|
+
: Effect.isEffect(input)
|
|
271
|
+
? input
|
|
272
|
+
: isArgument(input)
|
|
273
|
+
? Effect.succeed(input)
|
|
274
|
+
: "initialSharedVersion" in input
|
|
275
|
+
? Ptb.sharedObject(input.objectId, input.initialSharedVersion, input.mutable)
|
|
276
|
+
: Ptb.owned(input)
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* A struct or enum parameter that is neither an object nor pure (`Data`,
|
|
280
|
+
* `vector<Data>`, `Option<Data>`): an argument, such as an earlier result.
|
|
281
|
+
* Sui takes only primitives, strings, `ID`s and vectors and options of them as
|
|
282
|
+
* pure inputs, so such a value can't be passed as one.
|
|
283
|
+
*/
|
|
284
|
+
export const arg = (input: Argument): Arg<Ptb.InvalidPureValue> =>
|
|
285
|
+
isArgument(input)
|
|
286
|
+
? Effect.succeed(input)
|
|
287
|
+
: Effect.fail(new Ptb.InvalidPureValue({ issue: "expected an argument: a struct value comes from an earlier command" }))
|
|
288
|
+
|
|
289
|
+
/** A pure parameter, encoded by its schema. */
|
|
290
|
+
export const pure = <A, E>(schema: Schema.Codec<A, E>, input: A | Argument): Arg<Ptb.InvalidPureValue> =>
|
|
291
|
+
isArgument(input) ? Effect.succeed(input) : Ptb.pure(schema, input)
|
|
292
|
+
|
|
293
|
+
/** An `Option<T>` parameter. */
|
|
294
|
+
export const option = <A, E>(item: Schema.Codec<A, E>, input: OptionInput<A>): Arg<Ptb.InvalidPureValue> =>
|
|
295
|
+
isArgument(input)
|
|
296
|
+
? Effect.succeed(input)
|
|
297
|
+
: Ptb.pure(
|
|
298
|
+
Bcs.option(item) as unknown as Schema.Codec<Option.Option<A>>,
|
|
299
|
+
Option.isOption(input) ? input as Option.Option<A> : input === undefined ? Option.none() : Option.some(input as A)
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
type PureStruct = (args: ReadonlyArray<TypeTag.TypeTag>) => Schema.Top | undefined
|
|
303
|
+
|
|
304
|
+
/** Pure struct types by full name, built on first use so an unused `Move` import costs nothing at load. */
|
|
305
|
+
let pureStructs: Record<string, PureStruct> | undefined
|
|
306
|
+
const PURE_STRUCTS = (): Record<string, PureStruct> => pureStructs ??= {
|
|
307
|
+
[`${Address.normalize("0x1")}::string::String`]: () => Bcs.string,
|
|
308
|
+
[`${Address.normalize("0x1")}::ascii::String`]: () => Bcs.string,
|
|
309
|
+
[`${Address.normalize("0x2")}::object::ID`]: () => address,
|
|
310
|
+
[`${Address.normalize("0x1")}::option::Option`]: ([inner]) => {
|
|
311
|
+
const s = inner === undefined ? undefined : pureSchemaOf(inner)
|
|
312
|
+
return s === undefined ? undefined : Bcs.option(s)
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** The BCS schema of a pure type tag (`u64`, `vector<address>`, `0x1::string::String`, ...), or `undefined`. */
|
|
317
|
+
export const pureSchemaOf = (tag: TypeTag.TypeTag): Schema.Top | undefined => {
|
|
318
|
+
switch (tag._tag) {
|
|
319
|
+
case "bool":
|
|
320
|
+
return Bcs.bool
|
|
321
|
+
case "u8":
|
|
322
|
+
return Bcs.u8
|
|
323
|
+
case "u16":
|
|
324
|
+
return Bcs.u16
|
|
325
|
+
case "u32":
|
|
326
|
+
return Bcs.u32
|
|
327
|
+
case "u64":
|
|
328
|
+
return Bcs.u64
|
|
329
|
+
case "u128":
|
|
330
|
+
return Bcs.u128
|
|
331
|
+
case "u256":
|
|
332
|
+
return Bcs.u256
|
|
333
|
+
case "address":
|
|
334
|
+
return address
|
|
335
|
+
case "signer":
|
|
336
|
+
return undefined
|
|
337
|
+
case "vector": {
|
|
338
|
+
if (tag.value._tag === "u8") return Bcs.byteVector
|
|
339
|
+
const item = pureSchemaOf(tag.value)
|
|
340
|
+
return item === undefined ? undefined : Bcs.vector(item)
|
|
341
|
+
}
|
|
342
|
+
case "struct":
|
|
343
|
+
return PURE_STRUCTS()[`${tag.address}::${tag.module}::${tag.name}`]?.(tag.typeParams)
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* A parameter typed by a function type parameter: pure when its type argument
|
|
349
|
+
* is (`u64`, `vector<u8>`, `0x1::string::String`, `Option<...>`), else an object.
|
|
350
|
+
*/
|
|
351
|
+
export const param = (typeArgument: string, input: GenericInput): Arg<Ptb.InvalidPureValue> =>
|
|
352
|
+
Effect.suspend(() => {
|
|
353
|
+
if (isArgument(input)) return Effect.succeed(input)
|
|
354
|
+
if (Effect.isEffect(input) || (typeof input === "object" && input !== null && "objectId" in input)) {
|
|
355
|
+
return obj(input as ObjectInput)
|
|
356
|
+
}
|
|
357
|
+
let tag: TypeTag.TypeTag
|
|
358
|
+
try {
|
|
359
|
+
tag = TypeTag.parse(typeArgument)
|
|
360
|
+
} catch (e) {
|
|
361
|
+
return Effect.fail(new Ptb.InvalidPureValue({ issue: e instanceof Error ? e.message : String(e) }))
|
|
362
|
+
}
|
|
363
|
+
const schema = pureSchemaOf(tag)
|
|
364
|
+
if (schema !== undefined) {
|
|
365
|
+
const isOption = schema !== undefined && Bcs.layoutOf(schema)._tag === "option"
|
|
366
|
+
const value = isOption && !Option.isOption(input)
|
|
367
|
+
? input === undefined ? Option.none() : Option.some(input)
|
|
368
|
+
: input
|
|
369
|
+
return Ptb.pure(schema as unknown as Schema.Codec<unknown>, value)
|
|
370
|
+
}
|
|
371
|
+
if (typeof input === "string") return Ptb.object(input)
|
|
372
|
+
return Effect.fail(new Ptb.InvalidPureValue({ issue: `expected an object id or an argument for ${typeArgument}` }))
|
|
373
|
+
})
|
|
374
|
+
|
|
375
|
+
// -----------------------------------------------------------------------------
|
|
376
|
+
// Auto-filled system objects (as `@mysten/sui`'s `tx.object.clock()` etc.)
|
|
377
|
+
// -----------------------------------------------------------------------------
|
|
378
|
+
|
|
379
|
+
const CLOCK = Address.CLOCK
|
|
380
|
+
const RANDOM = Address.RANDOM
|
|
381
|
+
const SYSTEM_STATE = /* @__PURE__ */ Address.normalize("0x5")
|
|
382
|
+
const DENY_LIST = /* @__PURE__ */ Address.normalize("0x403")
|
|
383
|
+
const ACCUMULATOR_ROOT = /* @__PURE__ */ Address.normalize("0xacc")
|
|
384
|
+
|
|
385
|
+
/** A shared object whose initial shared version is known, deduplicated by id like `Ptb.object`. */
|
|
386
|
+
export const shared = (objectId: string, initialSharedVersion: bigint, mutable: boolean): Arg<Ptb.InvalidPureValue> =>
|
|
387
|
+
Ptb.sharedObject(objectId, initialSharedVersion, mutable)
|
|
388
|
+
|
|
389
|
+
/** `&Clock` (0x6): shared, initial version 1, immutable. */
|
|
390
|
+
export const clock = (input?: ObjectInput): Arg<Ptb.InvalidPureValue> => input === undefined ? shared(CLOCK, 1n, false) : obj(input)
|
|
391
|
+
|
|
392
|
+
/** `&Random` (0x8): immutable; its initial version is looked up. */
|
|
393
|
+
export const random = (input?: ObjectInput): Arg<Ptb.InvalidPureValue> =>
|
|
394
|
+
input === undefined ? Ptb.object(RANDOM, { mutable: false }) : obj(input)
|
|
395
|
+
|
|
396
|
+
/** `&DenyList` / `&mut DenyList` (0x403): mutability from the function signature. */
|
|
397
|
+
export const denyList = (input?: ObjectInput): Arg<Ptb.InvalidPureValue> => input === undefined ? Ptb.object(DENY_LIST) : obj(input)
|
|
398
|
+
|
|
399
|
+
/** `&SuiSystemState` / `&mut SuiSystemState` (0x5): shared, initial version 1. */
|
|
400
|
+
export const system = (mutable: boolean, input?: ObjectInput): Arg<Ptb.InvalidPureValue> =>
|
|
401
|
+
input === undefined ? shared(SYSTEM_STATE, 1n, mutable) : obj(input)
|
|
402
|
+
|
|
403
|
+
/** `&AccumulatorRoot` (0xacc). */
|
|
404
|
+
export const accumulatorRoot = (input?: ObjectInput): Arg<Ptb.InvalidPureValue> =>
|
|
405
|
+
input === undefined ? Ptb.object(ACCUMULATOR_ROOT) : obj(input)
|
|
406
|
+
|
|
407
|
+
// -----------------------------------------------------------------------------
|
|
408
|
+
// Calls
|
|
409
|
+
// -----------------------------------------------------------------------------
|
|
410
|
+
|
|
411
|
+
/** A tuple of `N` arguments: the results of a Move call that returns `N` values. */
|
|
412
|
+
export type Results<N extends number, Acc extends ReadonlyArray<Argument> = readonly []> = Acc["length"] extends N
|
|
413
|
+
? Acc
|
|
414
|
+
: Results<N, readonly [...Acc, Argument]>
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* `<package>::<target>` with arguments added in parameter order. The package id
|
|
418
|
+
* comes from `pkg` (a `Context.Reference`, so it needs nothing in `R`). The
|
|
419
|
+
* results are one per Move return value: the command's `Result` when it
|
|
420
|
+
* returns one (as `Ptb.moveCall` and `@mysten/sui`'s result used directly),
|
|
421
|
+
* else a `NestedResult` each.
|
|
422
|
+
*/
|
|
423
|
+
export const call = <const N extends number, E = never>(
|
|
424
|
+
pkg: Context.Reference<string>,
|
|
425
|
+
target: `${string}::${string}`,
|
|
426
|
+
typeArguments: ReadonlyArray<string>,
|
|
427
|
+
args: ReadonlyArray<Effect.Effect<Argument, E, Ptb.PtbBuilder>>,
|
|
428
|
+
returns: N
|
|
429
|
+
): Effect.Effect<Results<N>, E | Ptb.InvalidPureValue, Ptb.PtbBuilder> =>
|
|
430
|
+
Effect.gen(function*() {
|
|
431
|
+
const id = yield* pkg
|
|
432
|
+
const resolved: Array<Argument> = []
|
|
433
|
+
for (const a of args) resolved.push(yield* a)
|
|
434
|
+
const result = yield* Ptb.moveCall({
|
|
435
|
+
target: `${id}::${target}` as `${string}::${string}::${string}`,
|
|
436
|
+
typeArguments,
|
|
437
|
+
arguments: resolved
|
|
438
|
+
})
|
|
439
|
+
return (returns === 1 ? [result] : Array.from({ length: returns }, (_, i) => Ptb.nested(result, i))) as unknown as Results<N>
|
|
440
|
+
})
|