@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
package/src/grpc/Rpc.ts
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Method handles for the generated gRPC surface.
|
|
3
|
+
*
|
|
4
|
+
* A handle carries its request/response types and a thunk listing the
|
|
5
|
+
* descriptor chunks (one per top-level message or enum) its messages reach.
|
|
6
|
+
* Its codec is built from just those chunks on first use. Because the chunks
|
|
7
|
+
* are separate module-level constants, a bundler keeps exactly the
|
|
8
|
+
* descriptors of the RPCs a program calls, each shared message once.
|
|
9
|
+
*/
|
|
10
|
+
import * as Result from "effect/Result"
|
|
11
|
+
import * as ProtobufDescriptor from "effect/protobuf/ProtobufDescriptor"
|
|
12
|
+
import * as ProtobufMessage from "effect/protobuf/ProtobufMessage"
|
|
13
|
+
|
|
14
|
+
export interface File {
|
|
15
|
+
readonly name: string
|
|
16
|
+
readonly package: string
|
|
17
|
+
readonly syntax: string
|
|
18
|
+
readonly dependency: ReadonlyArray<string>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface Chunk {
|
|
22
|
+
readonly file: File
|
|
23
|
+
readonly kind: "message" | "enum"
|
|
24
|
+
readonly proto: object
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const file = (f: File): File => f
|
|
28
|
+
export const chunk = (file: File, kind: Chunk["kind"], proto: object): Chunk => ({ file, kind, proto })
|
|
29
|
+
|
|
30
|
+
export interface Codec<I, O> {
|
|
31
|
+
readonly encode: (request: I) => Uint8Array
|
|
32
|
+
readonly decode: (bytes: Uint8Array) => Result.Result<O, ProtobufMessage.ProtobufMessageError>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface Rpc<I, O, Streaming extends boolean> {
|
|
36
|
+
readonly path: string
|
|
37
|
+
readonly streaming: Streaming
|
|
38
|
+
readonly codec: () => Codec<I, O>
|
|
39
|
+
/** Phantom: request and response types. */
|
|
40
|
+
readonly "~types"?: readonly [I, O]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const registryOf = (chunks: ReadonlyArray<Chunk>) => {
|
|
44
|
+
const files = new Map<File, { message_type: Array<object>; enum_type: Array<object> }>()
|
|
45
|
+
for (const c of chunks) {
|
|
46
|
+
let entry = files.get(c.file)
|
|
47
|
+
if (!entry) files.set(c.file, entry = { message_type: [], enum_type: [] })
|
|
48
|
+
;(c.kind === "message" ? entry.message_type : entry.enum_type).push(c.proto)
|
|
49
|
+
}
|
|
50
|
+
const present = new Set([...files.keys()].map((f) => f.name))
|
|
51
|
+
return Result.getOrThrow(
|
|
52
|
+
ProtobufDescriptor.make(
|
|
53
|
+
[...files].map(([f, e]) => ({
|
|
54
|
+
name: f.name,
|
|
55
|
+
package: f.package,
|
|
56
|
+
syntax: f.syntax,
|
|
57
|
+
dependency: f.dependency.filter((d) => present.has(d)),
|
|
58
|
+
...e
|
|
59
|
+
})) as any
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const rpc = <I, O, Streaming extends boolean>(
|
|
65
|
+
path: string,
|
|
66
|
+
input: string,
|
|
67
|
+
output: string,
|
|
68
|
+
streaming: Streaming,
|
|
69
|
+
chunks: () => ReadonlyArray<Chunk>
|
|
70
|
+
): Rpc<I, O, Streaming> => make(path, input, output, streaming, chunks, undefined)
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A handle whose descriptors are pruned to what the SDK reads
|
|
74
|
+
* (`scripts/grpc-lean.ts`). Response fields outside them decode as unknown
|
|
75
|
+
* and are dropped. Every request is checked first: a field the pruned request
|
|
76
|
+
* descriptor lacks would otherwise be dropped silently, and a read-mask path
|
|
77
|
+
* outside `mask` (or no mask, which asks for the server's default fields)
|
|
78
|
+
* would return fields the response descriptor cannot see. Either is a defect.
|
|
79
|
+
*/
|
|
80
|
+
export const lean = <I, O, Streaming extends boolean>(
|
|
81
|
+
path: string,
|
|
82
|
+
input: string,
|
|
83
|
+
output: string,
|
|
84
|
+
streaming: Streaming,
|
|
85
|
+
chunks: () => ReadonlyArray<Chunk>,
|
|
86
|
+
mask: ReadonlyArray<string> | undefined
|
|
87
|
+
): Rpc<I, O, Streaming> => make(path, input, output, streaming, chunks, { mask })
|
|
88
|
+
|
|
89
|
+
const fail = (path: string, message: string): never => {
|
|
90
|
+
throw new Error(`${path}: ${message} (pruned handle; see packages/effect-sui/scripts/grpc-lean.ts)`)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Every key of `value` is a field (or real oneof) of `descriptor`, recursively. */
|
|
94
|
+
const checkFields = (path: string, descriptor: ProtobufDescriptor.MessageDescriptor, value: unknown, at: string): void => {
|
|
95
|
+
if (typeof value !== "object" || value === null) return
|
|
96
|
+
for (const [key, v] of Object.entries(value)) {
|
|
97
|
+
if (v === undefined) continue
|
|
98
|
+
const field = descriptor.fields.find((f) => f.name === key && (f.oneof === undefined || f.proto.proto3_optional === true))
|
|
99
|
+
if (field) {
|
|
100
|
+
checkValue(path, field, v, `${at}${key}`)
|
|
101
|
+
continue
|
|
102
|
+
}
|
|
103
|
+
const oneof = descriptor.oneofs.find((o) => o.name === key)
|
|
104
|
+
const member = oneof?.fields.find((f) => f.name === (v as { _tag?: string })._tag)
|
|
105
|
+
if (member) checkValue(path, member, (v as { value: unknown }).value, `${at}${key}.${member.name}`)
|
|
106
|
+
else fail(path, `request field ${at}${key} is not in the pruned descriptor`)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const checkValue = (path: string, field: ProtobufDescriptor.FieldDescriptor, value: unknown, at: string): void => {
|
|
111
|
+
if (field.type.kind !== "message") return
|
|
112
|
+
const message = field.type.message
|
|
113
|
+
if (field.kind === "list") (value as ReadonlyArray<unknown>).forEach((v) => checkFields(path, message, v, `${at}.`))
|
|
114
|
+
else if (field.kind === "map") Object.values(value as object).forEach((v) => checkFields(path, message, v, `${at}.`))
|
|
115
|
+
else checkFields(path, message, value, `${at}.`)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const checkMask = (path: string, allowed: ReadonlyArray<string>, request: unknown): void => {
|
|
119
|
+
const paths = (request as { read_mask?: { paths?: ReadonlyArray<string> } }).read_mask?.paths
|
|
120
|
+
if (paths === undefined) return fail(path, "a read mask is required")
|
|
121
|
+
for (const p of paths) {
|
|
122
|
+
if (!allowed.some((a) => p === a || p.startsWith(`${a}.`))) fail(path, `read-mask path "${p}" is not in the pruned descriptor`)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const make = <I, O, Streaming extends boolean>(
|
|
127
|
+
path: string,
|
|
128
|
+
input: string,
|
|
129
|
+
output: string,
|
|
130
|
+
streaming: Streaming,
|
|
131
|
+
chunks: () => ReadonlyArray<Chunk>,
|
|
132
|
+
pruned: { readonly mask: ReadonlyArray<string> | undefined } | undefined
|
|
133
|
+
): Rpc<I, O, Streaming> => {
|
|
134
|
+
let codec: Codec<I, O> | undefined
|
|
135
|
+
return {
|
|
136
|
+
path,
|
|
137
|
+
streaming,
|
|
138
|
+
codec: () => {
|
|
139
|
+
if (codec) return codec
|
|
140
|
+
const registry = registryOf(chunks())
|
|
141
|
+
const inputDescriptor = registry.getMessage(input)!
|
|
142
|
+
const encode = ProtobufMessage.encode(inputDescriptor)
|
|
143
|
+
const decode = ProtobufMessage.decode(registry.getMessage(output)!, pruned && { readUnknownFields: false })
|
|
144
|
+
return codec = {
|
|
145
|
+
encode: (req) => {
|
|
146
|
+
if (pruned) {
|
|
147
|
+
if (pruned.mask) checkMask(path, pruned.mask, req)
|
|
148
|
+
checkFields(path, inputDescriptor, req, "")
|
|
149
|
+
}
|
|
150
|
+
return Result.getOrThrow(encode(req as ProtobufMessage.Message))
|
|
151
|
+
},
|
|
152
|
+
decode: (bytes) => decode(bytes) as Result.Result<O, ProtobufMessage.ProtobufMessageError>
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect"
|
|
2
|
+
import * as Layer from "effect/Layer"
|
|
3
|
+
import { transactionDigest } from "../Hash.ts"
|
|
4
|
+
import { ExecutedEffectsIncomplete, TransactionNotFound, Transactions } from "../Transactions.ts"
|
|
5
|
+
import { convert, EFFECTS_PATHS, effects, LANDED_PATHS, landed, maskWith } from "./convert.ts"
|
|
6
|
+
import * as Rpc from "./generated/lean.ts"
|
|
7
|
+
import { GrpcWeb } from "./GrpcWeb.ts"
|
|
8
|
+
import { needsGasSelection, RESOLVE_PATHS, toProto } from "./transaction.ts"
|
|
9
|
+
|
|
10
|
+
const GET_PATHS = [...EFFECTS_PATHS, ...LANDED_PATHS]
|
|
11
|
+
|
|
12
|
+
const prefixed = (prefix: string) => EFFECTS_PATHS.map((p) => (p === "digest" ? `${prefix}digest` : `${prefix}${p}`))
|
|
13
|
+
|
|
14
|
+
/** `Transactions` over gRPC. A response that can't be converted is `DATA_LOSS`, never a defect. */
|
|
15
|
+
export const layer: Layer.Layer<Transactions, never, GrpcWeb> = /* @__PURE__ */ Layer.effect(
|
|
16
|
+
Transactions,
|
|
17
|
+
Effect.gen(function*() {
|
|
18
|
+
const grpc = yield* GrpcWeb
|
|
19
|
+
const simulatePath = Rpc.TransactionExecutionService_SimulateTransaction.path
|
|
20
|
+
const executePath = Rpc.TransactionExecutionService_ExecuteTransaction.path
|
|
21
|
+
return Transactions.of({
|
|
22
|
+
simulate: (txBytes, options) =>
|
|
23
|
+
grpc
|
|
24
|
+
.unary(Rpc.TransactionExecutionService_SimulateTransaction, {
|
|
25
|
+
transaction: { bcs: { value: txBytes } },
|
|
26
|
+
read_mask: { paths: [...prefixed("transaction."), "command_outputs"] },
|
|
27
|
+
checks: options?.checks === false ? 1 : 0
|
|
28
|
+
})
|
|
29
|
+
.pipe(
|
|
30
|
+
Effect.flatMap((r) =>
|
|
31
|
+
convert(simulatePath, () => ({
|
|
32
|
+
effects: effects(r.transaction, transactionDigest(txBytes)),
|
|
33
|
+
returnValues: (r.command_outputs ?? []).map((o) =>
|
|
34
|
+
(o.return_values ?? []).map((v) => v.value?.value ?? new Uint8Array())
|
|
35
|
+
)
|
|
36
|
+
}))
|
|
37
|
+
),
|
|
38
|
+
Effect.withSpan("Transactions.simulate")
|
|
39
|
+
),
|
|
40
|
+
execute: (txBytes, signatures, options) =>
|
|
41
|
+
grpc
|
|
42
|
+
.unary(Rpc.TransactionExecutionService_ExecuteTransaction, {
|
|
43
|
+
transaction: { bcs: { value: txBytes } },
|
|
44
|
+
signatures: signatures.map((s) => ({ bcs: { value: s } })),
|
|
45
|
+
read_mask: { paths: maskWith(EFFECTS_PATHS, options?.include) }
|
|
46
|
+
})
|
|
47
|
+
.pipe(
|
|
48
|
+
// The node accepted the transaction: a response we can't read is
|
|
49
|
+
// "executed, reconcile by digest", not a Move failure or a transport error.
|
|
50
|
+
Effect.flatMap((r) =>
|
|
51
|
+
convert(executePath, () => effects(r.transaction, undefined, options?.include)).pipe(
|
|
52
|
+
Effect.mapError((e) => new ExecutedEffectsIncomplete({ digest: transactionDigest(txBytes), message: e.message }))
|
|
53
|
+
)
|
|
54
|
+
),
|
|
55
|
+
Effect.withSpan("Transactions.execute")
|
|
56
|
+
),
|
|
57
|
+
resolve: (transaction) =>
|
|
58
|
+
grpc
|
|
59
|
+
.unary(Rpc.TransactionExecutionService_SimulateTransaction, {
|
|
60
|
+
transaction: toProto(transaction),
|
|
61
|
+
read_mask: { paths: RESOLVE_PATHS },
|
|
62
|
+
checks: 0,
|
|
63
|
+
do_gas_selection: needsGasSelection(transaction)
|
|
64
|
+
})
|
|
65
|
+
.pipe(
|
|
66
|
+
Effect.flatMap((r) =>
|
|
67
|
+
convert(simulatePath, () => {
|
|
68
|
+
const bytes = r.transaction?.transaction?.bcs?.value
|
|
69
|
+
if (bytes === undefined) throw new Error("no resolved transaction (transaction.transaction.bcs)")
|
|
70
|
+
return { transaction: bytes, effects: effects(r.transaction, transactionDigest(bytes)), epoch: r.transaction?.effects?.epoch }
|
|
71
|
+
})
|
|
72
|
+
),
|
|
73
|
+
Effect.withSpan("Transactions.resolve")
|
|
74
|
+
),
|
|
75
|
+
get: (digest, options) =>
|
|
76
|
+
grpc.unary(Rpc.LedgerService_GetTransaction, { digest, read_mask: { paths: maskWith(GET_PATHS, options?.include) } }).pipe(
|
|
77
|
+
Effect.flatMap((r) =>
|
|
78
|
+
convert(Rpc.LedgerService_GetTransaction.path, () => ({
|
|
79
|
+
...effects(r.transaction, undefined, options?.include),
|
|
80
|
+
...landed(r.transaction)
|
|
81
|
+
}))
|
|
82
|
+
),
|
|
83
|
+
Effect.catchIf((e) => e.code === "NOT_FOUND", () => Effect.fail(new TransactionNotFound({ digest }))),
|
|
84
|
+
Effect.withSpan("Transactions.get", { attributes: { digest } })
|
|
85
|
+
)
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Success-only caching. Effect's `cachedWithTTL` and `RequestResolver.withCache`
|
|
3
|
+
* also keep failures, so one transient `UNAVAILABLE` would be replayed to every
|
|
4
|
+
* caller (and every retry) until it expires.
|
|
5
|
+
*
|
|
6
|
+
* Concurrent misses share one computation: the first caller runs it and the
|
|
7
|
+
* others wait for its result. A failure is handed to the callers that were
|
|
8
|
+
* waiting and then forgotten; if the running caller is interrupted, a waiter
|
|
9
|
+
* starts again on its own.
|
|
10
|
+
*/
|
|
11
|
+
import * as Cause from "effect/Cause"
|
|
12
|
+
import * as Clock from "effect/Clock"
|
|
13
|
+
import * as Deferred from "effect/Deferred"
|
|
14
|
+
import * as Duration from "effect/Duration"
|
|
15
|
+
import * as Effect from "effect/Effect"
|
|
16
|
+
import * as Exit from "effect/Exit"
|
|
17
|
+
|
|
18
|
+
/** Run `compute` once for all concurrent callers that share `slot`. */
|
|
19
|
+
const shared = <A, E, R>(
|
|
20
|
+
get: () => Deferred.Deferred<A, E> | undefined,
|
|
21
|
+
set: (d: Deferred.Deferred<A, E> | undefined) => void,
|
|
22
|
+
compute: Effect.Effect<A, E, R>
|
|
23
|
+
): Effect.Effect<A, E, R> =>
|
|
24
|
+
Effect.suspend(() => {
|
|
25
|
+
const running = get()
|
|
26
|
+
if (running) {
|
|
27
|
+
return Effect.flatMap(Effect.exit(Deferred.await(running)), (exit): Effect.Effect<A, E, R> =>
|
|
28
|
+
Exit.isFailure(exit) && Cause.hasInterruptsOnly(exit.cause) ? shared(get, set, compute) : exit)
|
|
29
|
+
}
|
|
30
|
+
const d = Deferred.makeUnsafe<A, E>()
|
|
31
|
+
set(d)
|
|
32
|
+
return Effect.onExit(compute, (exit) =>
|
|
33
|
+
Effect.sync(() => {
|
|
34
|
+
if (get() === d) set(undefined)
|
|
35
|
+
Deferred.doneUnsafe(d, exit)
|
|
36
|
+
}))
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
/** `self`, with its last success reused for `ttl`. Failures are never kept. */
|
|
40
|
+
export const successFor = <A, E, R>(self: Effect.Effect<A, E, R>, ttl: Duration.Input): Effect.Effect<A, E, R> => {
|
|
41
|
+
const ms = Duration.toMillis(ttl)
|
|
42
|
+
let cached: { readonly value: A; readonly expires: number } | undefined
|
|
43
|
+
let inflight: Deferred.Deferred<A, E> | undefined
|
|
44
|
+
const refresh = shared(() => inflight, (d) => (inflight = d), Effect.tap(self, (value) =>
|
|
45
|
+
Effect.map(Clock.currentTimeMillis, (t) => {
|
|
46
|
+
cached = { value, expires: t + ms }
|
|
47
|
+
})))
|
|
48
|
+
return Effect.flatMap(Clock.currentTimeMillis, (now) => (cached && now < cached.expires ? Effect.succeed(cached.value) : refresh))
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Memoize successes by key, forever, up to `capacity` entries (oldest evicted). Failures are never kept. */
|
|
52
|
+
export const successByKey = <K, A>(capacity: number) => {
|
|
53
|
+
const map = new Map<K, A>()
|
|
54
|
+
const inflight = new Map<K, Deferred.Deferred<A, any>>()
|
|
55
|
+
return <E, R>(key: K, compute: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
|
|
56
|
+
Effect.suspend(() => {
|
|
57
|
+
if (map.has(key)) return Effect.succeed(map.get(key)!)
|
|
58
|
+
return shared<A, E, R>(
|
|
59
|
+
() => inflight.get(key),
|
|
60
|
+
(d) => (d ? inflight.set(key, d) : inflight.delete(key)),
|
|
61
|
+
Effect.tap(compute, (value) =>
|
|
62
|
+
Effect.sync(() => {
|
|
63
|
+
map.set(key, value)
|
|
64
|
+
if (map.size > capacity) map.delete(map.keys().next().value!)
|
|
65
|
+
}))
|
|
66
|
+
)
|
|
67
|
+
})
|
|
68
|
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/** Proto values -> domain values, shared by the gRPC implementations. */
|
|
2
|
+
import * as Effect from "effect/Effect"
|
|
3
|
+
import * as Address from "../Address.ts"
|
|
4
|
+
import { RpcError } from "../RpcError.ts"
|
|
5
|
+
import type { Checkpoint, CheckpointTransaction } from "../CheckpointData.ts"
|
|
6
|
+
import type { Event, TransactionEvent } from "../Events.ts"
|
|
7
|
+
import type { Owner, SuiObject } from "../Objects.ts"
|
|
8
|
+
import type { ObjectDigest } from "../TransactionData.ts"
|
|
9
|
+
import type { BalanceChange, ChangedObject, Effects, GasUsed, Include, Status } from "../Transactions.ts"
|
|
10
|
+
import type * as P from "./generated/proto.ts"
|
|
11
|
+
|
|
12
|
+
/** Run a conversion that may throw on a malformed message; a throw is `DATA_LOSS`, not a defect. */
|
|
13
|
+
export const convert = <A>(method: string, f: () => A): Effect.Effect<A, RpcError> =>
|
|
14
|
+
Effect.try({
|
|
15
|
+
try: f,
|
|
16
|
+
catch: (e) => new RpcError({ method, code: "DATA_LOSS", message: `malformed response: ${e instanceof Error ? e.message : String(e)}` })
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
/** `Packages.getModules` (`GetObject`). */
|
|
20
|
+
export const MODULES_PATHS = ["package.modules.name", "package.modules.contents"]
|
|
21
|
+
|
|
22
|
+
export const OBJECT_MASK = { paths: ["object_id", "version", "digest", "owner", "object_type", "contents", "previous_transaction"] }
|
|
23
|
+
|
|
24
|
+
/** A field the conversion depends on; its absence is a malformed response (callers turn the throw into `DATA_LOSS`). */
|
|
25
|
+
const required = <A>(value: A | undefined, field: string): A => {
|
|
26
|
+
if (value === undefined) throw new Error(`no ${field}`)
|
|
27
|
+
return value
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** An owner kind this SDK doesn't know yet is `Unknown`, not a throw: the effects of a submitted transaction must still convert. */
|
|
31
|
+
export const owner = (o: P.Owner | undefined): Owner => {
|
|
32
|
+
switch (o?.kind) {
|
|
33
|
+
case 1:
|
|
34
|
+
return { _tag: "AddressOwner", address: Address.normalize(required(o.address, "owner.address")) }
|
|
35
|
+
case 2:
|
|
36
|
+
return { _tag: "ObjectOwner", address: Address.normalize(required(o.address, "owner.address")) }
|
|
37
|
+
case 3:
|
|
38
|
+
return { _tag: "Shared", initialSharedVersion: required(o.version, "owner.version") }
|
|
39
|
+
case 4:
|
|
40
|
+
return { _tag: "Immutable" }
|
|
41
|
+
case 5:
|
|
42
|
+
return {
|
|
43
|
+
_tag: "ConsensusAddressOwner",
|
|
44
|
+
startVersion: required(o.version, "owner.version"),
|
|
45
|
+
address: Address.normalize(required(o.address, "owner.address"))
|
|
46
|
+
}
|
|
47
|
+
default:
|
|
48
|
+
return { _tag: "Unknown", kind: o?.kind ?? 0 }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const object = (o: P.ObjectMessage): SuiObject => ({
|
|
53
|
+
objectId: Address.normalize(required(o.object_id, "object_id")),
|
|
54
|
+
version: required(o.version, "version"),
|
|
55
|
+
digest: required(o.digest, "digest") as ObjectDigest,
|
|
56
|
+
owner: owner(o.owner),
|
|
57
|
+
type: required(o.object_type, "object_type"),
|
|
58
|
+
contents: o.contents?.value ?? new Uint8Array(),
|
|
59
|
+
previousTransaction: o.previous_transaction
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const gas = (g: P.GasCostSummary | undefined): GasUsed => ({
|
|
63
|
+
computationCost: g?.computation_cost ?? 0n,
|
|
64
|
+
storageCost: g?.storage_cost ?? 0n,
|
|
65
|
+
storageRebate: g?.storage_rebate ?? 0n,
|
|
66
|
+
nonRefundableStorageFee: g?.non_refundable_storage_fee ?? 0n
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const status = (s: P.ExecutionStatus | undefined): Status => {
|
|
70
|
+
if (s === undefined) throw new Error("no effects.status")
|
|
71
|
+
if (s.success === true) return { _tag: "Success" }
|
|
72
|
+
const e = s.error
|
|
73
|
+
if (s.success === undefined && e === undefined) throw new Error("effects.status has neither success nor error")
|
|
74
|
+
const abort = e?.error_details?._tag === "abort" ? e.error_details.value : undefined
|
|
75
|
+
const loc = abort?.location
|
|
76
|
+
const clever = abort?.clever_error
|
|
77
|
+
return {
|
|
78
|
+
_tag: "Failure",
|
|
79
|
+
description: e?.description ?? "unknown execution failure",
|
|
80
|
+
command: e?.command === undefined ? undefined : Number(e.command),
|
|
81
|
+
abortCode: abort?.abort_code,
|
|
82
|
+
...(loc?.package !== undefined && loc.module !== undefined && {
|
|
83
|
+
location: { package: Address.normalize(loc.package), module: loc.module, function: loc.function_name, instruction: loc.instruction }
|
|
84
|
+
}),
|
|
85
|
+
...(clever !== undefined && {
|
|
86
|
+
cleverError: {
|
|
87
|
+
errorCode: clever.error_code,
|
|
88
|
+
lineNumber: clever.line_number,
|
|
89
|
+
constantName: clever.constant_name,
|
|
90
|
+
constantType: clever.constant_type,
|
|
91
|
+
rendered: clever.value?._tag === "rendered" ? clever.value.value : undefined
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const OPS = { 1: "None", 2: "Created", 3: "Deleted" } as const
|
|
98
|
+
|
|
99
|
+
const changed = (c: P.ChangedObject): ChangedObject => ({
|
|
100
|
+
objectId: Address.normalize(required(c.object_id, "changed_objects.object_id")),
|
|
101
|
+
type: c.object_type,
|
|
102
|
+
operation: OPS[(c.id_operation ?? 1) as 1 | 2 | 3] ?? "None",
|
|
103
|
+
version: c.output_version,
|
|
104
|
+
digest: c.output_digest as ObjectDigest | undefined,
|
|
105
|
+
// A package write has no owner on the wire; packages are immutable.
|
|
106
|
+
owner: c.output_owner?.kind ? owner(c.output_owner) : c.output_state === 3 ? { _tag: "Immutable" } : undefined,
|
|
107
|
+
inputVersion: c.input_version,
|
|
108
|
+
inputDigest: c.input_digest as ObjectDigest | undefined,
|
|
109
|
+
inputOwner: c.input_owner?.kind ? owner(c.input_owner) : undefined
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
export const EFFECTS_PATHS = ["digest", "effects.status", "effects.gas_used", "effects.changed_objects"]
|
|
113
|
+
|
|
114
|
+
/** An event's own fields, as a transaction's events carry them (no position). */
|
|
115
|
+
const EVENT_CONTENT_PATHS = ["package_id", "module", "sender", "event_type", "contents"]
|
|
116
|
+
|
|
117
|
+
/** What `include` adds to a transaction's read mask. */
|
|
118
|
+
export const INCLUDE_PATHS: Record<Include, ReadonlyArray<string>> = {
|
|
119
|
+
events: EVENT_CONTENT_PATHS.map((p) => `events.events.${p}`),
|
|
120
|
+
balanceChanges: ["balance_changes"]
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** `Transactions.get` reads where the transaction landed as well: two scalars. */
|
|
124
|
+
export const LANDED_PATHS = ["checkpoint", "timestamp"]
|
|
125
|
+
|
|
126
|
+
/** The fields `LANDED_PATHS` read, those the node set. */
|
|
127
|
+
export const landed = (t: P.ExecutedTransaction | undefined): Pick<Effects, "checkpoint" | "timestampMs"> => ({
|
|
128
|
+
...(t?.checkpoint !== undefined && { checkpoint: t.checkpoint }),
|
|
129
|
+
...(t?.timestamp !== undefined && { timestampMs: millis(t.timestamp) })
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
export const maskWith = (paths: ReadonlyArray<string>, include: ReadonlyArray<Include> | undefined) =>
|
|
133
|
+
include?.length ? [...paths, ...new Set(include.flatMap((i) => INCLUDE_PATHS[i]))] : paths
|
|
134
|
+
|
|
135
|
+
const millis = (t: P.Timestamp | undefined) => (t?.seconds ?? 0n) * 1000n + BigInt(Math.floor((t?.nanos ?? 0) / 1e6))
|
|
136
|
+
|
|
137
|
+
const balanceChange = (b: P.BalanceChange): BalanceChange => ({
|
|
138
|
+
address: Address.normalize(required(b.address, "balance_changes.address")),
|
|
139
|
+
coinType: required(b.coin_type, "balance_changes.coin_type"),
|
|
140
|
+
amount: BigInt(required(b.amount, "balance_changes.amount"))
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Throws on a response without the transaction, its status or (unless the
|
|
145
|
+
* caller knows it: a simulation carries none) its digest; run it under `convert`.
|
|
146
|
+
* `include` lists what the read mask asked for, so it is present even when empty.
|
|
147
|
+
*/
|
|
148
|
+
export const effects = (t: P.ExecutedTransaction | undefined, knownDigest?: string, include?: ReadonlyArray<Include>): Effects => {
|
|
149
|
+
if (t === undefined) throw new Error("no transaction")
|
|
150
|
+
const digest = t.digest || knownDigest
|
|
151
|
+
if (!digest) throw new Error("no transaction digest")
|
|
152
|
+
return {
|
|
153
|
+
digest,
|
|
154
|
+
status: status(t.effects?.status),
|
|
155
|
+
gasUsed: gas(t.effects?.gas_used),
|
|
156
|
+
changedObjects: (t.effects?.changed_objects ?? []).map(changed),
|
|
157
|
+
...(include?.includes("events") && {
|
|
158
|
+
events: (t.events?.events ?? []).map((e, i) => transactionEvent(e, digest, i))
|
|
159
|
+
}),
|
|
160
|
+
...(include?.includes("balanceChanges") && { balanceChanges: (t.balance_changes ?? []).map(balanceChange) })
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export const EVENT_PATHS = [
|
|
165
|
+
...EVENT_CONTENT_PATHS,
|
|
166
|
+
"checkpoint",
|
|
167
|
+
"transaction_digest",
|
|
168
|
+
"transaction_index",
|
|
169
|
+
"event_index"
|
|
170
|
+
]
|
|
171
|
+
|
|
172
|
+
/** Fields missing from `e` (events nested in a transaction carry no position) come from the transaction. */
|
|
173
|
+
const transactionEvent = (e: P.Event, transactionDigest: string, eventIndex: number): TransactionEvent => ({
|
|
174
|
+
type: e.event_type ?? e.contents?.name ?? "",
|
|
175
|
+
sender: Address.normalize(e.sender ?? "0x0"),
|
|
176
|
+
packageId: Address.normalize(e.package_id ?? "0x0"),
|
|
177
|
+
module: e.module ?? "",
|
|
178
|
+
contents: e.contents?.value ?? new Uint8Array(),
|
|
179
|
+
transactionDigest: e.transaction_digest ?? transactionDigest,
|
|
180
|
+
eventIndex: e.event_index ?? eventIndex
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
/** Position fields missing from `e` (events nested in a transaction carry none) come from `at`. */
|
|
184
|
+
export const event = (
|
|
185
|
+
e: P.Event,
|
|
186
|
+
at?: { readonly checkpoint: bigint; readonly transactionDigest: string; readonly transactionIndex: bigint; readonly eventIndex: number }
|
|
187
|
+
): Event => ({
|
|
188
|
+
...transactionEvent(e, at?.transactionDigest ?? "", at?.eventIndex ?? 0),
|
|
189
|
+
checkpoint: e.checkpoint ?? at?.checkpoint ?? 0n,
|
|
190
|
+
transactionIndex: e.transaction_index ?? at?.transactionIndex ?? 0n
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
export const CHECKPOINT_PATHS = [
|
|
194
|
+
"sequence_number",
|
|
195
|
+
"digest",
|
|
196
|
+
"summary.epoch",
|
|
197
|
+
"summary.timestamp",
|
|
198
|
+
"transactions.digest",
|
|
199
|
+
"transactions.transaction_index",
|
|
200
|
+
...EFFECTS_PATHS.filter((p) => p !== "digest").map((p) => `transactions.${p}`),
|
|
201
|
+
...INCLUDE_PATHS.events.map((p) => `transactions.${p}`)
|
|
202
|
+
]
|
|
203
|
+
|
|
204
|
+
export const checkpoint = (c: P.Checkpoint | undefined): Checkpoint => {
|
|
205
|
+
if (c === undefined) throw new Error("no checkpoint")
|
|
206
|
+
const sequenceNumber = required(c.sequence_number, "checkpoint.sequence_number")
|
|
207
|
+
return {
|
|
208
|
+
sequenceNumber,
|
|
209
|
+
digest: required(c.digest, "checkpoint.digest"),
|
|
210
|
+
epoch: c.summary?.epoch ?? 0n,
|
|
211
|
+
timestampMs: millis(c.summary?.timestamp),
|
|
212
|
+
transactions: (c.transactions ?? []).map((t, i): CheckpointTransaction => {
|
|
213
|
+
const fx = effects(t)
|
|
214
|
+
const index = t.transaction_index ?? BigInt(i)
|
|
215
|
+
return {
|
|
216
|
+
digest: fx.digest,
|
|
217
|
+
index,
|
|
218
|
+
status: fx.status,
|
|
219
|
+
gasUsed: fx.gasUsed,
|
|
220
|
+
changedObjects: fx.changedObjects,
|
|
221
|
+
events: (t.events?.events ?? []).map((e, eventIndex) =>
|
|
222
|
+
event(e, { checkpoint: sequenceNumber, transactionDigest: fx.digest, transactionIndex: index, eventIndex })
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
}
|