@unconfirmed/effect-sui 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +10 -2
- package/dist/Address.d.ts +18 -0
- package/dist/Address.d.ts.map +1 -0
- package/dist/Address.js +33 -0
- package/dist/Address.js.map +1 -0
- package/dist/AddressAlias.d.ts +107 -0
- package/dist/AddressAlias.d.ts.map +1 -0
- package/dist/AddressAlias.js +104 -0
- package/dist/AddressAlias.js.map +1 -0
- package/dist/Bip32.d.ts +6 -0
- package/dist/Bip32.d.ts.map +1 -0
- package/dist/Bip32.js +34 -0
- package/dist/Bip32.js.map +1 -0
- package/dist/Chain.d.ts +23 -0
- package/dist/Chain.d.ts.map +1 -0
- package/dist/Chain.js +7 -0
- package/dist/Chain.js.map +1 -0
- package/dist/CheckpointData.d.ts +74 -0
- package/dist/CheckpointData.d.ts.map +1 -0
- package/dist/CheckpointData.js +48 -0
- package/dist/CheckpointData.js.map +1 -0
- package/dist/Checkpoints.d.ts +23 -0
- package/dist/Checkpoints.d.ts.map +1 -0
- package/dist/Checkpoints.js +7 -0
- package/dist/Checkpoints.js.map +1 -0
- package/dist/CoinReservation.d.ts +18 -0
- package/dist/CoinReservation.d.ts.map +1 -0
- package/dist/CoinReservation.js +58 -0
- package/dist/CoinReservation.js.map +1 -0
- package/dist/Coins.d.ts +42 -0
- package/dist/Coins.d.ts.map +1 -0
- package/dist/Coins.js +49 -0
- package/dist/Coins.js.map +1 -0
- package/dist/DynamicFields.d.ts +115 -0
- package/dist/DynamicFields.d.ts.map +1 -0
- package/dist/DynamicFields.js +101 -0
- package/dist/DynamicFields.js.map +1 -0
- package/dist/Ecdsa.d.ts +39 -0
- package/dist/Ecdsa.d.ts.map +1 -0
- package/dist/Ecdsa.js +76 -0
- package/dist/Ecdsa.js.map +1 -0
- package/dist/Ed25519.d.ts +22 -0
- package/dist/Ed25519.d.ts.map +1 -0
- package/dist/Ed25519.js +77 -0
- package/dist/Ed25519.js.map +1 -0
- package/dist/Events.d.ts +105 -0
- package/dist/Events.d.ts.map +1 -0
- package/dist/Events.js +51 -0
- package/dist/Events.js.map +1 -0
- package/dist/Hash.d.ts +16 -0
- package/dist/Hash.d.ts.map +1 -0
- package/dist/Hash.js +32 -0
- package/dist/Hash.js.map +1 -0
- package/dist/MlDsa65.d.ts +17 -0
- package/dist/MlDsa65.d.ts.map +1 -0
- package/dist/MlDsa65.js +84 -0
- package/dist/MlDsa65.js.map +1 -0
- package/dist/Mnemonic.d.ts +20 -0
- package/dist/Mnemonic.d.ts.map +1 -0
- package/dist/Mnemonic.js +71 -0
- package/dist/Mnemonic.js.map +1 -0
- package/dist/Move.d.ts +261 -0
- package/dist/Move.d.ts.map +1 -0
- package/dist/Move.js +232 -0
- package/dist/Move.js.map +1 -0
- package/dist/MultiSig.d.ts +106 -0
- package/dist/MultiSig.d.ts.map +1 -0
- package/dist/MultiSig.js +254 -0
- package/dist/MultiSig.js.map +1 -0
- package/dist/Objects.d.ts +95 -0
- package/dist/Objects.d.ts.map +1 -0
- package/dist/Objects.js +57 -0
- package/dist/Objects.js.map +1 -0
- package/dist/Packages.d.ts +49 -0
- package/dist/Packages.d.ts.map +1 -0
- package/dist/Packages.js +16 -0
- package/dist/Packages.js.map +1 -0
- package/dist/Passkey.d.ts +11 -0
- package/dist/Passkey.d.ts.map +1 -0
- package/dist/Passkey.js +11 -0
- package/dist/Passkey.js.map +1 -0
- package/dist/PrivateKey.d.ts +39 -0
- package/dist/PrivateKey.d.ts.map +1 -0
- package/dist/PrivateKey.js +118 -0
- package/dist/PrivateKey.js.map +1 -0
- package/dist/Ptb.d.ts +413 -0
- package/dist/Ptb.d.ts.map +1 -0
- package/dist/Ptb.js +338 -0
- package/dist/Ptb.js.map +1 -0
- package/dist/Resolve.d.ts +502 -0
- package/dist/Resolve.d.ts.map +1 -0
- package/dist/Resolve.js +1188 -0
- package/dist/Resolve.js.map +1 -0
- package/dist/RpcError.d.ts +19 -0
- package/dist/RpcError.d.ts.map +1 -0
- package/dist/RpcError.js +37 -0
- package/dist/RpcError.js.map +1 -0
- package/dist/Secp256k1.d.ts +11 -0
- package/dist/Secp256k1.d.ts.map +1 -0
- package/dist/Secp256k1.js +23 -0
- package/dist/Secp256k1.js.map +1 -0
- package/dist/Secp256r1.d.ts +11 -0
- package/dist/Secp256r1.d.ts.map +1 -0
- package/dist/Secp256r1.js +23 -0
- package/dist/Secp256r1.js.map +1 -0
- package/dist/SignatureScheme.d.ts +103 -0
- package/dist/SignatureScheme.d.ts.map +1 -0
- package/dist/SignatureScheme.js +93 -0
- package/dist/SignatureScheme.js.map +1 -0
- package/dist/Signer.d.ts +54 -0
- package/dist/Signer.d.ts.map +1 -0
- package/dist/Signer.js +31 -0
- package/dist/Signer.js.map +1 -0
- package/dist/Testing.d.ts +171 -0
- package/dist/Testing.d.ts.map +1 -0
- package/dist/Testing.js +531 -0
- package/dist/Testing.js.map +1 -0
- package/dist/TransactionData.d.ts +3218 -0
- package/dist/TransactionData.d.ts.map +1 -0
- package/dist/TransactionData.js +105 -0
- package/dist/TransactionData.js.map +1 -0
- package/dist/TransactionJson.d.ts +1544 -0
- package/dist/TransactionJson.d.ts.map +1 -0
- package/dist/TransactionJson.js +926 -0
- package/dist/TransactionJson.js.map +1 -0
- package/dist/Transactions.d.ts +181 -0
- package/dist/Transactions.d.ts.map +1 -0
- package/dist/Transactions.js +49 -0
- package/dist/Transactions.js.map +1 -0
- package/dist/Tx.d.ts +1419 -0
- package/dist/Tx.d.ts.map +1 -0
- package/dist/Tx.js +266 -0
- package/dist/Tx.js.map +1 -0
- package/dist/TypeTag.d.ts +42 -0
- package/dist/TypeTag.d.ts.map +1 -0
- package/dist/TypeTag.js +110 -0
- package/dist/TypeTag.js.map +1 -0
- package/dist/Verify.d.ts +23 -0
- package/dist/Verify.d.ts.map +1 -0
- package/dist/Verify.js +29 -0
- package/dist/Verify.js.map +1 -0
- package/dist/enoki/EnokiClient.d.ts +184 -0
- package/dist/enoki/EnokiClient.d.ts.map +1 -0
- package/dist/enoki/EnokiClient.js +105 -0
- package/dist/enoki/EnokiClient.js.map +1 -0
- package/dist/enoki/EnokiHttp.d.ts +33 -0
- package/dist/enoki/EnokiHttp.d.ts.map +1 -0
- package/dist/enoki/EnokiHttp.js +160 -0
- package/dist/enoki/EnokiHttp.js.map +1 -0
- package/dist/enoki/Sponsor.d.ts +119 -0
- package/dist/enoki/Sponsor.d.ts.map +1 -0
- package/dist/enoki/Sponsor.js +170 -0
- package/dist/enoki/Sponsor.js.map +1 -0
- package/dist/enoki/ZkLoginFlow.d.ts +84 -0
- package/dist/enoki/ZkLoginFlow.d.ts.map +1 -0
- package/dist/enoki/ZkLoginFlow.js +138 -0
- package/dist/enoki/ZkLoginFlow.js.map +1 -0
- package/dist/enoki/index.d.ts +9 -0
- package/dist/enoki/index.d.ts.map +1 -0
- package/dist/enoki/index.js +9 -0
- package/dist/enoki/index.js.map +1 -0
- package/dist/graphql/ChainGraphQL.d.ts +35 -0
- package/dist/graphql/ChainGraphQL.d.ts.map +1 -0
- package/dist/graphql/ChainGraphQL.js +62 -0
- package/dist/graphql/ChainGraphQL.js.map +1 -0
- package/dist/graphql/CheckpointDataGraphQL.d.ts +785 -0
- package/dist/graphql/CheckpointDataGraphQL.d.ts.map +1 -0
- package/dist/graphql/CheckpointDataGraphQL.js +157 -0
- package/dist/graphql/CheckpointDataGraphQL.js.map +1 -0
- package/dist/graphql/CheckpointsGraphQL.d.ts +91 -0
- package/dist/graphql/CheckpointsGraphQL.d.ts.map +1 -0
- package/dist/graphql/CheckpointsGraphQL.js +80 -0
- package/dist/graphql/CheckpointsGraphQL.js.map +1 -0
- package/dist/graphql/CoinsGraphQL.d.ts +81 -0
- package/dist/graphql/CoinsGraphQL.d.ts.map +1 -0
- package/dist/graphql/CoinsGraphQL.js +63 -0
- package/dist/graphql/CoinsGraphQL.js.map +1 -0
- package/dist/graphql/DynamicFieldsGraphQL.d.ts +94 -0
- package/dist/graphql/DynamicFieldsGraphQL.d.ts.map +1 -0
- package/dist/graphql/DynamicFieldsGraphQL.js +126 -0
- package/dist/graphql/DynamicFieldsGraphQL.js.map +1 -0
- package/dist/graphql/EventsGraphQL.d.ts +266 -0
- package/dist/graphql/EventsGraphQL.d.ts.map +1 -0
- package/dist/graphql/EventsGraphQL.js +249 -0
- package/dist/graphql/EventsGraphQL.js.map +1 -0
- package/dist/graphql/ObjectsGraphQL.d.ts +130 -0
- package/dist/graphql/ObjectsGraphQL.d.ts.map +1 -0
- package/dist/graphql/ObjectsGraphQL.js +79 -0
- package/dist/graphql/ObjectsGraphQL.js.map +1 -0
- package/dist/graphql/PackagesGraphQL.d.ts +82 -0
- package/dist/graphql/PackagesGraphQL.d.ts.map +1 -0
- package/dist/graphql/PackagesGraphQL.js +145 -0
- package/dist/graphql/PackagesGraphQL.js.map +1 -0
- package/dist/graphql/SuiGraphQL.d.ts +37 -0
- package/dist/graphql/SuiGraphQL.d.ts.map +1 -0
- package/dist/graphql/SuiGraphQL.js +47 -0
- package/dist/graphql/SuiGraphQL.js.map +1 -0
- package/dist/graphql/TransactionsGraphQL.d.ts +1309 -0
- package/dist/graphql/TransactionsGraphQL.d.ts.map +1 -0
- package/dist/graphql/TransactionsGraphQL.js +206 -0
- package/dist/graphql/TransactionsGraphQL.js.map +1 -0
- package/dist/graphql/convert.d.ts +505 -0
- package/dist/graphql/convert.d.ts.map +1 -0
- package/dist/graphql/convert.js +384 -0
- package/dist/graphql/convert.js.map +1 -0
- package/dist/graphql/index.d.ts +41 -0
- package/dist/graphql/index.d.ts.map +1 -0
- package/dist/graphql/index.js +20 -0
- package/dist/graphql/index.js.map +1 -0
- package/dist/graphql/merge.d.ts +8 -0
- package/dist/graphql/merge.d.ts.map +1 -0
- package/dist/graphql/merge.js +55 -0
- package/dist/graphql/merge.js.map +1 -0
- package/dist/graphql/paging.d.ts +219 -0
- package/dist/graphql/paging.d.ts.map +1 -0
- package/dist/graphql/paging.js +74 -0
- package/dist/graphql/paging.js.map +1 -0
- package/dist/graphql/subscription.d.ts +27 -0
- package/dist/graphql/subscription.d.ts.map +1 -0
- package/dist/graphql/subscription.js +47 -0
- package/dist/graphql/subscription.js.map +1 -0
- package/dist/graphql/tip.d.ts +31 -0
- package/dist/graphql/tip.d.ts.map +1 -0
- package/dist/graphql/tip.js +29 -0
- package/dist/graphql/tip.js.map +1 -0
- package/dist/grpc/ChainGrpc.d.ts +11 -0
- package/dist/grpc/ChainGrpc.d.ts.map +1 -0
- package/dist/grpc/ChainGrpc.js +40 -0
- package/dist/grpc/ChainGrpc.js.map +1 -0
- package/dist/grpc/CheckpointDataGrpc.d.ts +6 -0
- package/dist/grpc/CheckpointDataGrpc.d.ts.map +1 -0
- package/dist/grpc/CheckpointDataGrpc.js +27 -0
- package/dist/grpc/CheckpointDataGrpc.js.map +1 -0
- package/dist/grpc/CheckpointsGrpc.d.ts +6 -0
- package/dist/grpc/CheckpointsGrpc.d.ts.map +1 -0
- package/dist/grpc/CheckpointsGrpc.js +25 -0
- package/dist/grpc/CheckpointsGrpc.js.map +1 -0
- package/dist/grpc/CoinsGrpc.d.ts +7 -0
- package/dist/grpc/CoinsGrpc.d.ts.map +1 -0
- package/dist/grpc/CoinsGrpc.js +34 -0
- package/dist/grpc/CoinsGrpc.js.map +1 -0
- package/dist/grpc/DynamicFieldsGrpc.d.ts +11 -0
- package/dist/grpc/DynamicFieldsGrpc.d.ts.map +1 -0
- package/dist/grpc/DynamicFieldsGrpc.js +91 -0
- package/dist/grpc/DynamicFieldsGrpc.js.map +1 -0
- package/dist/grpc/EventsGrpc.d.ts +13 -0
- package/dist/grpc/EventsGrpc.d.ts.map +1 -0
- package/dist/grpc/EventsGrpc.js +88 -0
- package/dist/grpc/EventsGrpc.js.map +1 -0
- package/dist/grpc/GrpcWeb.d.ts +71 -0
- package/dist/grpc/GrpcWeb.d.ts.map +1 -0
- package/dist/grpc/GrpcWeb.js +243 -0
- package/dist/grpc/GrpcWeb.js.map +1 -0
- package/dist/grpc/ObjectsGrpc.d.ts +10 -0
- package/dist/grpc/ObjectsGrpc.d.ts.map +1 -0
- package/dist/grpc/ObjectsGrpc.js +72 -0
- package/dist/grpc/ObjectsGrpc.js.map +1 -0
- package/dist/grpc/PackagesGrpc.d.ts +9 -0
- package/dist/grpc/PackagesGrpc.d.ts.map +1 -0
- package/dist/grpc/PackagesGrpc.js +78 -0
- package/dist/grpc/PackagesGrpc.js.map +1 -0
- package/dist/grpc/Rpc.d.ts +46 -0
- package/dist/grpc/Rpc.d.ts.map +1 -0
- package/dist/grpc/Rpc.js +111 -0
- package/dist/grpc/Rpc.js.map +1 -0
- package/dist/grpc/TransactionsGrpc.d.ts +6 -0
- package/dist/grpc/TransactionsGrpc.d.ts.map +1 -0
- package/dist/grpc/TransactionsGrpc.js +56 -0
- package/dist/grpc/TransactionsGrpc.js.map +1 -0
- package/dist/grpc/cache.d.ts +7 -0
- package/dist/grpc/cache.d.ts.map +1 -0
- package/dist/grpc/cache.js +55 -0
- package/dist/grpc/cache.js.map +1 -0
- package/dist/grpc/convert.d.ts +43 -0
- package/dist/grpc/convert.d.ts.map +1 -0
- package/dist/grpc/convert.js +198 -0
- package/dist/grpc/convert.js.map +1 -0
- package/dist/grpc/generated/lean.d.ts +36 -0
- package/dist/grpc/generated/lean.d.ts.map +1 -0
- package/dist/grpc/generated/lean.js +205 -0
- package/dist/grpc/generated/lean.js.map +1 -0
- package/dist/grpc/generated/proto.d.ts +2000 -0
- package/dist/grpc/generated/proto.d.ts.map +1 -0
- package/dist/grpc/generated/proto.js +356 -0
- package/dist/grpc/generated/proto.js.map +1 -0
- package/dist/grpc/generated/rpc.d.ts +62 -0
- package/dist/grpc/generated/rpc.d.ts.map +1 -0
- package/dist/grpc/generated/rpc.js +324 -0
- package/dist/grpc/generated/rpc.js.map +1 -0
- package/dist/grpc/index.d.ts +58 -0
- package/dist/grpc/index.d.ts.map +1 -0
- package/dist/grpc/index.js +43 -0
- package/dist/grpc/index.js.map +1 -0
- package/dist/grpc/scan.d.ts +79 -0
- package/dist/grpc/scan.d.ts.map +1 -0
- package/dist/grpc/scan.js +126 -0
- package/dist/grpc/scan.js.map +1 -0
- package/dist/grpc/transaction.d.ts +9 -0
- package/dist/grpc/transaction.d.ts.map +1 -0
- package/dist/grpc/transaction.js +168 -0
- package/dist/grpc/transaction.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/allowances.d.ts +18 -0
- package/dist/internal/allowances.d.ts.map +1 -0
- package/dist/internal/allowances.js +194 -0
- package/dist/internal/allowances.js.map +1 -0
- package/dist/internal/mnemonic.d.ts +53 -0
- package/dist/internal/mnemonic.d.ts.map +1 -0
- package/dist/internal/mnemonic.js +66 -0
- package/dist/internal/mnemonic.js.map +1 -0
- package/dist/internal/passkey/BrowserProvider.d.ts +10 -0
- package/dist/internal/passkey/BrowserProvider.d.ts.map +1 -0
- package/dist/internal/passkey/BrowserProvider.js +101 -0
- package/dist/internal/passkey/BrowserProvider.js.map +1 -0
- package/dist/internal/passkey/Passkey.d.ts +104 -0
- package/dist/internal/passkey/Passkey.d.ts.map +1 -0
- package/dist/internal/passkey/Passkey.js +333 -0
- package/dist/internal/passkey/Passkey.js.map +1 -0
- package/dist/internal/passkey/SoftwareProvider.d.ts +23 -0
- package/dist/internal/passkey/SoftwareProvider.d.ts.map +1 -0
- package/dist/internal/passkey/SoftwareProvider.js +61 -0
- package/dist/internal/passkey/SoftwareProvider.js.map +1 -0
- package/dist/lifecycle/Evidence.d.ts +62 -0
- package/dist/lifecycle/Evidence.d.ts.map +1 -0
- package/dist/lifecycle/Evidence.js +30 -0
- package/dist/lifecycle/Evidence.js.map +1 -0
- package/dist/lifecycle/EvidenceGraphQL.d.ts +59 -0
- package/dist/lifecycle/EvidenceGraphQL.d.ts.map +1 -0
- package/dist/lifecycle/EvidenceGraphQL.js +53 -0
- package/dist/lifecycle/EvidenceGraphQL.js.map +1 -0
- package/dist/lifecycle/EvidenceGrpc.d.ts +4 -0
- package/dist/lifecycle/EvidenceGrpc.d.ts.map +1 -0
- package/dist/lifecycle/EvidenceGrpc.js +37 -0
- package/dist/lifecycle/EvidenceGrpc.js.map +1 -0
- package/dist/lifecycle/Journal.d.ts +69 -0
- package/dist/lifecycle/Journal.d.ts.map +1 -0
- package/dist/lifecycle/Journal.js +70 -0
- package/dist/lifecycle/Journal.js.map +1 -0
- package/dist/lifecycle/JournalEntry.d.ts +67 -0
- package/dist/lifecycle/JournalEntry.d.ts.map +1 -0
- package/dist/lifecycle/JournalEntry.js +45 -0
- package/dist/lifecycle/JournalEntry.js.map +1 -0
- package/dist/lifecycle/JournalKeyValueStore.d.ts +30 -0
- package/dist/lifecycle/JournalKeyValueStore.d.ts.map +1 -0
- package/dist/lifecycle/JournalKeyValueStore.js +217 -0
- package/dist/lifecycle/JournalKeyValueStore.js.map +1 -0
- package/dist/lifecycle/KeyValueStoreIndexedDb.d.ts +54 -0
- package/dist/lifecycle/KeyValueStoreIndexedDb.d.ts.map +1 -0
- package/dist/lifecycle/KeyValueStoreIndexedDb.js +321 -0
- package/dist/lifecycle/KeyValueStoreIndexedDb.js.map +1 -0
- package/dist/lifecycle/KeyValueStoreOpfs.d.ts +65 -0
- package/dist/lifecycle/KeyValueStoreOpfs.d.ts.map +1 -0
- package/dist/lifecycle/KeyValueStoreOpfs.js +207 -0
- package/dist/lifecycle/KeyValueStoreOpfs.js.map +1 -0
- package/dist/lifecycle/Lifecycle.d.ts +416 -0
- package/dist/lifecycle/Lifecycle.d.ts.map +1 -0
- package/dist/lifecycle/Lifecycle.js +666 -0
- package/dist/lifecycle/Lifecycle.js.map +1 -0
- package/dist/lifecycle/Outcome.d.ts +132 -0
- package/dist/lifecycle/Outcome.d.ts.map +1 -0
- package/dist/lifecycle/Outcome.js +106 -0
- package/dist/lifecycle/Outcome.js.map +1 -0
- package/dist/lifecycle/SenderLock.d.ts +37 -0
- package/dist/lifecycle/SenderLock.d.ts.map +1 -0
- package/dist/lifecycle/SenderLock.js +57 -0
- package/dist/lifecycle/SenderLock.js.map +1 -0
- package/dist/lifecycle/SenderLockWebLocks.d.ts +37 -0
- package/dist/lifecycle/SenderLockWebLocks.d.ts.map +1 -0
- package/dist/lifecycle/SenderLockWebLocks.js +100 -0
- package/dist/lifecycle/SenderLockWebLocks.js.map +1 -0
- package/dist/lifecycle/SignedTransaction.d.ts +55 -0
- package/dist/lifecycle/SignedTransaction.d.ts.map +1 -0
- package/dist/lifecycle/SignedTransaction.js +109 -0
- package/dist/lifecycle/SignedTransaction.js.map +1 -0
- package/dist/lifecycle/SubmitConfig.d.ts +44 -0
- package/dist/lifecycle/SubmitConfig.d.ts.map +1 -0
- package/dist/lifecycle/SubmitConfig.js +39 -0
- package/dist/lifecycle/SubmitConfig.js.map +1 -0
- package/dist/lifecycle/index.d.ts +13 -0
- package/dist/lifecycle/index.d.ts.map +1 -0
- package/dist/lifecycle/index.js +13 -0
- package/dist/lifecycle/index.js.map +1 -0
- package/dist/wallet/Connection.d.ts +119 -0
- package/dist/wallet/Connection.d.ts.map +1 -0
- package/dist/wallet/Connection.js +197 -0
- package/dist/wallet/Connection.js.map +1 -0
- package/dist/wallet/Features.d.ts +91 -0
- package/dist/wallet/Features.d.ts.map +1 -0
- package/dist/wallet/Features.js +14 -0
- package/dist/wallet/Features.js.map +1 -0
- package/dist/wallet/Wallet.d.ts +151 -0
- package/dist/wallet/Wallet.d.ts.map +1 -0
- package/dist/wallet/Wallet.js +399 -0
- package/dist/wallet/Wallet.js.map +1 -0
- package/dist/wallet/index.d.ts +7 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +7 -0
- package/dist/wallet/index.js.map +1 -0
- package/dist/zklogin/AddressSeed.d.ts +40 -0
- package/dist/zklogin/AddressSeed.d.ts.map +1 -0
- package/dist/zklogin/AddressSeed.js +91 -0
- package/dist/zklogin/AddressSeed.js.map +1 -0
- package/dist/zklogin/Errors.d.ts +24 -0
- package/dist/zklogin/Errors.d.ts.map +1 -0
- package/dist/zklogin/Errors.js +25 -0
- package/dist/zklogin/Errors.js.map +1 -0
- package/dist/zklogin/Jwt.d.ts +51 -0
- package/dist/zklogin/Jwt.d.ts.map +1 -0
- package/dist/zklogin/Jwt.js +159 -0
- package/dist/zklogin/Jwt.js.map +1 -0
- package/dist/zklogin/Nonce.d.ts +9 -0
- package/dist/zklogin/Nonce.d.ts.map +1 -0
- package/dist/zklogin/Nonce.js +34 -0
- package/dist/zklogin/Nonce.js.map +1 -0
- package/dist/zklogin/Poseidon.d.ts +24 -0
- package/dist/zklogin/Poseidon.d.ts.map +1 -0
- package/dist/zklogin/Poseidon.js +54 -0
- package/dist/zklogin/Poseidon.js.map +1 -0
- package/dist/zklogin/PublicIdentifier.d.ts +49 -0
- package/dist/zklogin/PublicIdentifier.d.ts.map +1 -0
- package/dist/zklogin/PublicIdentifier.js +90 -0
- package/dist/zklogin/PublicIdentifier.js.map +1 -0
- package/dist/zklogin/Signature.d.ts +55 -0
- package/dist/zklogin/Signature.d.ts.map +1 -0
- package/dist/zklogin/Signature.js +70 -0
- package/dist/zklogin/Signature.js.map +1 -0
- package/dist/zklogin/ZkLogin.d.ts +41 -0
- package/dist/zklogin/ZkLogin.d.ts.map +1 -0
- package/dist/zklogin/ZkLogin.js +87 -0
- package/dist/zklogin/ZkLogin.js.map +1 -0
- package/dist/zklogin/ZkLoginAddress.d.ts +30 -0
- package/dist/zklogin/ZkLoginAddress.d.ts.map +1 -0
- package/dist/zklogin/ZkLoginAddress.js +31 -0
- package/dist/zklogin/ZkLoginAddress.js.map +1 -0
- package/dist/zklogin/ZkLoginVerifier.d.ts +37 -0
- package/dist/zklogin/ZkLoginVerifier.d.ts.map +1 -0
- package/dist/zklogin/ZkLoginVerifier.js +4 -0
- package/dist/zklogin/ZkLoginVerifier.js.map +1 -0
- package/dist/zklogin/ZkLoginVerifierGrpc.d.ts +12 -0
- package/dist/zklogin/ZkLoginVerifierGrpc.d.ts.map +1 -0
- package/dist/zklogin/ZkLoginVerifierGrpc.js +53 -0
- package/dist/zklogin/ZkLoginVerifierGrpc.js.map +1 -0
- package/dist/zklogin/index.d.ts +17 -0
- package/dist/zklogin/index.d.ts.map +1 -0
- package/dist/zklogin/index.js +17 -0
- package/dist/zklogin/index.js.map +1 -0
- package/dist/zklogin/internal/parse.d.ts +9 -0
- package/dist/zklogin/internal/parse.d.ts.map +1 -0
- package/dist/zklogin/internal/parse.js +33 -0
- package/dist/zklogin/internal/parse.js.map +1 -0
- package/dist/zklogin/internal/poseidon.d.ts +21 -0
- package/dist/zklogin/internal/poseidon.d.ts.map +1 -0
- package/dist/zklogin/internal/poseidon.js +40 -0
- package/dist/zklogin/internal/poseidon.js.map +1 -0
- package/package.json +69 -4
- package/src/Address.ts +45 -0
- package/src/AddressAlias.ts +160 -0
- package/src/Bip32.ts +37 -0
- package/src/Chain.ts +21 -0
- package/src/CheckpointData.ts +106 -0
- package/src/Checkpoints.ts +18 -0
- package/src/CoinReservation.ts +65 -0
- package/src/Coins.ts +86 -0
- package/src/DynamicFields.ts +179 -0
- package/src/Ecdsa.ts +103 -0
- package/src/Ed25519.ts +84 -0
- package/src/Events.ts +133 -0
- package/src/Hash.ts +39 -0
- package/src/MlDsa65.ts +92 -0
- package/src/Mnemonic.ts +109 -0
- package/src/Move.ts +440 -0
- package/src/MultiSig.ts +320 -0
- package/src/Objects.ts +112 -0
- package/src/Packages.ts +52 -0
- package/src/Passkey.ts +10 -0
- package/src/PrivateKey.ts +138 -0
- package/src/Ptb.ts +579 -0
- package/src/Resolve.ts +1367 -0
- package/src/RpcError.ts +41 -0
- package/src/Secp256k1.ts +29 -0
- package/src/Secp256r1.ts +29 -0
- package/src/SignatureScheme.ts +166 -0
- package/src/Signer.ts +62 -0
- package/src/Testing.ts +830 -0
- package/src/TransactionData.ts +134 -0
- package/src/TransactionJson.ts +1002 -0
- package/src/Transactions.ts +211 -0
- package/src/Tx.ts +367 -0
- package/src/TypeTag.ts +123 -0
- package/src/Verify.ts +42 -0
- package/src/enoki/EnokiClient.ts +204 -0
- package/src/enoki/EnokiHttp.ts +222 -0
- package/src/enoki/Sponsor.ts +280 -0
- package/src/enoki/ZkLoginFlow.ts +176 -0
- package/src/enoki/index.ts +8 -0
- package/src/graphql/ChainGraphQL.ts +76 -0
- package/src/graphql/CheckpointDataGraphQL.ts +191 -0
- package/src/graphql/CheckpointsGraphQL.ts +96 -0
- package/src/graphql/CoinsGraphQL.ts +85 -0
- package/src/graphql/DynamicFieldsGraphQL.ts +167 -0
- package/src/graphql/EventsGraphQL.ts +301 -0
- package/src/graphql/ObjectsGraphQL.ts +112 -0
- package/src/graphql/PackagesGraphQL.ts +173 -0
- package/src/graphql/SuiGraphQL.ts +77 -0
- package/src/graphql/TransactionsGraphQL.ts +292 -0
- package/src/graphql/convert.ts +450 -0
- package/src/graphql/index.ts +74 -0
- package/src/graphql/merge.ts +62 -0
- package/src/graphql/paging.ts +110 -0
- package/src/graphql/subscription.ts +58 -0
- package/src/graphql/tip.ts +38 -0
- package/src/grpc/ChainGrpc.ts +51 -0
- package/src/grpc/CheckpointDataGrpc.ts +47 -0
- package/src/grpc/CheckpointsGrpc.ts +37 -0
- package/src/grpc/CoinsGrpc.ts +50 -0
- package/src/grpc/DynamicFieldsGrpc.ts +128 -0
- package/src/grpc/EventsGrpc.ts +101 -0
- package/src/grpc/GrpcWeb.ts +343 -0
- package/src/grpc/ObjectsGrpc.ts +95 -0
- package/src/grpc/PackagesGrpc.ts +98 -0
- package/src/grpc/Rpc.ts +156 -0
- package/src/grpc/TransactionsGrpc.ts +88 -0
- package/src/grpc/cache.ts +68 -0
- package/src/grpc/convert.ts +227 -0
- package/src/grpc/generated/lean.ts +276 -0
- package/src/grpc/generated/proto.ts +2130 -0
- package/src/grpc/generated/rpc.ts +417 -0
- package/src/grpc/index.ts +97 -0
- package/src/grpc/scan.ts +183 -0
- package/src/grpc/transaction.ts +182 -0
- package/src/index.ts +35 -0
- package/src/internal/allowances.ts +238 -0
- package/src/internal/mnemonic.ts +99 -0
- package/src/internal/passkey/BrowserProvider.ts +131 -0
- package/src/internal/passkey/Passkey.ts +408 -0
- package/src/internal/passkey/SoftwareProvider.ts +90 -0
- package/src/lifecycle/Evidence.ts +85 -0
- package/src/lifecycle/EvidenceGraphQL.ts +67 -0
- package/src/lifecycle/EvidenceGrpc.ts +47 -0
- package/src/lifecycle/Journal.ts +117 -0
- package/src/lifecycle/JournalEntry.ts +68 -0
- package/src/lifecycle/JournalKeyValueStore.ts +276 -0
- package/src/lifecycle/KeyValueStoreIndexedDb.ts +361 -0
- package/src/lifecycle/KeyValueStoreOpfs.ts +230 -0
- package/src/lifecycle/Lifecycle.ts +990 -0
- package/src/lifecycle/Outcome.ts +130 -0
- package/src/lifecycle/SenderLock.ts +73 -0
- package/src/lifecycle/SenderLockWebLocks.ts +136 -0
- package/src/lifecycle/SignedTransaction.ts +133 -0
- package/src/lifecycle/SubmitConfig.ts +77 -0
- package/src/lifecycle/index.ts +12 -0
- package/src/wallet/Connection.ts +323 -0
- package/src/wallet/Features.ts +114 -0
- package/src/wallet/Wallet.ts +550 -0
- package/src/wallet/index.ts +6 -0
- package/src/zklogin/AddressSeed.ts +130 -0
- package/src/zklogin/Errors.ts +27 -0
- package/src/zklogin/Jwt.ts +186 -0
- package/src/zklogin/Nonce.ts +46 -0
- package/src/zklogin/Poseidon.ts +62 -0
- package/src/zklogin/PublicIdentifier.ts +111 -0
- package/src/zklogin/Signature.ts +88 -0
- package/src/zklogin/ZkLogin.ts +145 -0
- package/src/zklogin/ZkLoginAddress.ts +72 -0
- package/src/zklogin/ZkLoginVerifier.ts +37 -0
- package/src/zklogin/ZkLoginVerifierGrpc.ts +66 -0
- package/src/zklogin/index.ts +16 -0
- package/src/zklogin/internal/parse.ts +30 -0
- package/src/zklogin/internal/poseidon.ts +47 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gRPC-web over Effect's `HttpClient`, with messages encoded by `effect/protobuf`
|
|
3
|
+
* from per-method descriptor chunks. Methods are generated handles:
|
|
4
|
+
* `unary(Rpc.LedgerService_GetObject, req)` takes a `GetObjectRequest` and
|
|
5
|
+
* returns a `GetObjectResponse`, and ships only the descriptors it needs.
|
|
6
|
+
*
|
|
7
|
+
* Everything HTTP-shaped (auth headers, proxies, logging, recording for tests)
|
|
8
|
+
* is `HttpClient` middleware; this module only frames and decodes.
|
|
9
|
+
*/
|
|
10
|
+
import * as Context from "effect/Context"
|
|
11
|
+
import * as Duration from "effect/Duration"
|
|
12
|
+
import * as Effect from "effect/Effect"
|
|
13
|
+
import * as Layer from "effect/Layer"
|
|
14
|
+
import * as Option from "effect/Option"
|
|
15
|
+
import * as Result from "effect/Result"
|
|
16
|
+
import * as Stream from "effect/Stream"
|
|
17
|
+
import * as HttpClient from "effect/http/HttpClient"
|
|
18
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest"
|
|
19
|
+
import { type RpcCode, RpcCode as GrpcCode, RpcError } from "../RpcError.ts"
|
|
20
|
+
import type { Rpc } from "./Rpc.ts"
|
|
21
|
+
|
|
22
|
+
// -----------------------------------------------------------------------------
|
|
23
|
+
// Framing
|
|
24
|
+
// -----------------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
const frame = (msg: Uint8Array) => {
|
|
27
|
+
const out = new Uint8Array(5 + msg.length)
|
|
28
|
+
new DataView(out.buffer).setUint32(1, msg.length, false)
|
|
29
|
+
out.set(msg, 5)
|
|
30
|
+
return out
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const parseTrailers = (bytes: Uint8Array) => {
|
|
34
|
+
const out: Record<string, string> = {}
|
|
35
|
+
for (const line of new TextDecoder().decode(bytes).split("\r\n")) {
|
|
36
|
+
const i = line.indexOf(":")
|
|
37
|
+
if (i > 0) out[line.slice(0, i).trim().toLowerCase()] = line.slice(i + 1).trim()
|
|
38
|
+
}
|
|
39
|
+
return out
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const statusOf = (method: string, get: (key: string) => string | undefined): RpcError | undefined => {
|
|
43
|
+
const raw = get("grpc-status")
|
|
44
|
+
if (raw === undefined || raw === "0") return undefined
|
|
45
|
+
let message = get("grpc-message") ?? ""
|
|
46
|
+
try {
|
|
47
|
+
message = decodeURIComponent(message)
|
|
48
|
+
} catch {
|
|
49
|
+
// keep the raw message
|
|
50
|
+
}
|
|
51
|
+
return new RpcError({ method, code: GrpcCode[Number(raw)] ?? "UNKNOWN", message })
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface Frame {
|
|
55
|
+
/**
|
|
56
|
+
* `data`, `compressed` (flag bit 0: compressed per `grpc-encoding`) and `trailer` are wire frames.
|
|
57
|
+
* `malformed` is a frame header with reserved flag bits set (its payload is the flag byte); nothing
|
|
58
|
+
* after it is parsed. `incomplete` marks a body that ended inside a frame or before its trailers.
|
|
59
|
+
*/
|
|
60
|
+
readonly kind: "data" | "compressed" | "trailer" | "malformed" | "incomplete"
|
|
61
|
+
readonly payload: Uint8Array
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface Reassembly {
|
|
65
|
+
/** Body chunks not yet consumed, oldest first; the first `offset` bytes of `chunks[0]` are consumed. */
|
|
66
|
+
readonly chunks: Array<Uint8Array>
|
|
67
|
+
offset: number
|
|
68
|
+
size: number
|
|
69
|
+
trailerSeen: boolean
|
|
70
|
+
broken: boolean
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Consume `n` buffered bytes; each byte is copied at most once. */
|
|
74
|
+
const take = (s: Reassembly, n: number): Uint8Array => {
|
|
75
|
+
const first = s.chunks[0]!
|
|
76
|
+
let out: Uint8Array
|
|
77
|
+
if (first.length - s.offset >= n) {
|
|
78
|
+
out = first.subarray(s.offset, s.offset + n)
|
|
79
|
+
s.offset += n
|
|
80
|
+
} else {
|
|
81
|
+
out = new Uint8Array(n)
|
|
82
|
+
let filled = 0
|
|
83
|
+
while (filled < n) {
|
|
84
|
+
const c = s.chunks[0]!
|
|
85
|
+
const k = Math.min(c.length - s.offset, n - filled)
|
|
86
|
+
out.set(c.subarray(s.offset, s.offset + k), filled)
|
|
87
|
+
filled += k
|
|
88
|
+
s.offset += k
|
|
89
|
+
if (s.offset === c.length) {
|
|
90
|
+
s.chunks.shift()
|
|
91
|
+
s.offset = 0
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (s.chunks.length > 0 && s.offset === s.chunks[0]!.length) {
|
|
96
|
+
s.chunks.shift()
|
|
97
|
+
s.offset = 0
|
|
98
|
+
}
|
|
99
|
+
s.size -= n
|
|
100
|
+
return out
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** The 5-byte frame header at the front of the buffer (`size >= 5`), not consumed. */
|
|
104
|
+
const peekHeader = (s: Reassembly) => {
|
|
105
|
+
const h = new Uint8Array(5)
|
|
106
|
+
let filled = 0
|
|
107
|
+
for (let i = 0, off = s.offset; filled < 5; i++, off = 0) {
|
|
108
|
+
const c = s.chunks[i]!
|
|
109
|
+
const k = Math.min(c.length - off, 5 - filled)
|
|
110
|
+
h.set(c.subarray(off, off + k), filled)
|
|
111
|
+
filled += k
|
|
112
|
+
}
|
|
113
|
+
return { flags: h[0]!, length: new DataView(h.buffer).getUint32(1, false) }
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Incrementally split a gRPC-web body into frames, in time linear in its size.
|
|
118
|
+
* A body that ends inside a frame or without a trailers frame ends with an
|
|
119
|
+
* `incomplete` marker: the server or a proxy cut the response short.
|
|
120
|
+
*/
|
|
121
|
+
export const toFrames = <E>(body: Stream.Stream<Uint8Array, E>): Stream.Stream<Frame, E> =>
|
|
122
|
+
body.pipe(
|
|
123
|
+
Stream.mapAccum((): Reassembly => ({ chunks: [], offset: 0, size: 0, trailerSeen: false, broken: false }), (s, chunk: Uint8Array) => {
|
|
124
|
+
const out: Array<Frame> = []
|
|
125
|
+
if (s.broken) return [s, out] as const
|
|
126
|
+
if (chunk.length > 0) {
|
|
127
|
+
s.chunks.push(chunk)
|
|
128
|
+
s.size += chunk.length
|
|
129
|
+
}
|
|
130
|
+
while (s.size >= 5) {
|
|
131
|
+
const { flags, length } = peekHeader(s)
|
|
132
|
+
if ((flags & 0x7e) !== 0) {
|
|
133
|
+
// Not gRPC-web, e.g. a body still under its Content-Encoding (zstd starts 0x28, gzip 0x1f).
|
|
134
|
+
s.broken = true
|
|
135
|
+
s.chunks.length = 0
|
|
136
|
+
s.size = 0
|
|
137
|
+
out.push({ kind: "malformed", payload: new Uint8Array([flags]) })
|
|
138
|
+
break
|
|
139
|
+
}
|
|
140
|
+
if (s.size - 5 < length) break
|
|
141
|
+
take(s, 5)
|
|
142
|
+
const payload = length === 0 ? new Uint8Array(0) : take(s, length)
|
|
143
|
+
const kind = (flags & 0x80) !== 0 ? "trailer" : (flags & 1) !== 0 ? "compressed" : "data"
|
|
144
|
+
if (kind === "trailer") s.trailerSeen = true
|
|
145
|
+
out.push({ kind, payload })
|
|
146
|
+
}
|
|
147
|
+
return [s, out] as const
|
|
148
|
+
}, {
|
|
149
|
+
onHalt: (s): ReadonlyArray<Frame> =>
|
|
150
|
+
s.broken || (s.trailerSeen && s.size === 0) ? [] : [{ kind: "incomplete", payload: new Uint8Array(0) }]
|
|
151
|
+
})
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
// -----------------------------------------------------------------------------
|
|
155
|
+
// Compression (docs/design/grpc-compression.md §4)
|
|
156
|
+
// -----------------------------------------------------------------------------
|
|
157
|
+
|
|
158
|
+
let decodable: ReadonlyArray<string> | undefined
|
|
159
|
+
|
|
160
|
+
/** Per-message encodings this runtime's `DecompressionStream` decodes, best first; probed once. */
|
|
161
|
+
const decodableEncodings = (): ReadonlyArray<string> =>
|
|
162
|
+
decodable ??= ["zstd", "gzip"].filter((encoding) => {
|
|
163
|
+
try {
|
|
164
|
+
new DecompressionStream(encoding as "gzip")
|
|
165
|
+
return true
|
|
166
|
+
} catch {
|
|
167
|
+
return false
|
|
168
|
+
}
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Whether to ask for `Accept-Encoding: zstd` ourselves: only on Node 24+, whose `fetch` decodes zstd
|
|
173
|
+
* but doesn't ask for it. Bun's `fetch` already asks, and browsers set the header themselves (it is
|
|
174
|
+
* forbidden to page code; `fetch` drops a page's value without an error). Elsewhere the client's
|
|
175
|
+
* default stands, since a client that asked for zstd and can't decode it would get an unreadable body.
|
|
176
|
+
*/
|
|
177
|
+
const askForZstd = (): boolean => {
|
|
178
|
+
const v = (globalThis as { process?: { versions?: Record<string, string | undefined> } }).process?.versions
|
|
179
|
+
return v?.node !== undefined && v.bun === undefined && v.deno === undefined && Number(v.node.split(".")[0]) >= 24
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const inflate = (encoding: string, bytes: Uint8Array): Promise<Uint8Array> =>
|
|
183
|
+
new Response(new Blob([bytes as Uint8Array<ArrayBuffer>]).stream().pipeThrough(new DecompressionStream(encoding as "gzip")))
|
|
184
|
+
.arrayBuffer()
|
|
185
|
+
.then((b) => new Uint8Array(b))
|
|
186
|
+
|
|
187
|
+
/** gRPC's HTTP-to-status mapping, for a response that carries no `grpc-status` (5xx are kept retryable). */
|
|
188
|
+
export const httpCode = (status: number): RpcCode =>
|
|
189
|
+
status === 400
|
|
190
|
+
? "INTERNAL"
|
|
191
|
+
: status === 401
|
|
192
|
+
? "UNAUTHENTICATED"
|
|
193
|
+
: status === 403
|
|
194
|
+
? "PERMISSION_DENIED"
|
|
195
|
+
: status === 404
|
|
196
|
+
? "UNIMPLEMENTED"
|
|
197
|
+
: status === 429 || status >= 500
|
|
198
|
+
? "UNAVAILABLE"
|
|
199
|
+
: "UNKNOWN"
|
|
200
|
+
|
|
201
|
+
// -----------------------------------------------------------------------------
|
|
202
|
+
// Service
|
|
203
|
+
// -----------------------------------------------------------------------------
|
|
204
|
+
|
|
205
|
+
export interface GrpcWebOptions {
|
|
206
|
+
/**
|
|
207
|
+
* Base URL of a full node or RPC provider, e.g. `https://fullnode.mainnet.sui.io:443`.
|
|
208
|
+
* Method paths are appended to it; trailing slashes are stripped.
|
|
209
|
+
*/
|
|
210
|
+
readonly url: string
|
|
211
|
+
/** Extra headers on every call (API keys, routing). */
|
|
212
|
+
readonly headers?: Readonly<Record<string, string>>
|
|
213
|
+
/**
|
|
214
|
+
* Bound on each unary call; a call without an answer in time fails with a
|
|
215
|
+
* retryable `DEADLINE_EXCEEDED`. Server streams are not bounded. Default 30 seconds.
|
|
216
|
+
*/
|
|
217
|
+
readonly requestTimeout?: Duration.Input
|
|
218
|
+
/**
|
|
219
|
+
* Send `traceparent` / `b3` headers. Off by default, as in every other
|
|
220
|
+
* layer here: browsers preflight them, and a provider with a strict CORS
|
|
221
|
+
* allow-list refuses them. Spans are recorded either way.
|
|
222
|
+
*/
|
|
223
|
+
readonly tracerPropagation?: boolean
|
|
224
|
+
/**
|
|
225
|
+
* Ask for compressed responses; the server picks what to apply. On (the default): per-message
|
|
226
|
+
* `grpc-encoding` with the encodings this runtime decodes (`zstd` where `DecompressionStream`
|
|
227
|
+
* has it, and `gzip`), and on Node 24+ `Accept-Encoding: zstd, gzip`, so a provider can compress
|
|
228
|
+
* a whole stream (`fetch` decodes it). Off: `grpc-accept-encoding: identity`, `Accept-Encoding`
|
|
229
|
+
* left to the client. See docs/design/grpc-compression.md.
|
|
230
|
+
*/
|
|
231
|
+
readonly compression?: boolean
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export class GrpcWeb extends /* @__PURE__ */ Context.Service<GrpcWeb, {
|
|
235
|
+
readonly unary: <I, O>(method: Rpc<I, O, false>, request: I) => Effect.Effect<O, RpcError>
|
|
236
|
+
readonly serverStream: <I, O>(method: Rpc<I, O, true>, request: I) => Stream.Stream<O, RpcError>
|
|
237
|
+
}>()("@unconfirmed/effect-sui/GrpcWeb") {
|
|
238
|
+
static readonly layer = (options: GrpcWebOptions): Layer.Layer<GrpcWeb, never, HttpClient.HttpClient> =>
|
|
239
|
+
Layer.effect(
|
|
240
|
+
GrpcWeb,
|
|
241
|
+
Effect.gen(function*() {
|
|
242
|
+
const http = yield* HttpClient.HttpClient
|
|
243
|
+
const base = options.url.replace(/\/+$/, "")
|
|
244
|
+
const timeout = Duration.fromInputUnsafe(options.requestTimeout ?? "30 seconds")
|
|
245
|
+
const tracerPropagation = options.tracerPropagation ?? false
|
|
246
|
+
const decodes = options.compression === false ? [] : decodableEncodings()
|
|
247
|
+
const headers: Record<string, string> = {
|
|
248
|
+
...options.headers,
|
|
249
|
+
"x-grpc-web": "1",
|
|
250
|
+
accept: "application/grpc-web+proto",
|
|
251
|
+
"grpc-accept-encoding": decodes.length > 0 ? decodes.join(",") : "identity"
|
|
252
|
+
}
|
|
253
|
+
if (options.compression !== false && askForZstd()) headers["accept-encoding"] = "zstd, gzip"
|
|
254
|
+
|
|
255
|
+
const call = <I, O>(method: Rpc<I, O, boolean>, request: I): Stream.Stream<O, RpcError> => {
|
|
256
|
+
const path = method.path
|
|
257
|
+
const codec = method.codec()
|
|
258
|
+
const fail = (message: string, code: RpcCode = "UNAVAILABLE") => new RpcError({ method: path, code, message })
|
|
259
|
+
|
|
260
|
+
return Effect.try({
|
|
261
|
+
try: () => frame(codec.encode(request)),
|
|
262
|
+
catch: (e) => fail(`invalid request: ${e instanceof Error ? e.message : String(e)}`, "INVALID_ARGUMENT")
|
|
263
|
+
}).pipe(
|
|
264
|
+
Effect.flatMap((body) =>
|
|
265
|
+
HttpClientRequest.post(`${base}/${path}`).pipe(
|
|
266
|
+
HttpClientRequest.setHeaders(headers),
|
|
267
|
+
HttpClientRequest.bodyUint8Array(body, "application/grpc-web+proto"),
|
|
268
|
+
http.execute,
|
|
269
|
+
Effect.provideService(HttpClient.TracerPropagationEnabled, tracerPropagation),
|
|
270
|
+
Effect.mapError((e) => fail(e.message))
|
|
271
|
+
)
|
|
272
|
+
),
|
|
273
|
+
Effect.flatMap((res) => {
|
|
274
|
+
// A trailers-only response carries its status in the headers.
|
|
275
|
+
const err = statusOf(path, (k) => res.headers[k])
|
|
276
|
+
if (err) return Effect.fail(err)
|
|
277
|
+
if (res.status !== 200) return Effect.fail(fail(`HTTP ${res.status}`, httpCode(res.status)))
|
|
278
|
+
const decode = (payload: Uint8Array) =>
|
|
279
|
+
Result.match(codec.decode(payload), {
|
|
280
|
+
onSuccess: (m) => Effect.succeed<ReadonlyArray<O>>([m]),
|
|
281
|
+
onFailure: (e) => Effect.fail(fail(`malformed response: ${e.message}`, "DATA_LOSS"))
|
|
282
|
+
})
|
|
283
|
+
return Effect.succeed(
|
|
284
|
+
toFrames(res.stream.pipe(Stream.mapError((e) => fail(e.message)))).pipe(
|
|
285
|
+
Stream.mapEffect((f) => {
|
|
286
|
+
if (f.kind === "data") return decode(f.payload)
|
|
287
|
+
if (f.kind === "incomplete") return Effect.fail(fail("the response ended before its gRPC trailers"))
|
|
288
|
+
if (f.kind === "trailer") {
|
|
289
|
+
const t = parseTrailers(f.payload)
|
|
290
|
+
const e = statusOf(path, (k) => t[k])
|
|
291
|
+
return e ? Effect.fail(e) : Effect.succeed<ReadonlyArray<O>>([])
|
|
292
|
+
}
|
|
293
|
+
if (f.kind === "malformed") {
|
|
294
|
+
const coding = res.headers["content-encoding"]
|
|
295
|
+
return Effect.fail(fail(
|
|
296
|
+
coding !== undefined && coding !== "identity"
|
|
297
|
+
? `the body is still Content-Encoding: ${coding}: this HttpClient doesn't decode it (use FetchHttpClient, or compression: false)`
|
|
298
|
+
: `malformed gRPC-web frame (flags 0x${f.payload[0]!.toString(16)})`,
|
|
299
|
+
"INTERNAL"
|
|
300
|
+
))
|
|
301
|
+
}
|
|
302
|
+
// gRPC: a compressed message we can't decompress is INTERNAL.
|
|
303
|
+
const encoding = res.headers["grpc-encoding"]?.trim().toLowerCase()
|
|
304
|
+
if (encoding === undefined || !decodes.includes(encoding)) {
|
|
305
|
+
return Effect.fail(fail(
|
|
306
|
+
`compressed message with ${encoding === undefined ? "no grpc-encoding" : `grpc-encoding ${encoding}, which we didn't offer`}`,
|
|
307
|
+
"INTERNAL"
|
|
308
|
+
))
|
|
309
|
+
}
|
|
310
|
+
return Effect.tryPromise({
|
|
311
|
+
try: () => inflate(encoding, f.payload),
|
|
312
|
+
catch: (e) => fail(`could not decompress a ${encoding} message: ${e instanceof Error ? e.message : String(e)}`, "INTERNAL")
|
|
313
|
+
}).pipe(Effect.flatMap(decode))
|
|
314
|
+
}),
|
|
315
|
+
Stream.flatMap((xs) => Stream.fromIterable(xs))
|
|
316
|
+
)
|
|
317
|
+
)
|
|
318
|
+
}),
|
|
319
|
+
Stream.unwrap
|
|
320
|
+
)
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return GrpcWeb.of({
|
|
324
|
+
unary: (method, request) =>
|
|
325
|
+
// Read through to the trailers: an error status after the message must not be dropped.
|
|
326
|
+
call(method, request).pipe(
|
|
327
|
+
Stream.runFold((): Option.Option<any> => Option.none(), (acc, m) => (Option.isNone(acc) ? Option.some(m) : acc)),
|
|
328
|
+
Effect.flatMap(Option.match({
|
|
329
|
+
onNone: () => Effect.fail(new RpcError({ method: method.path, code: "INTERNAL", message: "no response message" })),
|
|
330
|
+
onSome: Effect.succeed
|
|
331
|
+
})),
|
|
332
|
+
Effect.timeoutOrElse({
|
|
333
|
+
duration: timeout,
|
|
334
|
+
orElse: () =>
|
|
335
|
+
Effect.fail(new RpcError({ method: method.path, code: "DEADLINE_EXCEEDED", message: `no answer within ${Duration.format(timeout)}` }))
|
|
336
|
+
}),
|
|
337
|
+
Effect.withSpan(`grpc ${method.path}`, { attributes: { "rpc.system": "grpc", "rpc.method": method.path } })
|
|
338
|
+
),
|
|
339
|
+
serverStream: (method, request) => call(method, request)
|
|
340
|
+
})
|
|
341
|
+
})
|
|
342
|
+
)
|
|
343
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect"
|
|
2
|
+
import * as Exit from "effect/Exit"
|
|
3
|
+
import * as Layer from "effect/Layer"
|
|
4
|
+
import * as Option from "effect/Option"
|
|
5
|
+
import * as Request from "effect/Request"
|
|
6
|
+
import * as RequestResolver from "effect/RequestResolver"
|
|
7
|
+
import * as Stream from "effect/Stream"
|
|
8
|
+
import type { Address } from "../Address.ts"
|
|
9
|
+
import { ObjectNotFound, Objects, type SuiObject } from "../Objects.ts"
|
|
10
|
+
import { RpcCode, RpcError } from "../RpcError.ts"
|
|
11
|
+
import { convert, OBJECT_MASK, object } from "./convert.ts"
|
|
12
|
+
import type * as P from "./generated/proto.ts"
|
|
13
|
+
import * as Rpc from "./generated/lean.ts"
|
|
14
|
+
import { GrpcWeb } from "./GrpcWeb.ts"
|
|
15
|
+
|
|
16
|
+
const MAX_BATCH = 50
|
|
17
|
+
const BATCH = Rpc.LedgerService_BatchGetObjects.path
|
|
18
|
+
|
|
19
|
+
const malformed = (message: string) => new RpcError({ method: BATCH, code: "DATA_LOSS", message: `malformed response: ${message}` })
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* One entry of a `BatchGetObjects` answer: an object, `ObjectNotFound` only for
|
|
23
|
+
* a `NOT_FOUND` status, any other per-object status as that `RpcError`, and a
|
|
24
|
+
* missing entry as `DATA_LOSS`.
|
|
25
|
+
*/
|
|
26
|
+
const toExit = (objectId: Address, r: P.GetObjectResult | undefined): Exit.Exit<SuiObject, ObjectNotFound | RpcError> => {
|
|
27
|
+
const result = r?.result
|
|
28
|
+
if (result === undefined) return Exit.fail(malformed(`no result for ${objectId}`))
|
|
29
|
+
if (result._tag === "error") {
|
|
30
|
+
const code = result.value.code ?? 2
|
|
31
|
+
if (code === 5) return Exit.fail(new ObjectNotFound({ objectId }))
|
|
32
|
+
return Exit.fail(new RpcError({ method: BATCH, code: RpcCode[code] ?? "UNKNOWN", message: result.value.message ?? "" }))
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
return Exit.succeed(object(result.value))
|
|
36
|
+
} catch (e) {
|
|
37
|
+
return Exit.fail(malformed(e instanceof Error ? e.message : String(e)))
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
class GetObject extends Request.Class<{ readonly objectId: Address }, SuiObject, ObjectNotFound | RpcError> {}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* `Objects` over gRPC. Concurrent `get`s anywhere in the program are
|
|
45
|
+
* coalesced into `BatchGetObjects` calls of up to 50, and gets of the same id
|
|
46
|
+
* within a batch share one entry.
|
|
47
|
+
*/
|
|
48
|
+
export const layer: Layer.Layer<Objects, never, GrpcWeb> = /* @__PURE__ */ Layer.effect(
|
|
49
|
+
Objects,
|
|
50
|
+
Effect.gen(function*() {
|
|
51
|
+
const grpc = yield* GrpcWeb
|
|
52
|
+
|
|
53
|
+
const resolver = RequestResolver.make<GetObject>((entries) => {
|
|
54
|
+
const ids = [...new Set(entries.map((e) => e.request.objectId))]
|
|
55
|
+
return grpc
|
|
56
|
+
.unary(Rpc.LedgerService_BatchGetObjects, { requests: ids.map((object_id) => ({ object_id })), read_mask: OBJECT_MASK })
|
|
57
|
+
.pipe(
|
|
58
|
+
Effect.match({
|
|
59
|
+
onFailure: (error) => entries.forEach((e) => e.completeUnsafe(Exit.fail(error))),
|
|
60
|
+
onSuccess: (res) => {
|
|
61
|
+
const byId = new Map(ids.map((id, i) => [id, toExit(id, res.objects?.[i])] as const))
|
|
62
|
+
entries.forEach((entry) => entry.completeUnsafe(byId.get(entry.request.objectId)!))
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
)
|
|
66
|
+
}).pipe(
|
|
67
|
+
RequestResolver.setDelay("1 millis"),
|
|
68
|
+
RequestResolver.batchN(MAX_BATCH),
|
|
69
|
+
RequestResolver.withSpan("Objects.get.resolver")
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
return Objects.of({
|
|
73
|
+
get: (objectId) =>
|
|
74
|
+
Effect.request(new GetObject({ objectId }), resolver).pipe(
|
|
75
|
+
Effect.withSpan("Objects.get", { attributes: { objectId } })
|
|
76
|
+
),
|
|
77
|
+
listOwned: (owner, options) =>
|
|
78
|
+
Stream.paginate(undefined as Uint8Array | undefined, (page_token) =>
|
|
79
|
+
grpc
|
|
80
|
+
.unary(Rpc.StateService_ListOwnedObjects, {
|
|
81
|
+
owner,
|
|
82
|
+
read_mask: OBJECT_MASK,
|
|
83
|
+
page_size: options?.pageSize ?? 100,
|
|
84
|
+
...(page_token && { page_token }),
|
|
85
|
+
...(options?.type && { object_type: options.type })
|
|
86
|
+
})
|
|
87
|
+
.pipe(
|
|
88
|
+
Effect.flatMap((r) =>
|
|
89
|
+
convert(Rpc.StateService_ListOwnedObjects.path, () =>
|
|
90
|
+
[(r.objects ?? []).map(object), Option.fromNullishOr(r.next_page_token?.length ? r.next_page_token : undefined)] as const)
|
|
91
|
+
)
|
|
92
|
+
))
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect"
|
|
2
|
+
import * as Layer from "effect/Layer"
|
|
3
|
+
import * as Request from "effect/Request"
|
|
4
|
+
import * as RequestResolver from "effect/RequestResolver"
|
|
5
|
+
import { type FunctionTarget, type MoveFunction, PackageNotFound, Packages, type Parameter, type Reference } from "../Packages.ts"
|
|
6
|
+
import { RpcError } from "../RpcError.ts"
|
|
7
|
+
import type * as P from "./generated/proto.ts"
|
|
8
|
+
import { convert, MODULES_PATHS } from "./convert.ts"
|
|
9
|
+
import * as Rpc from "./generated/lean.ts"
|
|
10
|
+
import { successByKey } from "./cache.ts"
|
|
11
|
+
import { GrpcWeb } from "./GrpcWeb.ts"
|
|
12
|
+
|
|
13
|
+
class GetFunction extends Request.Class<FunctionTarget, MoveFunction, RpcError> {}
|
|
14
|
+
|
|
15
|
+
const GET_OBJECT = Rpc.LedgerService_GetObject.path
|
|
16
|
+
|
|
17
|
+
const REFERENCE: Record<number, Reference> = { 1: "Immutable", 2: "Mutable" }
|
|
18
|
+
|
|
19
|
+
const PRIMITIVE: Record<number, string> = { 1: "address", 2: "bool", 3: "u8", 4: "u16", 5: "u32", 6: "u64", 7: "u128", 8: "u256" }
|
|
20
|
+
|
|
21
|
+
/** A closed signature body as a type string; `undefined` if it mentions a type parameter. */
|
|
22
|
+
const typeString = (b: P.OpenSignatureBody | undefined): string | undefined => {
|
|
23
|
+
if (b === undefined) return undefined
|
|
24
|
+
const prim = PRIMITIVE[b.type ?? 0]
|
|
25
|
+
if (prim !== undefined) return prim
|
|
26
|
+
if (b.type === 9) {
|
|
27
|
+
const item = typeString(b.type_parameter_instantiation?.[0])
|
|
28
|
+
return item === undefined ? undefined : `vector<${item}>`
|
|
29
|
+
}
|
|
30
|
+
if (b.type === 10 && b.type_name !== undefined) {
|
|
31
|
+
const args = (b.type_parameter_instantiation ?? []).map(typeString)
|
|
32
|
+
if (args.some((a) => a === undefined)) return undefined
|
|
33
|
+
return args.length === 0 ? b.type_name : `${b.type_name}<${args.join(", ")}>`
|
|
34
|
+
}
|
|
35
|
+
return undefined
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const parameter = (p: P.OpenSignature): Parameter => {
|
|
39
|
+
const out = { reference: REFERENCE[p.reference ?? 0] ?? "Value", typeName: p.body?.type_name } as const
|
|
40
|
+
const inst = p.body?.type === 10 ? p.body.type_parameter_instantiation ?? [] : []
|
|
41
|
+
if (inst.length === 0) return out
|
|
42
|
+
const typeArguments = inst.map(typeString)
|
|
43
|
+
return typeArguments.every((a) => a !== undefined) ? { ...out, typeArguments: typeArguments as Array<string> } : out
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* `Packages` over gRPC. Function signatures are immutable; successful reads are
|
|
48
|
+
* cached for the layer's lifetime, and concurrent reads of one target share a request.
|
|
49
|
+
*/
|
|
50
|
+
export const layer: Layer.Layer<Packages, never, GrpcWeb> = /* @__PURE__ */ Layer.effect(
|
|
51
|
+
Packages,
|
|
52
|
+
Effect.gen(function*() {
|
|
53
|
+
const grpc = yield* GrpcWeb
|
|
54
|
+
const resolver = RequestResolver.fromEffect(({ request }: Request.Entry<GetFunction>) =>
|
|
55
|
+
grpc
|
|
56
|
+
.unary(Rpc.MovePackageService_GetFunction, {
|
|
57
|
+
package_id: request.package,
|
|
58
|
+
module_name: request.module,
|
|
59
|
+
name: request.function
|
|
60
|
+
})
|
|
61
|
+
.pipe(
|
|
62
|
+
Effect.flatMap((r) =>
|
|
63
|
+
convert(Rpc.MovePackageService_GetFunction.path, (): MoveFunction => {
|
|
64
|
+
if (r.function === undefined) throw new Error("no function")
|
|
65
|
+
return { isEntry: r.function.is_entry ?? false, parameters: (r.function.parameters ?? []).map(parameter) }
|
|
66
|
+
})
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
)
|
|
70
|
+
// Successes only: a transient failure must not poison the target for the layer's lifetime.
|
|
71
|
+
const cache = successByKey<string, MoveFunction>(4096)
|
|
72
|
+
|
|
73
|
+
return Packages.of({
|
|
74
|
+
getFunction: (target) =>
|
|
75
|
+
cache(
|
|
76
|
+
`${target.package}::${target.module}::${target.function}`,
|
|
77
|
+
Effect.request(new GetFunction({ package: target.package, module: target.module, function: target.function }), resolver)
|
|
78
|
+
),
|
|
79
|
+
// `GetPackage` lists modules without their contents; `GetObject` has them.
|
|
80
|
+
getModules: (packageId) =>
|
|
81
|
+
grpc.unary(Rpc.LedgerService_GetObject, { object_id: packageId, read_mask: { paths: MODULES_PATHS } }).pipe(
|
|
82
|
+
Effect.catchIf((e) => e.code === "NOT_FOUND", () => Effect.fail(new PackageNotFound({ packageId }))),
|
|
83
|
+
Effect.flatMap((r) => {
|
|
84
|
+
const modules = r.object?.package?.modules
|
|
85
|
+
if (modules === undefined) {
|
|
86
|
+
return Effect.fail(new RpcError({ method: GET_OBJECT, code: "INVALID_ARGUMENT", message: `${packageId} is not a package` }))
|
|
87
|
+
}
|
|
88
|
+
return convert(GET_OBJECT, () =>
|
|
89
|
+
new Map(modules.map((m) => {
|
|
90
|
+
if (m.name === undefined || m.contents === undefined) throw new Error("module without name or contents")
|
|
91
|
+
return [m.name, m.contents] as const
|
|
92
|
+
})))
|
|
93
|
+
}),
|
|
94
|
+
Effect.withSpan("Packages.getModules", { attributes: { packageId } })
|
|
95
|
+
)
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
)
|