@unconfirmed/effect-sui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +10 -2
- package/dist/Address.d.ts +18 -0
- package/dist/Address.d.ts.map +1 -0
- package/dist/Address.js +33 -0
- package/dist/Address.js.map +1 -0
- package/dist/AddressAlias.d.ts +107 -0
- package/dist/AddressAlias.d.ts.map +1 -0
- package/dist/AddressAlias.js +104 -0
- package/dist/AddressAlias.js.map +1 -0
- package/dist/Bip32.d.ts +6 -0
- package/dist/Bip32.d.ts.map +1 -0
- package/dist/Bip32.js +34 -0
- package/dist/Bip32.js.map +1 -0
- package/dist/Chain.d.ts +23 -0
- package/dist/Chain.d.ts.map +1 -0
- package/dist/Chain.js +7 -0
- package/dist/Chain.js.map +1 -0
- package/dist/CheckpointData.d.ts +74 -0
- package/dist/CheckpointData.d.ts.map +1 -0
- package/dist/CheckpointData.js +48 -0
- package/dist/CheckpointData.js.map +1 -0
- package/dist/Checkpoints.d.ts +23 -0
- package/dist/Checkpoints.d.ts.map +1 -0
- package/dist/Checkpoints.js +7 -0
- package/dist/Checkpoints.js.map +1 -0
- package/dist/CoinReservation.d.ts +18 -0
- package/dist/CoinReservation.d.ts.map +1 -0
- package/dist/CoinReservation.js +58 -0
- package/dist/CoinReservation.js.map +1 -0
- package/dist/Coins.d.ts +42 -0
- package/dist/Coins.d.ts.map +1 -0
- package/dist/Coins.js +49 -0
- package/dist/Coins.js.map +1 -0
- package/dist/DynamicFields.d.ts +115 -0
- package/dist/DynamicFields.d.ts.map +1 -0
- package/dist/DynamicFields.js +101 -0
- package/dist/DynamicFields.js.map +1 -0
- package/dist/Ecdsa.d.ts +39 -0
- package/dist/Ecdsa.d.ts.map +1 -0
- package/dist/Ecdsa.js +76 -0
- package/dist/Ecdsa.js.map +1 -0
- package/dist/Ed25519.d.ts +22 -0
- package/dist/Ed25519.d.ts.map +1 -0
- package/dist/Ed25519.js +77 -0
- package/dist/Ed25519.js.map +1 -0
- package/dist/Events.d.ts +105 -0
- package/dist/Events.d.ts.map +1 -0
- package/dist/Events.js +51 -0
- package/dist/Events.js.map +1 -0
- package/dist/Hash.d.ts +16 -0
- package/dist/Hash.d.ts.map +1 -0
- package/dist/Hash.js +32 -0
- package/dist/Hash.js.map +1 -0
- package/dist/MlDsa65.d.ts +17 -0
- package/dist/MlDsa65.d.ts.map +1 -0
- package/dist/MlDsa65.js +84 -0
- package/dist/MlDsa65.js.map +1 -0
- package/dist/Mnemonic.d.ts +20 -0
- package/dist/Mnemonic.d.ts.map +1 -0
- package/dist/Mnemonic.js +71 -0
- package/dist/Mnemonic.js.map +1 -0
- package/dist/Move.d.ts +261 -0
- package/dist/Move.d.ts.map +1 -0
- package/dist/Move.js +232 -0
- package/dist/Move.js.map +1 -0
- package/dist/MultiSig.d.ts +106 -0
- package/dist/MultiSig.d.ts.map +1 -0
- package/dist/MultiSig.js +254 -0
- package/dist/MultiSig.js.map +1 -0
- package/dist/Objects.d.ts +95 -0
- package/dist/Objects.d.ts.map +1 -0
- package/dist/Objects.js +57 -0
- package/dist/Objects.js.map +1 -0
- package/dist/Packages.d.ts +49 -0
- package/dist/Packages.d.ts.map +1 -0
- package/dist/Packages.js +16 -0
- package/dist/Packages.js.map +1 -0
- package/dist/Passkey.d.ts +11 -0
- package/dist/Passkey.d.ts.map +1 -0
- package/dist/Passkey.js +11 -0
- package/dist/Passkey.js.map +1 -0
- package/dist/PrivateKey.d.ts +39 -0
- package/dist/PrivateKey.d.ts.map +1 -0
- package/dist/PrivateKey.js +118 -0
- package/dist/PrivateKey.js.map +1 -0
- package/dist/Ptb.d.ts +413 -0
- package/dist/Ptb.d.ts.map +1 -0
- package/dist/Ptb.js +338 -0
- package/dist/Ptb.js.map +1 -0
- package/dist/Resolve.d.ts +502 -0
- package/dist/Resolve.d.ts.map +1 -0
- package/dist/Resolve.js +1188 -0
- package/dist/Resolve.js.map +1 -0
- package/dist/RpcError.d.ts +19 -0
- package/dist/RpcError.d.ts.map +1 -0
- package/dist/RpcError.js +37 -0
- package/dist/RpcError.js.map +1 -0
- package/dist/Secp256k1.d.ts +11 -0
- package/dist/Secp256k1.d.ts.map +1 -0
- package/dist/Secp256k1.js +23 -0
- package/dist/Secp256k1.js.map +1 -0
- package/dist/Secp256r1.d.ts +11 -0
- package/dist/Secp256r1.d.ts.map +1 -0
- package/dist/Secp256r1.js +23 -0
- package/dist/Secp256r1.js.map +1 -0
- package/dist/SignatureScheme.d.ts +103 -0
- package/dist/SignatureScheme.d.ts.map +1 -0
- package/dist/SignatureScheme.js +93 -0
- package/dist/SignatureScheme.js.map +1 -0
- package/dist/Signer.d.ts +54 -0
- package/dist/Signer.d.ts.map +1 -0
- package/dist/Signer.js +31 -0
- package/dist/Signer.js.map +1 -0
- package/dist/Testing.d.ts +171 -0
- package/dist/Testing.d.ts.map +1 -0
- package/dist/Testing.js +531 -0
- package/dist/Testing.js.map +1 -0
- package/dist/TransactionData.d.ts +3218 -0
- package/dist/TransactionData.d.ts.map +1 -0
- package/dist/TransactionData.js +105 -0
- package/dist/TransactionData.js.map +1 -0
- package/dist/TransactionJson.d.ts +1544 -0
- package/dist/TransactionJson.d.ts.map +1 -0
- package/dist/TransactionJson.js +926 -0
- package/dist/TransactionJson.js.map +1 -0
- package/dist/Transactions.d.ts +181 -0
- package/dist/Transactions.d.ts.map +1 -0
- package/dist/Transactions.js +49 -0
- package/dist/Transactions.js.map +1 -0
- package/dist/Tx.d.ts +1419 -0
- package/dist/Tx.d.ts.map +1 -0
- package/dist/Tx.js +266 -0
- package/dist/Tx.js.map +1 -0
- package/dist/TypeTag.d.ts +42 -0
- package/dist/TypeTag.d.ts.map +1 -0
- package/dist/TypeTag.js +110 -0
- package/dist/TypeTag.js.map +1 -0
- package/dist/Verify.d.ts +23 -0
- package/dist/Verify.d.ts.map +1 -0
- package/dist/Verify.js +29 -0
- package/dist/Verify.js.map +1 -0
- package/dist/enoki/EnokiClient.d.ts +184 -0
- package/dist/enoki/EnokiClient.d.ts.map +1 -0
- package/dist/enoki/EnokiClient.js +105 -0
- package/dist/enoki/EnokiClient.js.map +1 -0
- package/dist/enoki/EnokiHttp.d.ts +33 -0
- package/dist/enoki/EnokiHttp.d.ts.map +1 -0
- package/dist/enoki/EnokiHttp.js +160 -0
- package/dist/enoki/EnokiHttp.js.map +1 -0
- package/dist/enoki/Sponsor.d.ts +119 -0
- package/dist/enoki/Sponsor.d.ts.map +1 -0
- package/dist/enoki/Sponsor.js +170 -0
- package/dist/enoki/Sponsor.js.map +1 -0
- package/dist/enoki/ZkLoginFlow.d.ts +84 -0
- package/dist/enoki/ZkLoginFlow.d.ts.map +1 -0
- package/dist/enoki/ZkLoginFlow.js +138 -0
- package/dist/enoki/ZkLoginFlow.js.map +1 -0
- package/dist/enoki/index.d.ts +9 -0
- package/dist/enoki/index.d.ts.map +1 -0
- package/dist/enoki/index.js +9 -0
- package/dist/enoki/index.js.map +1 -0
- package/dist/graphql/ChainGraphQL.d.ts +35 -0
- package/dist/graphql/ChainGraphQL.d.ts.map +1 -0
- package/dist/graphql/ChainGraphQL.js +62 -0
- package/dist/graphql/ChainGraphQL.js.map +1 -0
- package/dist/graphql/CheckpointDataGraphQL.d.ts +785 -0
- package/dist/graphql/CheckpointDataGraphQL.d.ts.map +1 -0
- package/dist/graphql/CheckpointDataGraphQL.js +157 -0
- package/dist/graphql/CheckpointDataGraphQL.js.map +1 -0
- package/dist/graphql/CheckpointsGraphQL.d.ts +91 -0
- package/dist/graphql/CheckpointsGraphQL.d.ts.map +1 -0
- package/dist/graphql/CheckpointsGraphQL.js +80 -0
- package/dist/graphql/CheckpointsGraphQL.js.map +1 -0
- package/dist/graphql/CoinsGraphQL.d.ts +81 -0
- package/dist/graphql/CoinsGraphQL.d.ts.map +1 -0
- package/dist/graphql/CoinsGraphQL.js +63 -0
- package/dist/graphql/CoinsGraphQL.js.map +1 -0
- package/dist/graphql/DynamicFieldsGraphQL.d.ts +94 -0
- package/dist/graphql/DynamicFieldsGraphQL.d.ts.map +1 -0
- package/dist/graphql/DynamicFieldsGraphQL.js +126 -0
- package/dist/graphql/DynamicFieldsGraphQL.js.map +1 -0
- package/dist/graphql/EventsGraphQL.d.ts +266 -0
- package/dist/graphql/EventsGraphQL.d.ts.map +1 -0
- package/dist/graphql/EventsGraphQL.js +249 -0
- package/dist/graphql/EventsGraphQL.js.map +1 -0
- package/dist/graphql/ObjectsGraphQL.d.ts +130 -0
- package/dist/graphql/ObjectsGraphQL.d.ts.map +1 -0
- package/dist/graphql/ObjectsGraphQL.js +79 -0
- package/dist/graphql/ObjectsGraphQL.js.map +1 -0
- package/dist/graphql/PackagesGraphQL.d.ts +82 -0
- package/dist/graphql/PackagesGraphQL.d.ts.map +1 -0
- package/dist/graphql/PackagesGraphQL.js +145 -0
- package/dist/graphql/PackagesGraphQL.js.map +1 -0
- package/dist/graphql/SuiGraphQL.d.ts +37 -0
- package/dist/graphql/SuiGraphQL.d.ts.map +1 -0
- package/dist/graphql/SuiGraphQL.js +47 -0
- package/dist/graphql/SuiGraphQL.js.map +1 -0
- package/dist/graphql/TransactionsGraphQL.d.ts +1309 -0
- package/dist/graphql/TransactionsGraphQL.d.ts.map +1 -0
- package/dist/graphql/TransactionsGraphQL.js +206 -0
- package/dist/graphql/TransactionsGraphQL.js.map +1 -0
- package/dist/graphql/convert.d.ts +505 -0
- package/dist/graphql/convert.d.ts.map +1 -0
- package/dist/graphql/convert.js +384 -0
- package/dist/graphql/convert.js.map +1 -0
- package/dist/graphql/index.d.ts +41 -0
- package/dist/graphql/index.d.ts.map +1 -0
- package/dist/graphql/index.js +20 -0
- package/dist/graphql/index.js.map +1 -0
- package/dist/graphql/merge.d.ts +8 -0
- package/dist/graphql/merge.d.ts.map +1 -0
- package/dist/graphql/merge.js +55 -0
- package/dist/graphql/merge.js.map +1 -0
- package/dist/graphql/paging.d.ts +219 -0
- package/dist/graphql/paging.d.ts.map +1 -0
- package/dist/graphql/paging.js +74 -0
- package/dist/graphql/paging.js.map +1 -0
- package/dist/graphql/subscription.d.ts +27 -0
- package/dist/graphql/subscription.d.ts.map +1 -0
- package/dist/graphql/subscription.js +47 -0
- package/dist/graphql/subscription.js.map +1 -0
- package/dist/graphql/tip.d.ts +31 -0
- package/dist/graphql/tip.d.ts.map +1 -0
- package/dist/graphql/tip.js +29 -0
- package/dist/graphql/tip.js.map +1 -0
- package/dist/grpc/ChainGrpc.d.ts +11 -0
- package/dist/grpc/ChainGrpc.d.ts.map +1 -0
- package/dist/grpc/ChainGrpc.js +40 -0
- package/dist/grpc/ChainGrpc.js.map +1 -0
- package/dist/grpc/CheckpointDataGrpc.d.ts +6 -0
- package/dist/grpc/CheckpointDataGrpc.d.ts.map +1 -0
- package/dist/grpc/CheckpointDataGrpc.js +27 -0
- package/dist/grpc/CheckpointDataGrpc.js.map +1 -0
- package/dist/grpc/CheckpointsGrpc.d.ts +6 -0
- package/dist/grpc/CheckpointsGrpc.d.ts.map +1 -0
- package/dist/grpc/CheckpointsGrpc.js +25 -0
- package/dist/grpc/CheckpointsGrpc.js.map +1 -0
- package/dist/grpc/CoinsGrpc.d.ts +7 -0
- package/dist/grpc/CoinsGrpc.d.ts.map +1 -0
- package/dist/grpc/CoinsGrpc.js +34 -0
- package/dist/grpc/CoinsGrpc.js.map +1 -0
- package/dist/grpc/DynamicFieldsGrpc.d.ts +11 -0
- package/dist/grpc/DynamicFieldsGrpc.d.ts.map +1 -0
- package/dist/grpc/DynamicFieldsGrpc.js +91 -0
- package/dist/grpc/DynamicFieldsGrpc.js.map +1 -0
- package/dist/grpc/EventsGrpc.d.ts +13 -0
- package/dist/grpc/EventsGrpc.d.ts.map +1 -0
- package/dist/grpc/EventsGrpc.js +88 -0
- package/dist/grpc/EventsGrpc.js.map +1 -0
- package/dist/grpc/GrpcWeb.d.ts +71 -0
- package/dist/grpc/GrpcWeb.d.ts.map +1 -0
- package/dist/grpc/GrpcWeb.js +243 -0
- package/dist/grpc/GrpcWeb.js.map +1 -0
- package/dist/grpc/ObjectsGrpc.d.ts +10 -0
- package/dist/grpc/ObjectsGrpc.d.ts.map +1 -0
- package/dist/grpc/ObjectsGrpc.js +72 -0
- package/dist/grpc/ObjectsGrpc.js.map +1 -0
- package/dist/grpc/PackagesGrpc.d.ts +9 -0
- package/dist/grpc/PackagesGrpc.d.ts.map +1 -0
- package/dist/grpc/PackagesGrpc.js +78 -0
- package/dist/grpc/PackagesGrpc.js.map +1 -0
- package/dist/grpc/Rpc.d.ts +46 -0
- package/dist/grpc/Rpc.d.ts.map +1 -0
- package/dist/grpc/Rpc.js +111 -0
- package/dist/grpc/Rpc.js.map +1 -0
- package/dist/grpc/TransactionsGrpc.d.ts +6 -0
- package/dist/grpc/TransactionsGrpc.d.ts.map +1 -0
- package/dist/grpc/TransactionsGrpc.js +56 -0
- package/dist/grpc/TransactionsGrpc.js.map +1 -0
- package/dist/grpc/cache.d.ts +7 -0
- package/dist/grpc/cache.d.ts.map +1 -0
- package/dist/grpc/cache.js +55 -0
- package/dist/grpc/cache.js.map +1 -0
- package/dist/grpc/convert.d.ts +43 -0
- package/dist/grpc/convert.d.ts.map +1 -0
- package/dist/grpc/convert.js +198 -0
- package/dist/grpc/convert.js.map +1 -0
- package/dist/grpc/generated/lean.d.ts +36 -0
- package/dist/grpc/generated/lean.d.ts.map +1 -0
- package/dist/grpc/generated/lean.js +205 -0
- package/dist/grpc/generated/lean.js.map +1 -0
- package/dist/grpc/generated/proto.d.ts +2000 -0
- package/dist/grpc/generated/proto.d.ts.map +1 -0
- package/dist/grpc/generated/proto.js +356 -0
- package/dist/grpc/generated/proto.js.map +1 -0
- package/dist/grpc/generated/rpc.d.ts +62 -0
- package/dist/grpc/generated/rpc.d.ts.map +1 -0
- package/dist/grpc/generated/rpc.js +324 -0
- package/dist/grpc/generated/rpc.js.map +1 -0
- package/dist/grpc/index.d.ts +58 -0
- package/dist/grpc/index.d.ts.map +1 -0
- package/dist/grpc/index.js +43 -0
- package/dist/grpc/index.js.map +1 -0
- package/dist/grpc/scan.d.ts +79 -0
- package/dist/grpc/scan.d.ts.map +1 -0
- package/dist/grpc/scan.js +126 -0
- package/dist/grpc/scan.js.map +1 -0
- package/dist/grpc/transaction.d.ts +9 -0
- package/dist/grpc/transaction.d.ts.map +1 -0
- package/dist/grpc/transaction.js +168 -0
- package/dist/grpc/transaction.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/allowances.d.ts +18 -0
- package/dist/internal/allowances.d.ts.map +1 -0
- package/dist/internal/allowances.js +194 -0
- package/dist/internal/allowances.js.map +1 -0
- package/dist/internal/mnemonic.d.ts +53 -0
- package/dist/internal/mnemonic.d.ts.map +1 -0
- package/dist/internal/mnemonic.js +66 -0
- package/dist/internal/mnemonic.js.map +1 -0
- package/dist/internal/passkey/BrowserProvider.d.ts +10 -0
- package/dist/internal/passkey/BrowserProvider.d.ts.map +1 -0
- package/dist/internal/passkey/BrowserProvider.js +101 -0
- package/dist/internal/passkey/BrowserProvider.js.map +1 -0
- package/dist/internal/passkey/Passkey.d.ts +104 -0
- package/dist/internal/passkey/Passkey.d.ts.map +1 -0
- package/dist/internal/passkey/Passkey.js +333 -0
- package/dist/internal/passkey/Passkey.js.map +1 -0
- package/dist/internal/passkey/SoftwareProvider.d.ts +23 -0
- package/dist/internal/passkey/SoftwareProvider.d.ts.map +1 -0
- package/dist/internal/passkey/SoftwareProvider.js +61 -0
- package/dist/internal/passkey/SoftwareProvider.js.map +1 -0
- package/dist/lifecycle/Evidence.d.ts +62 -0
- package/dist/lifecycle/Evidence.d.ts.map +1 -0
- package/dist/lifecycle/Evidence.js +30 -0
- package/dist/lifecycle/Evidence.js.map +1 -0
- package/dist/lifecycle/EvidenceGraphQL.d.ts +59 -0
- package/dist/lifecycle/EvidenceGraphQL.d.ts.map +1 -0
- package/dist/lifecycle/EvidenceGraphQL.js +53 -0
- package/dist/lifecycle/EvidenceGraphQL.js.map +1 -0
- package/dist/lifecycle/EvidenceGrpc.d.ts +4 -0
- package/dist/lifecycle/EvidenceGrpc.d.ts.map +1 -0
- package/dist/lifecycle/EvidenceGrpc.js +37 -0
- package/dist/lifecycle/EvidenceGrpc.js.map +1 -0
- package/dist/lifecycle/Journal.d.ts +69 -0
- package/dist/lifecycle/Journal.d.ts.map +1 -0
- package/dist/lifecycle/Journal.js +70 -0
- package/dist/lifecycle/Journal.js.map +1 -0
- package/dist/lifecycle/JournalEntry.d.ts +67 -0
- package/dist/lifecycle/JournalEntry.d.ts.map +1 -0
- package/dist/lifecycle/JournalEntry.js +45 -0
- package/dist/lifecycle/JournalEntry.js.map +1 -0
- package/dist/lifecycle/JournalKeyValueStore.d.ts +30 -0
- package/dist/lifecycle/JournalKeyValueStore.d.ts.map +1 -0
- package/dist/lifecycle/JournalKeyValueStore.js +217 -0
- package/dist/lifecycle/JournalKeyValueStore.js.map +1 -0
- package/dist/lifecycle/KeyValueStoreIndexedDb.d.ts +54 -0
- package/dist/lifecycle/KeyValueStoreIndexedDb.d.ts.map +1 -0
- package/dist/lifecycle/KeyValueStoreIndexedDb.js +321 -0
- package/dist/lifecycle/KeyValueStoreIndexedDb.js.map +1 -0
- package/dist/lifecycle/KeyValueStoreOpfs.d.ts +65 -0
- package/dist/lifecycle/KeyValueStoreOpfs.d.ts.map +1 -0
- package/dist/lifecycle/KeyValueStoreOpfs.js +207 -0
- package/dist/lifecycle/KeyValueStoreOpfs.js.map +1 -0
- package/dist/lifecycle/Lifecycle.d.ts +416 -0
- package/dist/lifecycle/Lifecycle.d.ts.map +1 -0
- package/dist/lifecycle/Lifecycle.js +666 -0
- package/dist/lifecycle/Lifecycle.js.map +1 -0
- package/dist/lifecycle/Outcome.d.ts +132 -0
- package/dist/lifecycle/Outcome.d.ts.map +1 -0
- package/dist/lifecycle/Outcome.js +106 -0
- package/dist/lifecycle/Outcome.js.map +1 -0
- package/dist/lifecycle/SenderLock.d.ts +37 -0
- package/dist/lifecycle/SenderLock.d.ts.map +1 -0
- package/dist/lifecycle/SenderLock.js +57 -0
- package/dist/lifecycle/SenderLock.js.map +1 -0
- package/dist/lifecycle/SenderLockWebLocks.d.ts +37 -0
- package/dist/lifecycle/SenderLockWebLocks.d.ts.map +1 -0
- package/dist/lifecycle/SenderLockWebLocks.js +100 -0
- package/dist/lifecycle/SenderLockWebLocks.js.map +1 -0
- package/dist/lifecycle/SignedTransaction.d.ts +55 -0
- package/dist/lifecycle/SignedTransaction.d.ts.map +1 -0
- package/dist/lifecycle/SignedTransaction.js +109 -0
- package/dist/lifecycle/SignedTransaction.js.map +1 -0
- package/dist/lifecycle/SubmitConfig.d.ts +44 -0
- package/dist/lifecycle/SubmitConfig.d.ts.map +1 -0
- package/dist/lifecycle/SubmitConfig.js +39 -0
- package/dist/lifecycle/SubmitConfig.js.map +1 -0
- package/dist/lifecycle/index.d.ts +13 -0
- package/dist/lifecycle/index.d.ts.map +1 -0
- package/dist/lifecycle/index.js +13 -0
- package/dist/lifecycle/index.js.map +1 -0
- package/dist/wallet/Features.d.ts +91 -0
- package/dist/wallet/Features.d.ts.map +1 -0
- package/dist/wallet/Features.js +14 -0
- package/dist/wallet/Features.js.map +1 -0
- package/dist/wallet/Wallet.d.ts +151 -0
- package/dist/wallet/Wallet.d.ts.map +1 -0
- package/dist/wallet/Wallet.js +399 -0
- package/dist/wallet/Wallet.js.map +1 -0
- package/dist/wallet/index.d.ts +6 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +6 -0
- package/dist/wallet/index.js.map +1 -0
- package/dist/zklogin/AddressSeed.d.ts +40 -0
- package/dist/zklogin/AddressSeed.d.ts.map +1 -0
- package/dist/zklogin/AddressSeed.js +91 -0
- package/dist/zklogin/AddressSeed.js.map +1 -0
- package/dist/zklogin/Errors.d.ts +24 -0
- package/dist/zklogin/Errors.d.ts.map +1 -0
- package/dist/zklogin/Errors.js +25 -0
- package/dist/zklogin/Errors.js.map +1 -0
- package/dist/zklogin/Jwt.d.ts +51 -0
- package/dist/zklogin/Jwt.d.ts.map +1 -0
- package/dist/zklogin/Jwt.js +159 -0
- package/dist/zklogin/Jwt.js.map +1 -0
- package/dist/zklogin/Nonce.d.ts +9 -0
- package/dist/zklogin/Nonce.d.ts.map +1 -0
- package/dist/zklogin/Nonce.js +34 -0
- package/dist/zklogin/Nonce.js.map +1 -0
- package/dist/zklogin/Poseidon.d.ts +24 -0
- package/dist/zklogin/Poseidon.d.ts.map +1 -0
- package/dist/zklogin/Poseidon.js +54 -0
- package/dist/zklogin/Poseidon.js.map +1 -0
- package/dist/zklogin/PublicIdentifier.d.ts +49 -0
- package/dist/zklogin/PublicIdentifier.d.ts.map +1 -0
- package/dist/zklogin/PublicIdentifier.js +90 -0
- package/dist/zklogin/PublicIdentifier.js.map +1 -0
- package/dist/zklogin/Signature.d.ts +55 -0
- package/dist/zklogin/Signature.d.ts.map +1 -0
- package/dist/zklogin/Signature.js +70 -0
- package/dist/zklogin/Signature.js.map +1 -0
- package/dist/zklogin/ZkLogin.d.ts +41 -0
- package/dist/zklogin/ZkLogin.d.ts.map +1 -0
- package/dist/zklogin/ZkLogin.js +87 -0
- package/dist/zklogin/ZkLogin.js.map +1 -0
- package/dist/zklogin/ZkLoginAddress.d.ts +30 -0
- package/dist/zklogin/ZkLoginAddress.d.ts.map +1 -0
- package/dist/zklogin/ZkLoginAddress.js +31 -0
- package/dist/zklogin/ZkLoginAddress.js.map +1 -0
- package/dist/zklogin/ZkLoginVerifier.d.ts +37 -0
- package/dist/zklogin/ZkLoginVerifier.d.ts.map +1 -0
- package/dist/zklogin/ZkLoginVerifier.js +4 -0
- package/dist/zklogin/ZkLoginVerifier.js.map +1 -0
- package/dist/zklogin/ZkLoginVerifierGrpc.d.ts +12 -0
- package/dist/zklogin/ZkLoginVerifierGrpc.d.ts.map +1 -0
- package/dist/zklogin/ZkLoginVerifierGrpc.js +53 -0
- package/dist/zklogin/ZkLoginVerifierGrpc.js.map +1 -0
- package/dist/zklogin/index.d.ts +17 -0
- package/dist/zklogin/index.d.ts.map +1 -0
- package/dist/zklogin/index.js +17 -0
- package/dist/zklogin/index.js.map +1 -0
- package/dist/zklogin/internal/parse.d.ts +9 -0
- package/dist/zklogin/internal/parse.d.ts.map +1 -0
- package/dist/zklogin/internal/parse.js +33 -0
- package/dist/zklogin/internal/parse.js.map +1 -0
- package/dist/zklogin/internal/poseidon.d.ts +21 -0
- package/dist/zklogin/internal/poseidon.d.ts.map +1 -0
- package/dist/zklogin/internal/poseidon.js +40 -0
- package/dist/zklogin/internal/poseidon.js.map +1 -0
- package/package.json +69 -4
- package/src/Address.ts +45 -0
- package/src/AddressAlias.ts +160 -0
- package/src/Bip32.ts +37 -0
- package/src/Chain.ts +21 -0
- package/src/CheckpointData.ts +106 -0
- package/src/Checkpoints.ts +18 -0
- package/src/CoinReservation.ts +65 -0
- package/src/Coins.ts +86 -0
- package/src/DynamicFields.ts +179 -0
- package/src/Ecdsa.ts +103 -0
- package/src/Ed25519.ts +84 -0
- package/src/Events.ts +133 -0
- package/src/Hash.ts +39 -0
- package/src/MlDsa65.ts +92 -0
- package/src/Mnemonic.ts +109 -0
- package/src/Move.ts +440 -0
- package/src/MultiSig.ts +320 -0
- package/src/Objects.ts +112 -0
- package/src/Packages.ts +52 -0
- package/src/Passkey.ts +10 -0
- package/src/PrivateKey.ts +138 -0
- package/src/Ptb.ts +579 -0
- package/src/Resolve.ts +1367 -0
- package/src/RpcError.ts +41 -0
- package/src/Secp256k1.ts +29 -0
- package/src/Secp256r1.ts +29 -0
- package/src/SignatureScheme.ts +166 -0
- package/src/Signer.ts +62 -0
- package/src/Testing.ts +830 -0
- package/src/TransactionData.ts +134 -0
- package/src/TransactionJson.ts +1002 -0
- package/src/Transactions.ts +211 -0
- package/src/Tx.ts +367 -0
- package/src/TypeTag.ts +123 -0
- package/src/Verify.ts +42 -0
- package/src/enoki/EnokiClient.ts +204 -0
- package/src/enoki/EnokiHttp.ts +222 -0
- package/src/enoki/Sponsor.ts +280 -0
- package/src/enoki/ZkLoginFlow.ts +176 -0
- package/src/enoki/index.ts +8 -0
- package/src/graphql/ChainGraphQL.ts +76 -0
- package/src/graphql/CheckpointDataGraphQL.ts +191 -0
- package/src/graphql/CheckpointsGraphQL.ts +96 -0
- package/src/graphql/CoinsGraphQL.ts +85 -0
- package/src/graphql/DynamicFieldsGraphQL.ts +167 -0
- package/src/graphql/EventsGraphQL.ts +301 -0
- package/src/graphql/ObjectsGraphQL.ts +112 -0
- package/src/graphql/PackagesGraphQL.ts +173 -0
- package/src/graphql/SuiGraphQL.ts +77 -0
- package/src/graphql/TransactionsGraphQL.ts +292 -0
- package/src/graphql/convert.ts +450 -0
- package/src/graphql/index.ts +74 -0
- package/src/graphql/merge.ts +62 -0
- package/src/graphql/paging.ts +110 -0
- package/src/graphql/subscription.ts +58 -0
- package/src/graphql/tip.ts +38 -0
- package/src/grpc/ChainGrpc.ts +51 -0
- package/src/grpc/CheckpointDataGrpc.ts +47 -0
- package/src/grpc/CheckpointsGrpc.ts +37 -0
- package/src/grpc/CoinsGrpc.ts +50 -0
- package/src/grpc/DynamicFieldsGrpc.ts +128 -0
- package/src/grpc/EventsGrpc.ts +101 -0
- package/src/grpc/GrpcWeb.ts +343 -0
- package/src/grpc/ObjectsGrpc.ts +95 -0
- package/src/grpc/PackagesGrpc.ts +98 -0
- package/src/grpc/Rpc.ts +156 -0
- package/src/grpc/TransactionsGrpc.ts +88 -0
- package/src/grpc/cache.ts +68 -0
- package/src/grpc/convert.ts +227 -0
- package/src/grpc/generated/lean.ts +276 -0
- package/src/grpc/generated/proto.ts +2130 -0
- package/src/grpc/generated/rpc.ts +417 -0
- package/src/grpc/index.ts +97 -0
- package/src/grpc/scan.ts +183 -0
- package/src/grpc/transaction.ts +182 -0
- package/src/index.ts +35 -0
- package/src/internal/allowances.ts +238 -0
- package/src/internal/mnemonic.ts +99 -0
- package/src/internal/passkey/BrowserProvider.ts +131 -0
- package/src/internal/passkey/Passkey.ts +408 -0
- package/src/internal/passkey/SoftwareProvider.ts +90 -0
- package/src/lifecycle/Evidence.ts +85 -0
- package/src/lifecycle/EvidenceGraphQL.ts +67 -0
- package/src/lifecycle/EvidenceGrpc.ts +47 -0
- package/src/lifecycle/Journal.ts +117 -0
- package/src/lifecycle/JournalEntry.ts +68 -0
- package/src/lifecycle/JournalKeyValueStore.ts +276 -0
- package/src/lifecycle/KeyValueStoreIndexedDb.ts +361 -0
- package/src/lifecycle/KeyValueStoreOpfs.ts +230 -0
- package/src/lifecycle/Lifecycle.ts +990 -0
- package/src/lifecycle/Outcome.ts +130 -0
- package/src/lifecycle/SenderLock.ts +73 -0
- package/src/lifecycle/SenderLockWebLocks.ts +136 -0
- package/src/lifecycle/SignedTransaction.ts +133 -0
- package/src/lifecycle/SubmitConfig.ts +77 -0
- package/src/lifecycle/index.ts +12 -0
- package/src/wallet/Features.ts +114 -0
- package/src/wallet/Wallet.ts +550 -0
- package/src/wallet/index.ts +5 -0
- package/src/zklogin/AddressSeed.ts +130 -0
- package/src/zklogin/Errors.ts +27 -0
- package/src/zklogin/Jwt.ts +186 -0
- package/src/zklogin/Nonce.ts +46 -0
- package/src/zklogin/Poseidon.ts +62 -0
- package/src/zklogin/PublicIdentifier.ts +111 -0
- package/src/zklogin/Signature.ts +88 -0
- package/src/zklogin/ZkLogin.ts +145 -0
- package/src/zklogin/ZkLoginAddress.ts +72 -0
- package/src/zklogin/ZkLoginVerifier.ts +37 -0
- package/src/zklogin/ZkLoginVerifierGrpc.ts +66 -0
- package/src/zklogin/index.ts +16 -0
- package/src/zklogin/internal/parse.ts +30 -0
- package/src/zklogin/internal/poseidon.ts +47 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@unconfirmed/effect-sui/grpc`: every capability over gRPC-web.
|
|
3
|
+
*
|
|
4
|
+
* - `layerCore({ url })`: Chain, Objects, Coins, Packages and Transactions,
|
|
5
|
+
* everything `Tx.run` needs. Prefer it: a program ships only the RPCs it links.
|
|
6
|
+
* - `layer({ url })`: all nine, adding Checkpoints, CheckpointData, Events and
|
|
7
|
+
* DynamicFields (about 25 KB minified more).
|
|
8
|
+
* - Or compose exactly what you use; each `*Grpc.layer` needs `GrpcWeb`, which
|
|
9
|
+
* `layerCore` also provides:
|
|
10
|
+
*
|
|
11
|
+
* DynamicFieldsGrpc.layer.pipe(Layer.provideMerge(SuiGrpc.layerCore({ url })))
|
|
12
|
+
* Layer.mergeAll(ObjectsGrpc.layer, TransactionsGrpc.layer).pipe(Layer.provide(GrpcWeb.layer({ url })))
|
|
13
|
+
*/
|
|
14
|
+
import * as Layer from "effect/Layer"
|
|
15
|
+
import type * as HttpClient from "effect/http/HttpClient"
|
|
16
|
+
import type { Chain } from "../Chain.ts"
|
|
17
|
+
import type { CheckpointData } from "../CheckpointData.ts"
|
|
18
|
+
import type { Checkpoints } from "../Checkpoints.ts"
|
|
19
|
+
import type { Coins } from "../Coins.ts"
|
|
20
|
+
import type { DynamicFields } from "../DynamicFields.ts"
|
|
21
|
+
import type { Events } from "../Events.ts"
|
|
22
|
+
import type { Objects } from "../Objects.ts"
|
|
23
|
+
import type { Packages } from "../Packages.ts"
|
|
24
|
+
import type { Transactions } from "../Transactions.ts"
|
|
25
|
+
import * as ChainGrpc from "./ChainGrpc.ts"
|
|
26
|
+
import * as CheckpointDataGrpc from "./CheckpointDataGrpc.ts"
|
|
27
|
+
import * as CheckpointsGrpc from "./CheckpointsGrpc.ts"
|
|
28
|
+
import * as CoinsGrpc from "./CoinsGrpc.ts"
|
|
29
|
+
import * as DynamicFieldsGrpc from "./DynamicFieldsGrpc.ts"
|
|
30
|
+
import * as EventsGrpc from "./EventsGrpc.ts"
|
|
31
|
+
import { GrpcWeb, type GrpcWebOptions } from "./GrpcWeb.ts"
|
|
32
|
+
import * as ObjectsGrpc from "./ObjectsGrpc.ts"
|
|
33
|
+
import * as PackagesGrpc from "./PackagesGrpc.ts"
|
|
34
|
+
import * as TransactionsGrpc from "./TransactionsGrpc.ts"
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
ChainGrpc,
|
|
38
|
+
CheckpointDataGrpc,
|
|
39
|
+
CheckpointsGrpc,
|
|
40
|
+
CoinsGrpc,
|
|
41
|
+
DynamicFieldsGrpc,
|
|
42
|
+
EventsGrpc,
|
|
43
|
+
GrpcWeb,
|
|
44
|
+
ObjectsGrpc,
|
|
45
|
+
PackagesGrpc,
|
|
46
|
+
TransactionsGrpc
|
|
47
|
+
}
|
|
48
|
+
export type { GrpcWebOptions }
|
|
49
|
+
export type * as Proto from "./generated/proto.ts"
|
|
50
|
+
/** Every RPC as a typed handle, for calls the capability services don't cover: `grpc.unary(Rpc.NameService_LookupName, { name })`. */
|
|
51
|
+
export * as Rpc from "./generated/rpc.ts"
|
|
52
|
+
|
|
53
|
+
/** What `layerCore` provides: the services building, resolving and executing a transaction use. */
|
|
54
|
+
export type CoreServices = Chain | Objects | Coins | Packages | Transactions
|
|
55
|
+
|
|
56
|
+
export type Services =
|
|
57
|
+
| Chain
|
|
58
|
+
| Objects
|
|
59
|
+
| Coins
|
|
60
|
+
| Packages
|
|
61
|
+
| Transactions
|
|
62
|
+
| Checkpoints
|
|
63
|
+
| DynamicFields
|
|
64
|
+
| Events
|
|
65
|
+
| CheckpointData
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Chain, Objects, Coins, Packages and Transactions over one gRPC-web endpoint,
|
|
69
|
+
* plus the `GrpcWeb` client itself so further `*Grpc.layer`s can be stacked on
|
|
70
|
+
* top. Needs an `HttpClient`. Links none of the checkpoint, event or dynamic
|
|
71
|
+
* field RPCs.
|
|
72
|
+
*/
|
|
73
|
+
export const layerCore = (options: GrpcWebOptions): Layer.Layer<CoreServices | GrpcWeb, never, HttpClient.HttpClient> =>
|
|
74
|
+
Layer.mergeAll(
|
|
75
|
+
ChainGrpc.layer,
|
|
76
|
+
PackagesGrpc.layer,
|
|
77
|
+
TransactionsGrpc.layer,
|
|
78
|
+
CoinsGrpc.layer.pipe(Layer.provideMerge(ObjectsGrpc.layer))
|
|
79
|
+
).pipe(Layer.provideMerge(GrpcWeb.layer(options)))
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* All nine capability services over one gRPC-web endpoint, plus the `GrpcWeb`
|
|
83
|
+
* client itself (for `EvidenceGrpc`, `ZkLoginVerifierGrpc` or `grpc.unary`
|
|
84
|
+
* calls on the same transport). Needs an `HttpClient`. This links every RPC
|
|
85
|
+
* the services use; a program that only builds and executes transactions is
|
|
86
|
+
* smaller with `layerCore`.
|
|
87
|
+
*/
|
|
88
|
+
export const layer = (options: GrpcWebOptions): Layer.Layer<Services | GrpcWeb, never, HttpClient.HttpClient> =>
|
|
89
|
+
Layer.mergeAll(
|
|
90
|
+
ChainGrpc.layer,
|
|
91
|
+
PackagesGrpc.layer,
|
|
92
|
+
TransactionsGrpc.layer,
|
|
93
|
+
CheckpointsGrpc.layer,
|
|
94
|
+
CheckpointDataGrpc.layer,
|
|
95
|
+
EventsGrpc.layer,
|
|
96
|
+
Layer.mergeAll(CoinsGrpc.layer, DynamicFieldsGrpc.layer).pipe(Layer.provideMerge(ObjectsGrpc.layer))
|
|
97
|
+
).pipe(Layer.provideMerge(GrpcWeb.layer(options)))
|
package/src/grpc/scan.ts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ledger scans (`ListCheckpoints`, `ListEvents`, ...) stop at a server-chosen
|
|
3
|
+
* item or scan budget and say so in a final `QueryEnd` frame. `resumable` turns
|
|
4
|
+
* one into a single stream by re-opening from the last watermark until the
|
|
5
|
+
* scan reaches its real end (range bound, cursor bound or ledger tip).
|
|
6
|
+
*/
|
|
7
|
+
import * as Effect from "effect/Effect"
|
|
8
|
+
import * as Stream from "effect/Stream"
|
|
9
|
+
import { RpcError } from "../RpcError.ts"
|
|
10
|
+
import { convert } from "./convert.ts"
|
|
11
|
+
import type * as P from "./generated/proto.ts"
|
|
12
|
+
import * as Rpc from "./generated/lean.ts"
|
|
13
|
+
import type { GrpcWeb } from "./GrpcWeb.ts"
|
|
14
|
+
import * as Bytes from "@unconfirmed/effect-bcs/Bytes"
|
|
15
|
+
|
|
16
|
+
interface Frame<A> {
|
|
17
|
+
readonly item: A | undefined
|
|
18
|
+
readonly watermark: P.Watermark | undefined
|
|
19
|
+
readonly end: P.QueryEnd | undefined
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** ITEM_LIMIT and SCAN_LIMIT: the server stopped early; resume from the watermark. */
|
|
23
|
+
const budgetExhausted = (end: P.QueryEnd) => end.reason === 1 || end.reason === 2
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export { convert }
|
|
27
|
+
|
|
28
|
+
export interface Recovery {
|
|
29
|
+
/**
|
|
30
|
+
* Called when a request fails with `error` after the scan reached `last`
|
|
31
|
+
* (`undefined` before any watermark): `"retry"` re-opens from `last`,
|
|
32
|
+
* `"end"` ends the scan cleanly, a failure fails it.
|
|
33
|
+
*/
|
|
34
|
+
readonly recover: (error: RpcError, last: P.Watermark | undefined) => Effect.Effect<"retry" | "end", RpcError>
|
|
35
|
+
/** Consecutive recoveries without a new watermark before the error is raised instead (default 3). */
|
|
36
|
+
readonly attempts?: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const resumable = <F, A>(
|
|
40
|
+
method: string,
|
|
41
|
+
open: (resume: P.Watermark | undefined) => Stream.Stream<F, RpcError>,
|
|
42
|
+
read: (frame: F) => Frame<A>,
|
|
43
|
+
recovery?: Recovery
|
|
44
|
+
): Stream.Stream<A, RpcError> => {
|
|
45
|
+
const fail = (message: string) => Stream.fail(new RpcError({ method, code: "DATA_LOSS", message }))
|
|
46
|
+
const maxAttempts = recovery?.attempts ?? 3
|
|
47
|
+
const go = (resume: P.Watermark | undefined, attempts: number): Stream.Stream<A, RpcError> =>
|
|
48
|
+
Stream.suspend(() => {
|
|
49
|
+
let last = resume
|
|
50
|
+
let stoppedEarly = false
|
|
51
|
+
let sawEnd = false
|
|
52
|
+
let recovered = false
|
|
53
|
+
let items = 0
|
|
54
|
+
const body = open(resume).pipe(
|
|
55
|
+
Stream.mapEffect((f) =>
|
|
56
|
+
convert(method, () => {
|
|
57
|
+
const frame = read(f)
|
|
58
|
+
if (frame.watermark?.cursor) last = frame.watermark
|
|
59
|
+
if (frame.end) {
|
|
60
|
+
sawEnd = true
|
|
61
|
+
if (budgetExhausted(frame.end)) stoppedEarly = true
|
|
62
|
+
}
|
|
63
|
+
if (frame.item !== undefined) items++
|
|
64
|
+
return frame.item
|
|
65
|
+
})
|
|
66
|
+
),
|
|
67
|
+
Stream.filter((a): a is A => a !== undefined)
|
|
68
|
+
)
|
|
69
|
+
const guarded = recovery === undefined ? body : body.pipe(
|
|
70
|
+
Stream.catch((error) => {
|
|
71
|
+
const progressed = last?.cursor !== undefined && !(resume?.cursor && Bytes.equal(resume.cursor, last.cursor))
|
|
72
|
+
const tries = progressed ? 1 : attempts + 1
|
|
73
|
+
if (tries > maxAttempts) return Stream.fail(error)
|
|
74
|
+
recovered = true
|
|
75
|
+
return Stream.unwrap(
|
|
76
|
+
Effect.map(recovery.recover(error, last), (next) => (next === "end" ? Stream.empty : go(last, tries)))
|
|
77
|
+
)
|
|
78
|
+
})
|
|
79
|
+
)
|
|
80
|
+
return Stream.concat(
|
|
81
|
+
guarded,
|
|
82
|
+
Stream.suspend(() => {
|
|
83
|
+
if (recovered) return Stream.empty
|
|
84
|
+
// Every successful scan stream ends with exactly one `QueryEnd` frame;
|
|
85
|
+
// a stream without one was cut short and has not delivered its range.
|
|
86
|
+
if (!sawEnd) return fail("the scan stream ended without its QueryEnd frame")
|
|
87
|
+
if (!stoppedEarly) return Stream.empty
|
|
88
|
+
if (!last?.cursor) return fail("scan stopped at a budget without a resume cursor")
|
|
89
|
+
if (items === 0 && resume?.cursor && Bytes.equal(resume.cursor, last.cursor)) {
|
|
90
|
+
return fail("scan made no progress (the same resume cursor twice)")
|
|
91
|
+
}
|
|
92
|
+
return go(last, 0)
|
|
93
|
+
})
|
|
94
|
+
)
|
|
95
|
+
})
|
|
96
|
+
return go(undefined, 0)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** The node's ledger window: `[lowest, tip + 1)`, read fresh. */
|
|
100
|
+
export const ledgerWindow = (grpc: GrpcWeb["Service"]) =>
|
|
101
|
+
grpc.unary(Rpc.LedgerService_GetServiceInfo, {}).pipe(
|
|
102
|
+
Effect.flatMap((i) =>
|
|
103
|
+
i.checkpoint_height === undefined
|
|
104
|
+
? Effect.fail(new RpcError({ method: Rpc.LedgerService_GetServiceInfo.path, code: "UNAVAILABLE", message: "incomplete response: no checkpoint_height" }))
|
|
105
|
+
: Effect.succeed({ lowest: i.lowest_available_checkpoint ?? 0n, end: i.checkpoint_height + 1n })
|
|
106
|
+
)
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Pin the open ends of a scan's range before the first request, so resumed
|
|
111
|
+
* requests scan the same window: an ascending scan without `end` stops at the
|
|
112
|
+
* tip as of the call (not a moving tip), and a descending scan without `start`
|
|
113
|
+
* stops at the pruning floor (the node rejects a descending scan that runs into
|
|
114
|
+
* it).
|
|
115
|
+
*/
|
|
116
|
+
export const pinned = <A>(
|
|
117
|
+
grpc: GrpcWeb["Service"],
|
|
118
|
+
range: { readonly start?: bigint | undefined; readonly end?: bigint | undefined },
|
|
119
|
+
descending: boolean,
|
|
120
|
+
f: (range: { readonly start: bigint | undefined; readonly end: bigint | undefined }) => Stream.Stream<A, RpcError>
|
|
121
|
+
): Stream.Stream<A, RpcError> => {
|
|
122
|
+
const needs = descending ? range.start === undefined : range.end === undefined
|
|
123
|
+
if (!needs) return f({ start: range.start, end: range.end })
|
|
124
|
+
return Stream.unwrap(
|
|
125
|
+
Effect.map(ledgerWindow(grpc), (w) =>
|
|
126
|
+
descending ? f({ start: w.lowest, end: range.end }) : f({ start: range.start, end: w.end })
|
|
127
|
+
)
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Request bounds for an event scan resumed at `w` (see `Watermark` in
|
|
133
|
+
* query_options.proto): ascending continues from its position with `after`,
|
|
134
|
+
* descending ends at it with `before`.
|
|
135
|
+
*/
|
|
136
|
+
export const eventBounds = (
|
|
137
|
+
w: P.Watermark | undefined,
|
|
138
|
+
base: { readonly start?: bigint | undefined; readonly end?: bigint | undefined },
|
|
139
|
+
descending: boolean
|
|
140
|
+
) => {
|
|
141
|
+
const pos = w?.cursor_position
|
|
142
|
+
const tx = pos?.transaction_index ?? 0n
|
|
143
|
+
const ev = pos?.event_index ?? 0
|
|
144
|
+
const indexed = tx !== 0n || ev !== 0
|
|
145
|
+
if (!w) {
|
|
146
|
+
return {
|
|
147
|
+
...(base.start !== undefined && { start_checkpoint: base.start }),
|
|
148
|
+
...(base.end !== undefined && { end_checkpoint: base.end })
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (!descending) {
|
|
152
|
+
return {
|
|
153
|
+
...(pos?.checkpoint !== undefined
|
|
154
|
+
? { start_checkpoint: pos.checkpoint, ...(indexed && { start_transaction_index: tx, start_event_index: ev }) }
|
|
155
|
+
: base.start !== undefined && { start_checkpoint: base.start }),
|
|
156
|
+
...(base.end !== undefined && { end_checkpoint: base.end })
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
...(base.start !== undefined && { start_checkpoint: base.start }),
|
|
161
|
+
...(pos?.checkpoint !== undefined
|
|
162
|
+
? indexed
|
|
163
|
+
? { end_checkpoint: pos.checkpoint + 1n, end_transaction_index: tx, end_event_index: ev }
|
|
164
|
+
: { end_checkpoint: pos.checkpoint }
|
|
165
|
+
: base.end !== undefined && { end_checkpoint: base.end })
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Request bounds for an ascending checkpoint scan resumed at `w`. */
|
|
170
|
+
export const checkpointBounds = (
|
|
171
|
+
w: P.Watermark | undefined,
|
|
172
|
+
base: { readonly start?: bigint | undefined; readonly end?: bigint | undefined }
|
|
173
|
+
) => {
|
|
174
|
+
const start = w?.cursor_position?.checkpoint ?? base.start
|
|
175
|
+
return {
|
|
176
|
+
...(start !== undefined && { start_checkpoint: start }),
|
|
177
|
+
...(base.end !== undefined && { end_checkpoint: base.end })
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Per-request item limits (the node coerces larger values down to its maximum). */
|
|
182
|
+
export const EVENT_LIMIT = 1000
|
|
183
|
+
export const CHECKPOINT_LIMIT = 50
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An unresolved transaction as a structured `sui.rpc.v2.Transaction`, for
|
|
3
|
+
* `SimulateTransaction` with gas selection (`Transactions.resolve`). Object
|
|
4
|
+
* inputs the caller left unresolved carry only their id (and a forced
|
|
5
|
+
* mutability); everything already resolved is sent as it is. GraphQL's
|
|
6
|
+
* `simulateTransaction` takes the same message as proto3 JSON.
|
|
7
|
+
*/
|
|
8
|
+
import * as Option from "effect/Option"
|
|
9
|
+
import type { UnresolvedObject } from "../Ptb.ts"
|
|
10
|
+
import type * as T from "../TransactionData.ts"
|
|
11
|
+
import type { UnresolvedTransaction } from "../Transactions.ts"
|
|
12
|
+
import * as TypeTag from "../TypeTag.ts"
|
|
13
|
+
import type * as P from "./generated/proto.ts"
|
|
14
|
+
|
|
15
|
+
// Enum values of sui.rpc.v2 (literals, so no enum table is linked).
|
|
16
|
+
const ARG_GAS = 1
|
|
17
|
+
const ARG_INPUT = 2
|
|
18
|
+
const ARG_RESULT = 3
|
|
19
|
+
const INPUT_PURE = 1
|
|
20
|
+
const INPUT_OWNED = 2
|
|
21
|
+
const INPUT_SHARED = 3
|
|
22
|
+
const INPUT_RECEIVING = 4
|
|
23
|
+
const INPUT_FUNDS = 5
|
|
24
|
+
const MUTABILITY_NON_EXCLUSIVE_WRITE = 3
|
|
25
|
+
const SOURCE = { Sender: 1, Sponsor: 2, SenderAllowance: 3 } as const
|
|
26
|
+
const EXPIRATION = { None: 1, Epoch: 2, ValidDuring: 3, Validity: 4 } as const
|
|
27
|
+
|
|
28
|
+
const argument = (a: T.Argument): P.Argument => {
|
|
29
|
+
switch (a._tag) {
|
|
30
|
+
case "GasCoin":
|
|
31
|
+
return { kind: ARG_GAS }
|
|
32
|
+
case "Input":
|
|
33
|
+
return { kind: ARG_INPUT, input: a.value }
|
|
34
|
+
case "Result":
|
|
35
|
+
return { kind: ARG_RESULT, result: a.value }
|
|
36
|
+
case "NestedResult":
|
|
37
|
+
return { kind: ARG_RESULT, result: a.value[0], subresult: a.value[1] }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const input = (i: T.CallArg | UnresolvedObject): P.Input => {
|
|
42
|
+
switch (i._tag) {
|
|
43
|
+
case "UnresolvedObject":
|
|
44
|
+
return { object_id: i.objectId, ...(i.mutable !== undefined && { mutable: i.mutable }) }
|
|
45
|
+
case "Pure":
|
|
46
|
+
return { kind: INPUT_PURE, pure: i.bytes }
|
|
47
|
+
case "FundsWithdrawal": {
|
|
48
|
+
const from = i.withdrawFrom
|
|
49
|
+
return {
|
|
50
|
+
kind: INPUT_FUNDS,
|
|
51
|
+
funds_withdrawal: {
|
|
52
|
+
amount: i.reservation.value,
|
|
53
|
+
coin_type: TypeTag.format(i.typeArg.value),
|
|
54
|
+
source: SOURCE[from._tag],
|
|
55
|
+
...(from._tag === "SenderAllowance" && { funder: from.funder, allowance: from.allowance })
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
case "Object": {
|
|
60
|
+
const o = i.value
|
|
61
|
+
switch (o._tag) {
|
|
62
|
+
case "ImmOrOwnedObject":
|
|
63
|
+
return { kind: INPUT_OWNED, object_id: o.objectId, version: o.version, digest: o.digest }
|
|
64
|
+
case "Receiving":
|
|
65
|
+
return { kind: INPUT_RECEIVING, object_id: o.objectId, version: o.version, digest: o.digest }
|
|
66
|
+
case "SharedObject":
|
|
67
|
+
return {
|
|
68
|
+
kind: INPUT_SHARED,
|
|
69
|
+
object_id: o.objectId,
|
|
70
|
+
version: o.initialSharedVersion,
|
|
71
|
+
mutable: o.mutability._tag === "Mutable",
|
|
72
|
+
...(o.mutability._tag === "NonExclusiveWrite" && { mutability: MUTABILITY_NON_EXCLUSIVE_WRITE })
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const command = (c: T.Command): P.Command => {
|
|
80
|
+
switch (c._tag) {
|
|
81
|
+
case "MoveCall":
|
|
82
|
+
return {
|
|
83
|
+
command: {
|
|
84
|
+
_tag: "move_call",
|
|
85
|
+
value: {
|
|
86
|
+
package: c.package,
|
|
87
|
+
module: c.module,
|
|
88
|
+
function: c.function,
|
|
89
|
+
type_arguments: c.typeArguments.map(TypeTag.format),
|
|
90
|
+
arguments: c.arguments.map(argument)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
case "TransferObjects":
|
|
95
|
+
return { command: { _tag: "transfer_objects", value: { objects: c.objects.map(argument), address: argument(c.address) } } }
|
|
96
|
+
case "SplitCoins":
|
|
97
|
+
return { command: { _tag: "split_coins", value: { coin: argument(c.coin), amounts: c.amounts.map(argument) } } }
|
|
98
|
+
case "MergeCoins":
|
|
99
|
+
return { command: { _tag: "merge_coins", value: { coin: argument(c.destination), coins_to_merge: c.sources.map(argument) } } }
|
|
100
|
+
case "Publish":
|
|
101
|
+
return { command: { _tag: "publish", value: { modules: c.modules, dependencies: c.dependencies } } }
|
|
102
|
+
case "MakeMoveVec":
|
|
103
|
+
return {
|
|
104
|
+
command: {
|
|
105
|
+
_tag: "make_move_vector",
|
|
106
|
+
value: {
|
|
107
|
+
...(Option.isSome(c.type) && { element_type: TypeTag.format(c.type.value) }),
|
|
108
|
+
elements: c.elements.map(argument)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
case "Upgrade":
|
|
113
|
+
return {
|
|
114
|
+
command: {
|
|
115
|
+
_tag: "upgrade",
|
|
116
|
+
value: { modules: c.modules, dependencies: c.dependencies, package: c.package, ticket: argument(c.ticket) }
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const timestamp = (ms: Option.Option<bigint>): P.Timestamp | undefined =>
|
|
123
|
+
Option.isSome(ms) ? { seconds: ms.value / 1000n, nanos: Number(ms.value % 1000n) * 1_000_000 } : undefined
|
|
124
|
+
|
|
125
|
+
const expiration = (e: T.TransactionExpiration): P.TransactionExpiration => {
|
|
126
|
+
switch (e._tag) {
|
|
127
|
+
case "None":
|
|
128
|
+
return { kind: EXPIRATION.None }
|
|
129
|
+
case "Epoch":
|
|
130
|
+
return { kind: EXPIRATION.Epoch, epoch: e.value }
|
|
131
|
+
case "ValidDuring":
|
|
132
|
+
case "Validity": {
|
|
133
|
+
const v = e
|
|
134
|
+
const proposers = e._tag === "Validity" && Option.isSome(e.allowedProposers) ? e.allowedProposers.value : undefined
|
|
135
|
+
const minTimestamp = timestamp(v.minTimestamp)
|
|
136
|
+
const maxTimestamp = timestamp(v.maxTimestamp)
|
|
137
|
+
return {
|
|
138
|
+
kind: EXPIRATION[e._tag],
|
|
139
|
+
...(Option.isSome(v.minEpoch) && { min_epoch: v.minEpoch.value }),
|
|
140
|
+
...(Option.isSome(v.maxEpoch) && { epoch: v.maxEpoch.value }),
|
|
141
|
+
...(minTimestamp && { min_timestamp: minTimestamp }),
|
|
142
|
+
...(maxTimestamp && { max_timestamp: maxTimestamp }),
|
|
143
|
+
chain: v.chain,
|
|
144
|
+
nonce: v.nonce,
|
|
145
|
+
...(proposers && { allowed_proposers: { epoch: proposers.epoch, proposers: proposers.proposers } })
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** The unresolved transaction as a `sui.rpc.v2.Transaction` (`version` 1, a programmable kind). */
|
|
152
|
+
export const toProto = (tx: UnresolvedTransaction): P.Transaction => ({
|
|
153
|
+
version: 1,
|
|
154
|
+
kind: {
|
|
155
|
+
data: {
|
|
156
|
+
_tag: "programmable_transaction",
|
|
157
|
+
value: { inputs: tx.inputs.map(input), commands: tx.commands.map(command) }
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
sender: tx.sender,
|
|
161
|
+
gas_payment: {
|
|
162
|
+
objects: (tx.gasPayment ?? []).map((r) => ({ object_id: r.objectId, version: r.version, digest: r.digest })),
|
|
163
|
+
owner: tx.gasOwner,
|
|
164
|
+
...(tx.gasPrice !== undefined && { price: tx.gasPrice }),
|
|
165
|
+
...(tx.gasBudget !== undefined && { budget: tx.gasBudget })
|
|
166
|
+
},
|
|
167
|
+
...(tx.expiration && { expiration: expiration(tx.expiration) })
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
/** Ask for gas selection unless the caller fixed both the budget and the payment. */
|
|
171
|
+
export const needsGasSelection = (tx: UnresolvedTransaction): boolean =>
|
|
172
|
+
tx.gasBudget === undefined || tx.gasPayment === undefined
|
|
173
|
+
|
|
174
|
+
/** Read-mask paths (from the `SimulateTransactionResponse`) a resolution reads. */
|
|
175
|
+
export const RESOLVE_PATHS = [
|
|
176
|
+
"transaction.transaction.bcs",
|
|
177
|
+
"transaction.digest",
|
|
178
|
+
"transaction.effects.status",
|
|
179
|
+
"transaction.effects.gas_used",
|
|
180
|
+
"transaction.effects.changed_objects",
|
|
181
|
+
"transaction.effects.epoch"
|
|
182
|
+
]
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@unconfirmed/effect-sui`: the core.
|
|
3
|
+
*
|
|
4
|
+
* Pure modules (no services): Address, TypeTag, TransactionData, TransactionJson, Hash, Ptb.
|
|
5
|
+
* Capability services (implemented by `@unconfirmed/effect-sui/grpc`): Chain, Objects,
|
|
6
|
+
* Coins, Packages, Transactions, Checkpoints, DynamicFields, Events, CheckpointData.
|
|
7
|
+
* Signing: Signer (+ TransactionSigner for wallets), SignatureScheme (the plugin registry), Verify, Ed25519, PrivateKey (suiprivkey, sui.keystore).
|
|
8
|
+
* Other schemes are packages: `@unconfirmed/effect-sui/Secp256k1`, `-secp256r1`, `-multisig`, ...
|
|
9
|
+
*/
|
|
10
|
+
export * as Address from "./Address.ts"
|
|
11
|
+
export * as AddressAlias from "./AddressAlias.ts"
|
|
12
|
+
export * as Chain from "./Chain.ts"
|
|
13
|
+
export * as CheckpointData from "./CheckpointData.ts"
|
|
14
|
+
export * as Checkpoints from "./Checkpoints.ts"
|
|
15
|
+
export * as CoinReservation from "./CoinReservation.ts"
|
|
16
|
+
export * as Coins from "./Coins.ts"
|
|
17
|
+
export * as DynamicFields from "./DynamicFields.ts"
|
|
18
|
+
export * as Ed25519 from "./Ed25519.ts"
|
|
19
|
+
export * as Events from "./Events.ts"
|
|
20
|
+
export * as Hash from "./Hash.ts"
|
|
21
|
+
export * as Move from "./Move.ts"
|
|
22
|
+
export * as Objects from "./Objects.ts"
|
|
23
|
+
export * as Packages from "./Packages.ts"
|
|
24
|
+
export * as PrivateKey from "./PrivateKey.ts"
|
|
25
|
+
export * as Ptb from "./Ptb.ts"
|
|
26
|
+
export * as Resolve from "./Resolve.ts"
|
|
27
|
+
export * as RpcError from "./RpcError.ts"
|
|
28
|
+
export * as SignatureScheme from "./SignatureScheme.ts"
|
|
29
|
+
export * as Signer from "./Signer.ts"
|
|
30
|
+
export * as TransactionData from "./TransactionData.ts"
|
|
31
|
+
export * as TransactionJson from "./TransactionJson.ts"
|
|
32
|
+
export * as Transactions from "./Transactions.ts"
|
|
33
|
+
export * as Tx from "./Tx.ts"
|
|
34
|
+
export * as TypeTag from "./TypeTag.ts"
|
|
35
|
+
export * as Verify from "./Verify.ts"
|