@unconfirmed/effect-sui 0.0.0-stage → 0.1.1
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/Connection.d.ts +119 -0
- package/dist/wallet/Connection.d.ts.map +1 -0
- package/dist/wallet/Connection.js +197 -0
- package/dist/wallet/Connection.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 +7 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +7 -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/Connection.ts +323 -0
- package/src/wallet/Features.ts +114 -0
- package/src/wallet/Wallet.ts +550 -0
- package/src/wallet/index.ts +6 -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
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulating, executing and reading transactions.
|
|
3
|
+
*/
|
|
4
|
+
import * as Context from "effect/Context"
|
|
5
|
+
import * as Duration from "effect/Duration"
|
|
6
|
+
import * as Effect from "effect/Effect"
|
|
7
|
+
import * as Schedule from "effect/Schedule"
|
|
8
|
+
import * as Schema from "effect/Schema"
|
|
9
|
+
import type { Address } from "./Address.ts"
|
|
10
|
+
import type { TransactionEvent } from "./Events.ts"
|
|
11
|
+
import type { Owner } from "./Objects.ts"
|
|
12
|
+
import type { UnresolvedObject } from "./Ptb.ts"
|
|
13
|
+
import type { RpcError } from "./RpcError.ts"
|
|
14
|
+
import type { CallArg, Command, ObjectDigest, ObjectRef, TransactionExpiration } from "./TransactionData.ts"
|
|
15
|
+
|
|
16
|
+
export interface GasUsed {
|
|
17
|
+
readonly computationCost: bigint
|
|
18
|
+
readonly storageCost: bigint
|
|
19
|
+
readonly storageRebate: bigint
|
|
20
|
+
readonly nonRefundableStorageFee: bigint
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type Status =
|
|
24
|
+
| { readonly _tag: "Success" }
|
|
25
|
+
| {
|
|
26
|
+
readonly _tag: "Failure"
|
|
27
|
+
/** The node's description, e.g. `MoveAbort(...) in command 1`. */
|
|
28
|
+
readonly description: string
|
|
29
|
+
readonly command: number | undefined
|
|
30
|
+
readonly abortCode: bigint | undefined
|
|
31
|
+
/** Where a Move abort happened, when the transport reports it. */
|
|
32
|
+
readonly location?: AbortLocation
|
|
33
|
+
/** A clever error's decoded fields (`#[error] const E: vector<u8> = ...`), when the transport reports them. */
|
|
34
|
+
readonly cleverError?: CleverError
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface AbortLocation {
|
|
38
|
+
readonly package: Address
|
|
39
|
+
readonly module: string
|
|
40
|
+
readonly function: string | undefined
|
|
41
|
+
readonly instruction: number | undefined
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface CleverError {
|
|
45
|
+
readonly errorCode: bigint | undefined
|
|
46
|
+
readonly lineNumber: bigint | undefined
|
|
47
|
+
readonly constantName: string | undefined
|
|
48
|
+
readonly constantType: string | undefined
|
|
49
|
+
/** The constant's value rendered as text, when the node could render it. */
|
|
50
|
+
readonly rendered: string | undefined
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ChangedObject {
|
|
54
|
+
readonly objectId: Address
|
|
55
|
+
readonly type: string | undefined
|
|
56
|
+
readonly operation: "Created" | "Deleted" | "None"
|
|
57
|
+
readonly version: bigint | undefined
|
|
58
|
+
readonly digest: ObjectDigest | undefined
|
|
59
|
+
readonly owner: Owner | undefined
|
|
60
|
+
/** The object's state before the transaction; all `undefined` for objects that didn't exist. */
|
|
61
|
+
readonly inputVersion: bigint | undefined
|
|
62
|
+
readonly inputDigest: ObjectDigest | undefined
|
|
63
|
+
readonly inputOwner: Owner | undefined
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** A change in an owner's balance of one coin type, coins and address balance together. */
|
|
67
|
+
export interface BalanceChange {
|
|
68
|
+
readonly address: Address
|
|
69
|
+
/** The coin type, e.g. `0x…2::sui::SUI`. */
|
|
70
|
+
readonly coinType: string
|
|
71
|
+
/** Signed: negative when the balance went down. */
|
|
72
|
+
readonly amount: bigint
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface Effects {
|
|
76
|
+
readonly digest: string
|
|
77
|
+
readonly status: Status
|
|
78
|
+
readonly gasUsed: GasUsed
|
|
79
|
+
readonly changedObjects: ReadonlyArray<ChangedObject>
|
|
80
|
+
/**
|
|
81
|
+
* The checkpoint the transaction is in, and that checkpoint's timestamp.
|
|
82
|
+
* Set by `get`. `execute` answers before the transaction is checkpointed,
|
|
83
|
+
* so they are absent there (read it again with `waitFor` / `get`).
|
|
84
|
+
*/
|
|
85
|
+
readonly checkpoint?: bigint
|
|
86
|
+
readonly timestampMs?: bigint
|
|
87
|
+
/** Its events in emission order. Present (maybe empty) only when asked for with `include: ["events"]`. */
|
|
88
|
+
readonly events?: ReadonlyArray<TransactionEvent>
|
|
89
|
+
/** Present (maybe empty) only when asked for with `include: ["balanceChanges"]`. */
|
|
90
|
+
readonly balanceChanges?: ReadonlyArray<BalanceChange>
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Parts of `Effects` that make a larger response, read only on request. */
|
|
94
|
+
export type Include = "events" | "balanceChanges"
|
|
95
|
+
|
|
96
|
+
export interface IncludeOptions {
|
|
97
|
+
readonly include?: ReadonlyArray<Include>
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface Simulation {
|
|
101
|
+
readonly effects: Effects
|
|
102
|
+
/** Each command's return values, as BCS bytes. */
|
|
103
|
+
readonly returnValues: ReadonlyArray<ReadonlyArray<Uint8Array>>
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* A transaction for the node to complete in one simulation
|
|
108
|
+
* (`Transactions.resolve`): object inputs by id only, gas price, budget,
|
|
109
|
+
* payment and expiration left out unless the caller fixed them.
|
|
110
|
+
*/
|
|
111
|
+
export interface UnresolvedTransaction {
|
|
112
|
+
readonly sender: Address
|
|
113
|
+
readonly gasOwner: Address
|
|
114
|
+
readonly inputs: ReadonlyArray<CallArg | UnresolvedObject>
|
|
115
|
+
readonly commands: ReadonlyArray<Command>
|
|
116
|
+
readonly gasPrice?: bigint
|
|
117
|
+
readonly gasBudget?: bigint
|
|
118
|
+
readonly gasPayment?: ReadonlyArray<ObjectRef>
|
|
119
|
+
readonly expiration?: TransactionExpiration
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** What the node answered to `Transactions.resolve`. Unverified: `Resolve.server` checks it before use. */
|
|
123
|
+
export interface Resolution {
|
|
124
|
+
/** The completed transaction, as BCS `TransactionData`. */
|
|
125
|
+
readonly transaction: Uint8Array
|
|
126
|
+
/** The effects of simulating it (its digest is the completed transaction's). */
|
|
127
|
+
readonly effects: Effects
|
|
128
|
+
/** The epoch it was simulated in, when the transport reports it. */
|
|
129
|
+
readonly epoch: bigint | undefined
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export class TransactionNotFound extends /* @__PURE__ */ Schema.TaggedError<TransactionNotFound>()("TransactionNotFound", {
|
|
133
|
+
digest: Schema.String
|
|
134
|
+
}) {
|
|
135
|
+
override get message(): string {
|
|
136
|
+
return `transaction ${this.digest} not found`
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The node accepted the transaction but its answer can't be read as effects
|
|
142
|
+
* (no transaction, digest or status). It may well have executed: reconcile by
|
|
143
|
+
* `digest` (`Transactions.waitFor`) rather than treating it as a failure.
|
|
144
|
+
*/
|
|
145
|
+
export class ExecutedEffectsIncomplete extends /* @__PURE__ */ Schema.TaggedError<ExecutedEffectsIncomplete>()("ExecutedEffectsIncomplete", {
|
|
146
|
+
digest: Schema.String,
|
|
147
|
+
message: Schema.String
|
|
148
|
+
}) {}
|
|
149
|
+
|
|
150
|
+
export class Transactions extends /* @__PURE__ */ Context.Service<Transactions, {
|
|
151
|
+
/** Run without committing. `checks: false` skips signature/ownership checks (dev-inspect). */
|
|
152
|
+
readonly simulate: (txBytes: Uint8Array, options?: { readonly checks?: boolean }) => Effect.Effect<Simulation, RpcError>
|
|
153
|
+
/** Submit signed bytes. A Move abort is a successful submission with a `Failure` status. */
|
|
154
|
+
readonly execute: (
|
|
155
|
+
txBytes: Uint8Array,
|
|
156
|
+
signatures: ReadonlyArray<Uint8Array>,
|
|
157
|
+
options?: IncludeOptions
|
|
158
|
+
) => Effect.Effect<Effects, RpcError | ExecutedEffectsIncomplete>
|
|
159
|
+
/** A transaction's effects, with its checkpoint and timestamp. */
|
|
160
|
+
readonly get: (digest: string, options?: IncludeOptions) => Effect.Effect<Effects, TransactionNotFound | RpcError>
|
|
161
|
+
/**
|
|
162
|
+
* Complete an unresolved transaction on the node in one simulation, with
|
|
163
|
+
* checks and gas selection on: object versions, shared-object mutability,
|
|
164
|
+
* gas price, budget and payment (and a `ValidDuring` expiration when it pays
|
|
165
|
+
* from an address balance). Optional: without it `Tx.resolve` resolves
|
|
166
|
+
* client-side. `Resolve.server` verifies the answer before using it.
|
|
167
|
+
*/
|
|
168
|
+
readonly resolve?: (transaction: UnresolvedTransaction) => Effect.Effect<Resolution, RpcError>
|
|
169
|
+
}>()("@unconfirmed/effect-sui/Transactions") {}
|
|
170
|
+
|
|
171
|
+
/** `waitFor` gave up: the transaction wasn't visible within the timeout. */
|
|
172
|
+
export class TransactionWaitTimeout extends /* @__PURE__ */ Schema.TaggedError<TransactionWaitTimeout>()("TransactionWaitTimeout", {
|
|
173
|
+
digest: Schema.String,
|
|
174
|
+
timeoutMillis: Schema.Number
|
|
175
|
+
}) {
|
|
176
|
+
override get message(): string {
|
|
177
|
+
return `transaction ${this.digest} not seen within ${this.timeoutMillis} ms`
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface WaitForOptions extends IncludeOptions {
|
|
182
|
+
/** Overall bound. Default 60 seconds. */
|
|
183
|
+
readonly timeout?: Duration.Input
|
|
184
|
+
/**
|
|
185
|
+
* When to look again after `TransactionNotFound`. Default: every 500 ms
|
|
186
|
+
* (until the timeout). If a finite schedule runs out first, the last
|
|
187
|
+
* `TransactionNotFound` is the failure.
|
|
188
|
+
*/
|
|
189
|
+
readonly retry?: Schedule.Schedule<unknown>
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Wait until a transaction is readable (e.g. after `execute` on another node,
|
|
194
|
+
* or a digest from elsewhere) and return its effects. Only `TransactionNotFound`
|
|
195
|
+
* is retried; transport failures surface as they are.
|
|
196
|
+
*/
|
|
197
|
+
export const waitFor = (
|
|
198
|
+
digest: string,
|
|
199
|
+
options?: WaitForOptions
|
|
200
|
+
): Effect.Effect<Effects, TransactionWaitTimeout | TransactionNotFound | RpcError, Transactions> => {
|
|
201
|
+
const timeout = options?.timeout ?? "60 seconds"
|
|
202
|
+
return Effect.flatMap(Effect.service(Transactions), (t) =>
|
|
203
|
+
t.get(digest, options).pipe(
|
|
204
|
+
Effect.retry({ while: (e) => e._tag === "TransactionNotFound", schedule: options?.retry ?? Schedule.spaced("500 millis") }),
|
|
205
|
+
Effect.timeoutOrElse({
|
|
206
|
+
duration: timeout,
|
|
207
|
+
orElse: () => Effect.fail(new TransactionWaitTimeout({ digest, timeoutMillis: Duration.toMillis(timeout) }))
|
|
208
|
+
}),
|
|
209
|
+
Effect.withSpan("Transactions.waitFor", { attributes: { digest } })
|
|
210
|
+
))
|
|
211
|
+
}
|
package/src/Tx.ts
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The common path in one place: build a recipe, resolve it, sign, execute.
|
|
3
|
+
*
|
|
4
|
+
* const effects = yield* Tx.run(recipe, { signer })
|
|
5
|
+
*
|
|
6
|
+
* Every piece is also exported on its own (`Ptb.build`, the `Resolve` steps,
|
|
7
|
+
* `Signer.signTransaction`, `Transactions.execute`) for flows that need to
|
|
8
|
+
* stop in between: sponsorship, multi-party signing, offline signing.
|
|
9
|
+
*/
|
|
10
|
+
import * as Effect from "effect/Effect"
|
|
11
|
+
import * as Option from "effect/Option"
|
|
12
|
+
import * as Schema from "effect/Schema"
|
|
13
|
+
import type { Address } from "./Address.ts"
|
|
14
|
+
import * as Hash from "./Hash.ts"
|
|
15
|
+
import * as Ptb from "./Ptb.ts"
|
|
16
|
+
import * as Resolve from "./Resolve.ts"
|
|
17
|
+
import { isTransactionSigner, type Signer, SigningError, signTransaction, type TransactionSigner } from "./Signer.ts"
|
|
18
|
+
import * as T from "./TransactionData.ts"
|
|
19
|
+
import { type Effects, type IncludeOptions, Transactions } from "./Transactions.ts"
|
|
20
|
+
import * as Bytes from "@unconfirmed/effect-bcs/Bytes"
|
|
21
|
+
|
|
22
|
+
export interface ResolveOptions<E = never, R = never> {
|
|
23
|
+
readonly sender: Address
|
|
24
|
+
readonly gasOwner?: Address
|
|
25
|
+
readonly gasPrice?: bigint
|
|
26
|
+
readonly gasBudget?: bigint
|
|
27
|
+
/** Refuse a resolved budget above this (`GasBudgetExceeded`). Without it the node's budget is still refused above 50 SUI. */
|
|
28
|
+
readonly maxGasBudget?: bigint
|
|
29
|
+
readonly expiration?: T.TransactionExpiration
|
|
30
|
+
/**
|
|
31
|
+
* Default: `Resolve.auto` (address balance when it covers the budget, else coins).
|
|
32
|
+
* Also `Resolve.addressBalance` (address balance only, or fail), `Resolve.coins`,
|
|
33
|
+
* `Resolve.fixed(refs)`, or your own step.
|
|
34
|
+
*/
|
|
35
|
+
readonly payment?: Resolve.PaymentStrategy<E, R>
|
|
36
|
+
/**
|
|
37
|
+
* Where the transaction is completed.
|
|
38
|
+
*
|
|
39
|
+
* - `"auto"` (default): on the node, as `"server"`, when the transport can
|
|
40
|
+
* (`Transactions.resolve`: gRPC and GraphQL) and `payment` is the default,
|
|
41
|
+
* `Resolve.auto` or `Resolve.fixed`; otherwise client-side. A server
|
|
42
|
+
* attempt that fails with a non-retryable `RpcError` (a missing object,
|
|
43
|
+
* gas the node can't select, an old node) is redone client-side, whose
|
|
44
|
+
* errors are precise (`ObjectNotFound`, `InsufficientGas`).
|
|
45
|
+
* - `"server"`: `Resolve.balances` (coin/balance intents), then one verified
|
|
46
|
+
* simulation on the node (`Resolve.server`). `Incomplete` if the transport
|
|
47
|
+
* can't, `InvalidTransaction` with a custom payment strategy.
|
|
48
|
+
* - `"client"`: the client-side steps only (`Resolve.inputs`, `balances`,
|
|
49
|
+
* `gasPrice`, `budget`, the payment strategy), every answer read here:
|
|
50
|
+
* for independent verification, or a transport without `resolve`.
|
|
51
|
+
*/
|
|
52
|
+
readonly resolve?: "auto" | "server" | "client"
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const basePlan = (draft: Ptb.Draft, options: ResolveOptions<any, any>): Resolve.Plan => ({
|
|
56
|
+
sender: options.sender,
|
|
57
|
+
draft,
|
|
58
|
+
...(options.gasOwner && { gasOwner: options.gasOwner }),
|
|
59
|
+
...(options.gasPrice !== undefined && { gasPrice: options.gasPrice }),
|
|
60
|
+
...(options.gasBudget !== undefined && { gasBudget: options.gasBudget }),
|
|
61
|
+
...(options.maxGasBudget !== undefined && { maxGasBudget: options.maxGasBudget }),
|
|
62
|
+
...(options.expiration && { expiration: options.expiration })
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
/** The client-side pipeline. */
|
|
66
|
+
const resolveClient = <E, R>(plan: Resolve.Plan, payment: Resolve.PaymentStrategy<E, R> | undefined) => {
|
|
67
|
+
const strategy: Resolve.PaymentStrategy<E | Resolve.DefaultPaymentError, R | Resolve.DefaultPaymentServices> = payment ??
|
|
68
|
+
Resolve.auto
|
|
69
|
+
return Effect.all([Resolve.inputs(plan), Resolve.prefetch(plan, { payment: payment === undefined })], {
|
|
70
|
+
concurrency: "unbounded"
|
|
71
|
+
}).pipe(
|
|
72
|
+
Effect.map(([resolved, pre]): Resolve.Plan => ({
|
|
73
|
+
...resolved,
|
|
74
|
+
...(pre.gasPrice !== undefined && { gasPrice: pre.gasPrice }),
|
|
75
|
+
...(pre.prefetched && { prefetched: pre.prefetched })
|
|
76
|
+
})),
|
|
77
|
+
Effect.flatMap(Resolve.balances),
|
|
78
|
+
Effect.flatMap(Resolve.gasPrice),
|
|
79
|
+
Effect.flatMap(Resolve.budget),
|
|
80
|
+
Effect.flatMap(strategy),
|
|
81
|
+
Effect.flatMap(Resolve.finish)
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The payment the node can be handed: none (it selects), or a fixed non-empty
|
|
87
|
+
* one; `undefined` for a custom strategy, or `fixed([])`, which the node can't
|
|
88
|
+
* tell from "select one".
|
|
89
|
+
*/
|
|
90
|
+
const serverPayment = (
|
|
91
|
+
payment: Resolve.PaymentStrategy<any, any> | undefined
|
|
92
|
+
): { readonly refs?: ReadonlyArray<T.ObjectRef> } | undefined =>
|
|
93
|
+
payment === undefined || payment === Resolve.auto
|
|
94
|
+
? {}
|
|
95
|
+
: Array.isArray((payment as Partial<Resolve.FixedPayment>).payment) && (payment as Resolve.FixedPayment).payment.length > 0
|
|
96
|
+
? { refs: (payment as Resolve.FixedPayment).payment }
|
|
97
|
+
: undefined
|
|
98
|
+
|
|
99
|
+
/** Nothing to look up: every input resolved, no intents, price, budget and payment fixed. */
|
|
100
|
+
const complete = (plan: Resolve.Plan) =>
|
|
101
|
+
plan.gasPrice !== undefined && plan.gasBudget !== undefined && plan.gasPayment !== undefined &&
|
|
102
|
+
Ptb.toProgrammable(plan.draft) !== undefined
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Draft -> TransactionData.
|
|
106
|
+
*
|
|
107
|
+
* By default on the node, in one verified `SimulateTransaction` with gas
|
|
108
|
+
* selection (`Resolve.server`, after `Resolve.balances` for coin/balance
|
|
109
|
+
* intents), as `@mysten/sui` does; see `resolve` in `ResolveOptions` for when
|
|
110
|
+
* it resolves client-side instead. Client-side, object lookups and everything
|
|
111
|
+
* independent of them (gas price, chain info, the gas owner's SUI balance and
|
|
112
|
+
* coins: `Resolve.prefetch`) run in one round trip; then intents, the budget
|
|
113
|
+
* dry run and payment. The error type always includes the default payment
|
|
114
|
+
* strategy's (`InsufficientGas`), which is what runs when `payment` is not given.
|
|
115
|
+
*/
|
|
116
|
+
export const resolve = <E = never, R = never>(draft: Ptb.Draft, options: ResolveOptions<E, R>) => {
|
|
117
|
+
const mode = options.resolve ?? "auto"
|
|
118
|
+
const plan = basePlan(draft, options)
|
|
119
|
+
const client = resolveClient(plan, options.payment)
|
|
120
|
+
const capped = (data: T.TransactionData) =>
|
|
121
|
+
options.maxGasBudget !== undefined && data.gasData.budget > options.maxGasBudget
|
|
122
|
+
? Effect.fail(new Resolve.GasBudgetExceeded({ budget: data.gasData.budget, max: options.maxGasBudget }))
|
|
123
|
+
: Effect.succeed(data)
|
|
124
|
+
const payment = serverPayment(options.payment)
|
|
125
|
+
const withPayment: Resolve.Plan = payment?.refs ? { ...plan, gasPayment: payment.refs } : plan
|
|
126
|
+
// The node refuses gas selection for a sponsored transaction that uses the gas coin
|
|
127
|
+
// ("Gas object is not an owned object with owner: <sender>"), so that resolves client-side.
|
|
128
|
+
const sponsoredGasCoin = plan.gasOwner !== undefined && plan.gasOwner !== plan.sender && payment?.refs === undefined &&
|
|
129
|
+
Resolve.usesGasCoin(draft)
|
|
130
|
+
if (mode === "client" || (mode === "auto" && (payment === undefined || sponsoredGasCoin || complete(withPayment)))) {
|
|
131
|
+
return client.pipe(Effect.flatMap(capped), Effect.withSpan("Tx.resolve"))
|
|
132
|
+
}
|
|
133
|
+
const resolved = Effect.flatMap(Effect.serviceOption(Transactions), (service) => {
|
|
134
|
+
const transactions = Option.getOrUndefined(service)
|
|
135
|
+
if (mode === "auto" && transactions?.resolve === undefined) return client
|
|
136
|
+
if (transactions?.resolve === undefined) {
|
|
137
|
+
return Effect.fail(new Resolve.Incomplete({ missing: "server-side resolution (this Transactions transport has no resolve)" }))
|
|
138
|
+
}
|
|
139
|
+
if (payment === undefined) {
|
|
140
|
+
return Effect.fail(new Resolve.InvalidTransaction({
|
|
141
|
+
reason: "resolve: \"server\" lets the node pick the gas payment; a custom payment strategy needs resolve: \"client\""
|
|
142
|
+
}))
|
|
143
|
+
}
|
|
144
|
+
const serverSide = Effect.flatMap(Resolve.balances(withPayment), Resolve.server)
|
|
145
|
+
return mode === "server"
|
|
146
|
+
? Effect.flatMap(serverSide, Resolve.finish)
|
|
147
|
+
: serverSide.pipe(
|
|
148
|
+
Effect.map(Option.some),
|
|
149
|
+
Effect.catchIf((e) => e._tag === "RpcError" && !e.retryable, () => Effect.succeedNone),
|
|
150
|
+
Effect.flatMap(Option.match({ onNone: () => client, onSome: Resolve.finish }))
|
|
151
|
+
)
|
|
152
|
+
})
|
|
153
|
+
return resolved.pipe(Effect.flatMap(capped), Effect.withSpan("Tx.resolve"))
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Build a recipe and resolve it. */
|
|
157
|
+
export const build = <A, E1, R1, E2 = never, R2 = never>(
|
|
158
|
+
recipe: Effect.Effect<A, E1, R1>,
|
|
159
|
+
options: ResolveOptions<E2, R2>
|
|
160
|
+
) => Effect.flatMap(Ptb.build(recipe), ({ draft }) => resolve(draft, options))
|
|
161
|
+
|
|
162
|
+
/** The BCS bytes of transaction data. */
|
|
163
|
+
export const serialize = T.encode
|
|
164
|
+
|
|
165
|
+
/** The transaction digest of resolved data (what the chain and `Effects.digest` call it), as `@mysten/sui`'s `getDigest`. */
|
|
166
|
+
export const digest = (data: T.TransactionData): Effect.Effect<string, Resolve.InvalidTransaction> =>
|
|
167
|
+
Effect.map(Resolve.encode(data), Hash.transactionDigest)
|
|
168
|
+
|
|
169
|
+
/** The transaction reached the chain and failed (a Move abort: `abort`). Gas was charged. */
|
|
170
|
+
export class ExecutionFailed extends /* @__PURE__ */ Schema.TaggedError<ExecutionFailed>()("ExecutionFailed", {
|
|
171
|
+
digest: Schema.String,
|
|
172
|
+
...Resolve.FailureFields
|
|
173
|
+
}) {
|
|
174
|
+
override get message(): string {
|
|
175
|
+
return `transaction ${this.digest} failed: ${Resolve.describeFailure(this)}`
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* `Tx.simulate`: the transaction would fail (a Move abort: `abort`), found in
|
|
181
|
+
* the resolving dry run or in the simulation itself.
|
|
182
|
+
*/
|
|
183
|
+
export class SimulationFailed extends /* @__PURE__ */ Schema.TaggedError<SimulationFailed>()("SimulationFailed", Resolve.FailureFields) {
|
|
184
|
+
override get message(): string {
|
|
185
|
+
return `simulation failed: ${Resolve.describeFailure(this)}`
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Build and resolve a recipe as `build` does, then simulate the result (with
|
|
191
|
+
* the node's checks unless `checks: false`): a dry run in one call, answering
|
|
192
|
+
* the resolved data, effects and return values. An execution failure, whether
|
|
193
|
+
* resolution's own dry run or the simulation finds it, is `SimulationFailed`
|
|
194
|
+
* with the Move abort. For a sender without gas, pass
|
|
195
|
+
* `payment: Resolve.unchecked` (the node mocks the gas coin).
|
|
196
|
+
*/
|
|
197
|
+
export const simulate = <A, E1, R1, E2 = never, R2 = never>(
|
|
198
|
+
recipe: Effect.Effect<A, E1, R1>,
|
|
199
|
+
options: ResolveOptions<E2, R2> & { readonly checks?: boolean }
|
|
200
|
+
) =>
|
|
201
|
+
Effect.gen(function*() {
|
|
202
|
+
const data = yield* build(recipe, options).pipe(
|
|
203
|
+
Effect.catchIf((e): e is Resolve.GasEstimationFailed => e instanceof Resolve.GasEstimationFailed, ({ description, command, abort }) =>
|
|
204
|
+
Effect.fail(
|
|
205
|
+
new SimulationFailed({ description, ...(command !== undefined && { command }), ...(abort !== undefined && { abort }) })
|
|
206
|
+
))
|
|
207
|
+
)
|
|
208
|
+
const bytes = yield* Resolve.encode(data)
|
|
209
|
+
const simulation = yield* Effect.flatMap(
|
|
210
|
+
Effect.service(Transactions),
|
|
211
|
+
(t) => t.simulate(bytes, options.checks === undefined ? undefined : { checks: options.checks })
|
|
212
|
+
)
|
|
213
|
+
const status = simulation.effects.status
|
|
214
|
+
if (status._tag === "Failure") return yield* new SimulationFailed(Resolve.failureFields(status))
|
|
215
|
+
return { data, effects: simulation.effects, returnValues: simulation.returnValues }
|
|
216
|
+
}).pipe(Effect.withSpan("Tx.simulate"))
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* A key or transaction signer whose address is neither the transaction's
|
|
220
|
+
* sender nor its gas owner: the node would refuse its signature. Refused
|
|
221
|
+
* before anything is signed or sent. To sign for another address through its
|
|
222
|
+
* alias set, wrap the key in `AddressAlias.signer`.
|
|
223
|
+
*/
|
|
224
|
+
export class SignerMismatch extends /* @__PURE__ */ Schema.TaggedError<SignerMismatch>()("SignerMismatch", {
|
|
225
|
+
signer: Schema.String,
|
|
226
|
+
sender: Schema.String,
|
|
227
|
+
gasOwner: Schema.String
|
|
228
|
+
}) {
|
|
229
|
+
override get message(): string {
|
|
230
|
+
return `signer ${this.signer} is neither the sender ${this.sender} nor the gas owner ${this.gasOwner}`
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** `SignerMismatch` when `signer` is neither `sender` nor `gasOwner`, else `undefined`. */
|
|
235
|
+
export const signerMismatch = (signer: Address, sender: Address, gasOwner: Address): SignerMismatch | undefined =>
|
|
236
|
+
signer === sender || signer === gasOwner ? undefined : new SignerMismatch({ signer, sender, gasOwner })
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* What a transaction signer may change. Its returned bytes must keep the
|
|
241
|
+
* sender, the programmable transaction and the gas owner. It may re-pick gas
|
|
242
|
+
* price, budget and payment only when no key `Signer` is the gas owner (a
|
|
243
|
+
* sponsor key never signs gas terms it didn't see), and the expiration only
|
|
244
|
+
* when no key `Signer` is the sender or the gas owner (a key never signs a
|
|
245
|
+
* validity window it didn't see).
|
|
246
|
+
*/
|
|
247
|
+
const checkChange = (
|
|
248
|
+
before: T.TransactionData,
|
|
249
|
+
after: T.TransactionData,
|
|
250
|
+
keySigners: ReadonlyArray<Signer>
|
|
251
|
+
): SigningError | undefined => {
|
|
252
|
+
const refused = (what: string) =>
|
|
253
|
+
new SigningError({ reason: "failed", message: `a transaction signer changed the transaction's ${what}` })
|
|
254
|
+
if (after.sender !== before.sender) return refused("sender")
|
|
255
|
+
if (after.gasData.owner !== before.gasData.owner) return refused("gas owner")
|
|
256
|
+
const restOf = (d: T.TransactionData) => T.encode({ ...d, gasData: before.gasData, expiration: before.expiration })
|
|
257
|
+
if (!Bytes.equal(restOf(after), restOf(before))) return refused("commands or inputs")
|
|
258
|
+
const keyIs = (address: string) => keySigners.some((k) => k.address === address)
|
|
259
|
+
const gasChanged = !Bytes.equal(T.encode({ ...before, gasData: after.gasData }), T.encode(before))
|
|
260
|
+
const expirationChanged = !Bytes.equal(T.encode({ ...before, expiration: after.expiration }), T.encode(before))
|
|
261
|
+
if (gasChanged && keyIs(before.gasData.owner)) return refused("gas or expiration, which a key signer pays for")
|
|
262
|
+
if (expirationChanged && (keyIs(before.sender) || keyIs(before.gasData.owner))) {
|
|
263
|
+
return refused("expiration, which a key signer signs")
|
|
264
|
+
}
|
|
265
|
+
return undefined
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Collect every signature, in the order the signers were given.
|
|
270
|
+
*
|
|
271
|
+
* `TransactionSigner`s (wallets) sign first, one at a time. One may change the
|
|
272
|
+
* gas terms (its returned bytes win, see `checkChange`), but not after another
|
|
273
|
+
* has signed. Intent-message `Signer`s then sign the final bytes concurrently.
|
|
274
|
+
* A signer that is neither the sender nor the gas owner is `SignerMismatch`
|
|
275
|
+
* before anyone signs.
|
|
276
|
+
*/
|
|
277
|
+
const sign = /* @__PURE__ */ Effect.fnUntraced(function*(data: T.TransactionData, signers: ReadonlyArray<Signer | TransactionSigner>) {
|
|
278
|
+
for (const s of signers) {
|
|
279
|
+
const refused = signerMismatch(s.address, data.sender, data.gasData.owner)
|
|
280
|
+
if (refused) return yield* refused
|
|
281
|
+
}
|
|
282
|
+
let current = data
|
|
283
|
+
let bytes = yield* Resolve.encode(data)
|
|
284
|
+
const signatures: Array<Uint8Array | undefined> = signers.map(() => undefined)
|
|
285
|
+
let signedByTransactionSigner = false
|
|
286
|
+
for (const [i, s] of signers.entries()) {
|
|
287
|
+
if (!isTransactionSigner(s)) continue
|
|
288
|
+
const signed = yield* s.signTransaction(current)
|
|
289
|
+
if (!Bytes.equal(signed.bytes, bytes)) {
|
|
290
|
+
if (signedByTransactionSigner) {
|
|
291
|
+
return yield* new SigningError({
|
|
292
|
+
reason: "failed",
|
|
293
|
+
message: "a transaction signer changed a transaction that another signer had already signed"
|
|
294
|
+
})
|
|
295
|
+
}
|
|
296
|
+
const decoded = T.decode(signed.bytes)
|
|
297
|
+
if (decoded._tag === "Failure") {
|
|
298
|
+
return yield* new SigningError({ reason: "failed", message: `the signer returned bytes that are not TransactionData: ${decoded.failure.message}` })
|
|
299
|
+
}
|
|
300
|
+
const refused = checkChange(current, decoded.success, signers.filter((x): x is Signer => !isTransactionSigner(x)))
|
|
301
|
+
if (refused) return yield* refused
|
|
302
|
+
current = decoded.success
|
|
303
|
+
bytes = signed.bytes
|
|
304
|
+
}
|
|
305
|
+
signedByTransactionSigner = true
|
|
306
|
+
signatures[i] = signed.signature
|
|
307
|
+
}
|
|
308
|
+
const final = bytes
|
|
309
|
+
yield* Effect.forEach(
|
|
310
|
+
signers.entries(),
|
|
311
|
+
([i, s]) =>
|
|
312
|
+
isTransactionSigner(s) ? Effect.void : Effect.map(signTransaction(s, final), (x) => {
|
|
313
|
+
signatures[i] = x.signature
|
|
314
|
+
}),
|
|
315
|
+
{ concurrency: "unbounded", discard: true }
|
|
316
|
+
)
|
|
317
|
+
return { bytes: final, signatures: signatures as Array<Uint8Array> }
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Sign and submit; a `Failure` status becomes `ExecutionFailed`.
|
|
322
|
+
*
|
|
323
|
+
* Takes `Signer`s and `TransactionSigner`s (wallets), each the sender or the
|
|
324
|
+
* gas owner (else `SignerMismatch`; an alias signs through `AddressAlias.signer`).
|
|
325
|
+
* A wallet may re-pick the gas terms it pays for, never the sender, commands,
|
|
326
|
+
* inputs or gas owner, and nothing a key signer pays for; what is submitted is
|
|
327
|
+
* exactly the bytes it signed.
|
|
328
|
+
*/
|
|
329
|
+
export const execute = /* @__PURE__ */ Effect.fn("Tx.execute")(function*(
|
|
330
|
+
data: T.TransactionData,
|
|
331
|
+
signers: Signer | TransactionSigner | ReadonlyArray<Signer | TransactionSigner>,
|
|
332
|
+
options?: IncludeOptions
|
|
333
|
+
) {
|
|
334
|
+
const { bytes, signatures } = yield* sign(data, Array.isArray(signers) ? signers : [signers as Signer | TransactionSigner])
|
|
335
|
+
const effects = yield* Effect.flatMap(Effect.service(Transactions), (t) => t.execute(bytes, signatures, options))
|
|
336
|
+
if (effects.status._tag === "Failure") {
|
|
337
|
+
return yield* new ExecutionFailed({
|
|
338
|
+
digest: effects.digest,
|
|
339
|
+
...Resolve.failureFields(effects.status)
|
|
340
|
+
})
|
|
341
|
+
}
|
|
342
|
+
return effects
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Build, resolve, sign with `signer` (a `Signer` or a wallet's `TransactionSigner`; also the sender unless given), execute.
|
|
347
|
+
* `include` (`["events", "balanceChanges"]`) adds those to the effects.
|
|
348
|
+
*/
|
|
349
|
+
export const run = <A, E1, R1, E2 = never, R2 = never>(
|
|
350
|
+
recipe: Effect.Effect<A, E1, R1>,
|
|
351
|
+
options: Omit<ResolveOptions<E2, R2>, "sender"> & IncludeOptions & {
|
|
352
|
+
readonly signer: Signer | TransactionSigner
|
|
353
|
+
readonly sender?: Address
|
|
354
|
+
}
|
|
355
|
+
): Effect.Effect<
|
|
356
|
+
Effects,
|
|
357
|
+
Effect.Error<ReturnType<typeof build<A, E1, R1, E2, R2>>> | Effect.Error<ReturnType<typeof execute>>,
|
|
358
|
+
Effect.Services<ReturnType<typeof build<A, E1, R1, E2, R2>>> | Transactions
|
|
359
|
+
> =>
|
|
360
|
+
Effect.suspend(() => {
|
|
361
|
+
const sender = options.sender ?? options.signer.address
|
|
362
|
+
const refused = signerMismatch(options.signer.address, sender, options.gasOwner ?? sender)
|
|
363
|
+
return refused
|
|
364
|
+
? Effect.fail(refused)
|
|
365
|
+
: Effect.flatMap(build(recipe, { ...options, sender }), (data) =>
|
|
366
|
+
execute(data, options.signer, options.include && { include: options.include }))
|
|
367
|
+
}) as any
|