@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,191 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect"
|
|
2
|
+
import * as GraphQL from "effect/graphql/GraphQL"
|
|
3
|
+
import * as GraphQLClient from "effect/graphql/GraphQLClient"
|
|
4
|
+
import * as GraphQLGroup from "effect/graphql/GraphQLGroup"
|
|
5
|
+
import type * as GraphQLProtocol from "effect/graphql/GraphQLProtocol"
|
|
6
|
+
import * as Layer from "effect/Layer"
|
|
7
|
+
import * as Option from "effect/Option"
|
|
8
|
+
import * as Schedule from "effect/Schedule"
|
|
9
|
+
import * as Schema from "effect/Schema"
|
|
10
|
+
import * as Stream from "effect/Stream"
|
|
11
|
+
import * as CheckpointData from "../CheckpointData.ts"
|
|
12
|
+
import { RpcError } from "../RpcError.ts"
|
|
13
|
+
import { call, effects, effectsFields, EffectsNode, event, U64 } from "./convert.ts"
|
|
14
|
+
import { EVENTS_PAGE, EVENTS_PAGE_FIELDS, EventsPage, GetObjectChanges, GetTransactionEvents, rest } from "./paging.ts"
|
|
15
|
+
import { noClientRetry, resubscribe } from "./subscription.ts"
|
|
16
|
+
import { rangeOf, Tip } from "./tip.ts"
|
|
17
|
+
|
|
18
|
+
/** Transactions per page (the server's maximum for `Checkpoint.transactions`). */
|
|
19
|
+
const TX_PAGE = 50
|
|
20
|
+
/**
|
|
21
|
+
* Object changes read with each transaction. The server bounds the product of
|
|
22
|
+
* nested page sizes, so this is kept small; a transaction with more is
|
|
23
|
+
* completed by digest.
|
|
24
|
+
*/
|
|
25
|
+
const NESTED_CHANGES = 50
|
|
26
|
+
/**
|
|
27
|
+
* Checkpoints fetched ahead, concurrently and delivered in order, by `list` and
|
|
28
|
+
* `subscribe`. One `GetCheckpoint` takes longer than a checkpoint interval
|
|
29
|
+
* (~0.25 s) on busy networks, so one at a time falls behind the chain.
|
|
30
|
+
*/
|
|
31
|
+
const CONCURRENCY = 16
|
|
32
|
+
/** Checkpoint numbers enumerated per step of `list` (they are consecutive; nothing is read for them). */
|
|
33
|
+
const NUMBERS_STEP = 64n
|
|
34
|
+
|
|
35
|
+
const TransactionNode = Schema.Struct({
|
|
36
|
+
digest: Schema.String,
|
|
37
|
+
effects: Schema.NullOr(Schema.Struct({ ...EffectsNode.fields, events: Schema.NullOr(EventsPage) }))
|
|
38
|
+
})
|
|
39
|
+
type TransactionNode = typeof TransactionNode.Type
|
|
40
|
+
|
|
41
|
+
const TransactionsPage = Schema.Struct({
|
|
42
|
+
pageInfo: Schema.Struct({ hasNextPage: Schema.Boolean, endCursor: Schema.NullOr(Schema.String) }),
|
|
43
|
+
nodes: Schema.Array(TransactionNode)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const TRANSACTIONS_FIELDS = `pageInfo{hasNextPage endCursor} nodes{digest effects{${effectsFields(NESTED_CHANGES)} ` +
|
|
47
|
+
`events(first:${EVENTS_PAGE}){${EVENTS_PAGE_FIELDS}}}}`
|
|
48
|
+
|
|
49
|
+
export const GetCheckpoint = GraphQL.query("GetCheckpoint", {
|
|
50
|
+
document: "query GetCheckpoint($sequenceNumber:UInt53!){checkpoint(sequenceNumber:$sequenceNumber){" +
|
|
51
|
+
`sequenceNumber digest timestamp epoch{epochId} transactions(first:${TX_PAGE}){${TRANSACTIONS_FIELDS}}}}`,
|
|
52
|
+
variables: { sequenceNumber: Schema.Number },
|
|
53
|
+
result: Schema.Struct({
|
|
54
|
+
checkpoint: Schema.NullOr(Schema.Struct({
|
|
55
|
+
sequenceNumber: U64,
|
|
56
|
+
digest: Schema.String,
|
|
57
|
+
timestamp: Schema.String,
|
|
58
|
+
epoch: Schema.NullOr(Schema.Struct({ epochId: U64 })),
|
|
59
|
+
transactions: Schema.NullOr(TransactionsPage)
|
|
60
|
+
}))
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
export const GetCheckpointTransactions = GraphQL.query("GetCheckpointTransactions", {
|
|
65
|
+
document: "query GetCheckpointTransactions($sequenceNumber:UInt53!,$after:String){checkpoint(sequenceNumber:$sequenceNumber){" +
|
|
66
|
+
`transactions(first:${TX_PAGE},after:$after){${TRANSACTIONS_FIELDS}}}}`,
|
|
67
|
+
variables: { sequenceNumber: Schema.Number, after: Schema.String },
|
|
68
|
+
result: Schema.Struct({ checkpoint: Schema.NullOr(Schema.Struct({ transactions: Schema.NullOr(TransactionsPage) })) })
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
export const SubscribeCheckpointNumbers = GraphQL.subscription("SubscribeCheckpointNumbers", {
|
|
72
|
+
document: "subscription SubscribeCheckpointNumbers($after:String){checkpoints(after:$after){cursor node{sequenceNumber}}}",
|
|
73
|
+
variables: { after: Schema.NullOr(Schema.String) },
|
|
74
|
+
result: Schema.Struct({ checkpoints: Schema.Struct({ cursor: Schema.String, node: Schema.Struct({ sequenceNumber: U64 }) }) })
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
export const group = GraphQLGroup.make(
|
|
78
|
+
GetCheckpoint,
|
|
79
|
+
GetCheckpointTransactions,
|
|
80
|
+
Tip,
|
|
81
|
+
SubscribeCheckpointNumbers,
|
|
82
|
+
GetObjectChanges,
|
|
83
|
+
GetTransactionEvents
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* `CheckpointData` over GraphQL. `get` reads a checkpoint with its first 50
|
|
88
|
+
* transactions (each with its first 50 object changes and events) in one
|
|
89
|
+
* request, and completes whatever didn't fit by paging. `list` pins its open
|
|
90
|
+
* ends to the indexer's served range (tip as of the call, retention floor) and
|
|
91
|
+
* `get`s each checkpoint number in it; `subscribe` follows the checkpoint
|
|
92
|
+
* subscription (cursor-resumed, bounded reconnects) and `get`s each new
|
|
93
|
+
* checkpoint, waiting briefly if the indexer trails the subscription. Both
|
|
94
|
+
* fetch up to 16 checkpoints ahead concurrently and deliver them in order, so
|
|
95
|
+
* they keep up with the chain.
|
|
96
|
+
*/
|
|
97
|
+
export const layer: Layer.Layer<CheckpointData.CheckpointData, never, GraphQLProtocol.GraphQLProtocol> = Layer.effect(
|
|
98
|
+
CheckpointData.CheckpointData,
|
|
99
|
+
Effect.gen(function*() {
|
|
100
|
+
const client = yield* GraphQLClient.make(group, noClientRetry)
|
|
101
|
+
|
|
102
|
+
const transaction = (checkpoint: bigint, index: bigint, t: TransactionNode) =>
|
|
103
|
+
Effect.gen(function*() {
|
|
104
|
+
const fx = t.effects
|
|
105
|
+
if (fx === null) {
|
|
106
|
+
return yield* Effect.fail(new RpcError({ method: "GetCheckpoint", code: "DATA_LOSS", message: `transaction ${t.digest} without effects` }))
|
|
107
|
+
}
|
|
108
|
+
const [changes, events] = yield* Effect.all([
|
|
109
|
+
rest("GetCheckpoint", "object changes", fx.objectChanges, (after) =>
|
|
110
|
+
Effect.map(client.GetObjectChanges({ digest: t.digest, after }), (r) => r.transactionEffects?.objectChanges ?? null), false),
|
|
111
|
+
rest("GetCheckpoint", "events", fx.events, (after) =>
|
|
112
|
+
Effect.map(client.GetTransactionEvents({ digest: t.digest, after }), (r) => r.transactionEffects?.events ?? null), false)
|
|
113
|
+
])
|
|
114
|
+
const e = effects(fx, changes)
|
|
115
|
+
return {
|
|
116
|
+
digest: t.digest,
|
|
117
|
+
index,
|
|
118
|
+
status: e.status,
|
|
119
|
+
gasUsed: e.gasUsed,
|
|
120
|
+
changedObjects: e.changedObjects,
|
|
121
|
+
events: events.map((ev) => event(ev, { checkpoint, transactionDigest: t.digest, transactionIndex: index }))
|
|
122
|
+
} satisfies CheckpointData.CheckpointTransaction
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
const get = (sequenceNumber: bigint): Effect.Effect<CheckpointData.Checkpoint, CheckpointData.CheckpointNotFound | RpcError> =>
|
|
126
|
+
Effect.gen(function*() {
|
|
127
|
+
const r = yield* call(client.GetCheckpoint({ sequenceNumber: Number(sequenceNumber) }))
|
|
128
|
+
const c = r.checkpoint
|
|
129
|
+
if (c === null) return yield* new CheckpointData.CheckpointNotFound({ sequenceNumber })
|
|
130
|
+
const dataLoss = (message: string) => new RpcError({ method: "GetCheckpoint", code: "DATA_LOSS", message })
|
|
131
|
+
if (c.epoch === null) return yield* dataLoss(`checkpoint ${sequenceNumber} without an epoch`)
|
|
132
|
+
const epoch = c.epoch.epochId
|
|
133
|
+
const timestampMs = Date.parse(c.timestamp)
|
|
134
|
+
if (!Number.isFinite(timestampMs)) {
|
|
135
|
+
return yield* dataLoss(`checkpoint ${sequenceNumber} has an unreadable timestamp ${JSON.stringify(c.timestamp)}`)
|
|
136
|
+
}
|
|
137
|
+
const nodes = yield* rest("GetCheckpoint", "transactions", c.transactions, (after) =>
|
|
138
|
+
Effect.map(
|
|
139
|
+
client.GetCheckpointTransactions({ sequenceNumber: Number(sequenceNumber), after }),
|
|
140
|
+
(r) => r.checkpoint?.transactions ?? null
|
|
141
|
+
), false)
|
|
142
|
+
const transactions = yield* Effect.forEach(nodes, (t, i) => transaction(c.sequenceNumber, BigInt(i), t), {
|
|
143
|
+
concurrency: 8
|
|
144
|
+
})
|
|
145
|
+
return {
|
|
146
|
+
sequenceNumber: c.sequenceNumber,
|
|
147
|
+
digest: c.digest,
|
|
148
|
+
epoch,
|
|
149
|
+
timestampMs: BigInt(timestampMs),
|
|
150
|
+
transactions
|
|
151
|
+
}
|
|
152
|
+
}).pipe(Effect.withSpan("CheckpointData.get", { attributes: { sequenceNumber: String(sequenceNumber) } }))
|
|
153
|
+
|
|
154
|
+
/** In a list or a subscription a missing checkpoint is the indexer trailing: wait for it, then give up as UNAVAILABLE. */
|
|
155
|
+
const getIndexed = (sequenceNumber: bigint) =>
|
|
156
|
+
get(sequenceNumber).pipe(
|
|
157
|
+
Effect.retry({ while: (e) => e._tag === "CheckpointNotFound", schedule: Schedule.spaced("250 millis"), times: 40 }),
|
|
158
|
+
Effect.catchTag("CheckpointNotFound", () =>
|
|
159
|
+
Effect.fail(new RpcError({ method: "GetCheckpoint", code: "UNAVAILABLE", message: `checkpoint ${sequenceNumber} is not indexed yet` })))
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
return CheckpointData.CheckpointData.of({
|
|
163
|
+
get,
|
|
164
|
+
list: (options) => {
|
|
165
|
+
const start = options?.start
|
|
166
|
+
const end = options?.end
|
|
167
|
+
if (start !== undefined && end !== undefined && start >= end) return Stream.empty
|
|
168
|
+
// Pin the open ends before the first read, like gRPC: the end at the tip
|
|
169
|
+
// as of the call, an absent start at the indexer's retention floor.
|
|
170
|
+
const range = start !== undefined && end !== undefined
|
|
171
|
+
? Effect.succeed({ first: start, end })
|
|
172
|
+
: client.Tip().pipe(call, Effect.flatMap(rangeOf))
|
|
173
|
+
return Stream.unwrap(Effect.map(range, (served) => {
|
|
174
|
+
const from = start ?? served.first
|
|
175
|
+
const until = end ?? served.end
|
|
176
|
+
if (from >= until) return Stream.empty
|
|
177
|
+
// Checkpoint numbers are consecutive: enumerate them, nothing to list.
|
|
178
|
+
return Stream.paginate(from, (n) => {
|
|
179
|
+
const to = n + NUMBERS_STEP < until ? n + NUMBERS_STEP : until
|
|
180
|
+
const numbers: Array<bigint> = []
|
|
181
|
+
for (let i = n; i < to; i++) numbers.push(i)
|
|
182
|
+
return Effect.succeed([numbers, to < until ? Option.some(to) : Option.none()] as const)
|
|
183
|
+
}).pipe(Stream.mapEffect(getIndexed, { concurrency: CONCURRENCY }))
|
|
184
|
+
}))
|
|
185
|
+
},
|
|
186
|
+
subscribe: resubscribe((after) =>
|
|
187
|
+
client.SubscribeCheckpointNumbers({ after }).pipe(Stream.map(({ checkpoints }) => checkpoints))
|
|
188
|
+
).pipe(Stream.mapEffect((edge) => getIndexed(edge.node.sequenceNumber), { concurrency: CONCURRENCY }))
|
|
189
|
+
})
|
|
190
|
+
})
|
|
191
|
+
)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect"
|
|
2
|
+
import * as GraphQL from "effect/graphql/GraphQL"
|
|
3
|
+
import * as GraphQLClient from "effect/graphql/GraphQLClient"
|
|
4
|
+
import * as GraphQLGroup from "effect/graphql/GraphQLGroup"
|
|
5
|
+
import type * as GraphQLProtocol from "effect/graphql/GraphQLProtocol"
|
|
6
|
+
import * as Layer from "effect/Layer"
|
|
7
|
+
import * as Option from "effect/Option"
|
|
8
|
+
import * as Schema from "effect/Schema"
|
|
9
|
+
import * as Stream from "effect/Stream"
|
|
10
|
+
import * as Checkpoints from "../Checkpoints.ts"
|
|
11
|
+
import { call, U64 } from "./convert.ts"
|
|
12
|
+
import { noClientRetry, resubscribe } from "./subscription.ts"
|
|
13
|
+
import { rangeOf, Tip } from "./tip.ts"
|
|
14
|
+
|
|
15
|
+
/** The largest page the server allows for `Query.checkpoints`. */
|
|
16
|
+
const PAGE = 50
|
|
17
|
+
|
|
18
|
+
const CheckpointNode = Schema.Struct({ sequenceNumber: U64, digest: Schema.String })
|
|
19
|
+
|
|
20
|
+
export const ListCheckpoints = GraphQL.query("ListCheckpoints", {
|
|
21
|
+
document: "query ListCheckpoints($first:Int,$after:String,$filter:CheckpointFilter){" +
|
|
22
|
+
"checkpoints(first:$first,after:$after,filter:$filter){pageInfo{hasNextPage endCursor}nodes{sequenceNumber digest}}}",
|
|
23
|
+
variables: {
|
|
24
|
+
first: Schema.Number,
|
|
25
|
+
after: Schema.NullOr(Schema.String),
|
|
26
|
+
filter: Schema.Struct({
|
|
27
|
+
afterCheckpoint: Schema.optionalKey(Schema.Number),
|
|
28
|
+
beforeCheckpoint: Schema.optionalKey(Schema.Number)
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
result: Schema.Struct({
|
|
32
|
+
checkpoints: Schema.Struct({
|
|
33
|
+
pageInfo: Schema.Struct({ hasNextPage: Schema.Boolean, endCursor: Schema.NullOr(Schema.String) }),
|
|
34
|
+
nodes: Schema.Array(CheckpointNode)
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
export const SubscribeCheckpoints = GraphQL.subscription("SubscribeCheckpoints", {
|
|
40
|
+
document: "subscription SubscribeCheckpoints($after:String){checkpoints(after:$after){cursor node{sequenceNumber digest}}}",
|
|
41
|
+
variables: { after: Schema.NullOr(Schema.String) },
|
|
42
|
+
result: Schema.Struct({ checkpoints: Schema.Struct({ cursor: Schema.String, node: CheckpointNode }) })
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
export const group = GraphQLGroup.make(ListCheckpoints, SubscribeCheckpoints, Tip)
|
|
46
|
+
|
|
47
|
+
export { MAX_RECONNECTS } from "./subscription.ts"
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* `Checkpoints` over GraphQL. `list` pages `Query.checkpoints`, an open end
|
|
51
|
+
* pinned to the tip as of the call (`start >= end` is an empty stream; gRPC
|
|
52
|
+
* fails `start > end` with INVALID_ARGUMENT).
|
|
53
|
+
*
|
|
54
|
+
* `subscribe` is the `checkpoints` subscription over graphql-sse. After a
|
|
55
|
+
* retryable failure it reconnects with backoff (honouring `Retry-After`) and
|
|
56
|
+
* resumes from the last cursor it delivered, so no checkpoint is skipped or
|
|
57
|
+
* repeated. After {@link MAX_RECONNECTS} consecutive failures without a
|
|
58
|
+
* checkpoint in between, or any non-retryable failure, the stream fails with
|
|
59
|
+
* the last `RpcError`, so supervision and failover see it as over gRPC.
|
|
60
|
+
*/
|
|
61
|
+
export const layer: Layer.Layer<Checkpoints.Checkpoints, never, GraphQLProtocol.GraphQLProtocol> = Layer.effect(
|
|
62
|
+
Checkpoints.Checkpoints,
|
|
63
|
+
Effect.gen(function*() {
|
|
64
|
+
// The client's own resubscription would restart from the live tip; this
|
|
65
|
+
// layer reconnects itself, with the cursor.
|
|
66
|
+
const client = yield* GraphQLClient.make(group, noClientRetry)
|
|
67
|
+
return Checkpoints.Checkpoints.of({
|
|
68
|
+
list: (options) => {
|
|
69
|
+
const start = options?.start
|
|
70
|
+
if (start !== undefined && options?.end !== undefined && start >= options.end) return Stream.empty
|
|
71
|
+
// Pin the open end to the tip as of the call, like gRPC, so the listing
|
|
72
|
+
// ends there instead of chasing a moving tip.
|
|
73
|
+
const end = options?.end !== undefined
|
|
74
|
+
? Effect.succeed(options.end)
|
|
75
|
+
: client.Tip().pipe(call, Effect.flatMap(rangeOf), Effect.map((r) => r.end))
|
|
76
|
+
return Stream.unwrap(Effect.map(end, (end) => {
|
|
77
|
+
if (start !== undefined && start >= end) return Stream.empty
|
|
78
|
+
const filter = {
|
|
79
|
+
...(start !== undefined && start > 0n && { afterCheckpoint: Number(start - 1n) }),
|
|
80
|
+
beforeCheckpoint: Number(end)
|
|
81
|
+
}
|
|
82
|
+
return Stream.paginate(null as string | null, (after) =>
|
|
83
|
+
client.ListCheckpoints({ first: PAGE, after, filter }).pipe(
|
|
84
|
+
call,
|
|
85
|
+
Effect.map(({ checkpoints: c }) =>
|
|
86
|
+
[c.nodes, Option.fromNullishOr(c.pageInfo.hasNextPage ? c.pageInfo.endCursor : null)] as const
|
|
87
|
+
)
|
|
88
|
+
))
|
|
89
|
+
}))
|
|
90
|
+
},
|
|
91
|
+
subscribe: resubscribe((after) =>
|
|
92
|
+
client.SubscribeCheckpoints({ after }).pipe(Stream.map(({ checkpoints }) => checkpoints))
|
|
93
|
+
).pipe(Stream.map((edge) => edge.node))
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect"
|
|
2
|
+
import * as GraphQL from "effect/graphql/GraphQL"
|
|
3
|
+
import * as GraphQLClient from "effect/graphql/GraphQLClient"
|
|
4
|
+
import * as GraphQLGroup from "effect/graphql/GraphQLGroup"
|
|
5
|
+
import type * as GraphQLProtocol from "effect/graphql/GraphQLProtocol"
|
|
6
|
+
import * as Layer from "effect/Layer"
|
|
7
|
+
import * as Option from "effect/Option"
|
|
8
|
+
import * as Schema from "effect/Schema"
|
|
9
|
+
import * as Stream from "effect/Stream"
|
|
10
|
+
import type { Address } from "../Address.ts"
|
|
11
|
+
import * as Coins from "../Coins.ts"
|
|
12
|
+
import * as Objects from "../Objects.ts"
|
|
13
|
+
import * as TypeTag from "../TypeTag.ts"
|
|
14
|
+
import { call, U64 } from "./convert.ts"
|
|
15
|
+
|
|
16
|
+
const BALANCE_FIELDS = "coinType{repr} totalBalance addressBalance coinBalance"
|
|
17
|
+
|
|
18
|
+
const BalanceNode = Schema.Struct({
|
|
19
|
+
coinType: Schema.NullOr(Schema.Struct({ repr: Schema.String })),
|
|
20
|
+
totalBalance: Schema.NullOr(U64),
|
|
21
|
+
addressBalance: Schema.NullOr(U64),
|
|
22
|
+
coinBalance: Schema.NullOr(U64)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const balance = (b: typeof BalanceNode.Type | null, coinType: string): Coins.Balance => ({
|
|
26
|
+
coinType: b?.coinType?.repr ?? coinType,
|
|
27
|
+
total: b?.totalBalance ?? 0n,
|
|
28
|
+
addressBalance: b?.addressBalance ?? 0n,
|
|
29
|
+
coinBalance: b?.coinBalance ?? 0n
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
export const GetBalance = GraphQL.query("GetBalance", {
|
|
33
|
+
document: "query GetBalance($owner:SuiAddress!,$coinType:String!){" +
|
|
34
|
+
`address(address:$owner){balance(coinType:$coinType){${BALANCE_FIELDS}}}}`,
|
|
35
|
+
variables: { owner: Schema.String, coinType: Schema.String },
|
|
36
|
+
result: Schema.Struct({ address: Schema.NullOr(Schema.Struct({ balance: Schema.NullOr(BalanceNode) })) })
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
/** The largest page the server allows for `Address.balances`. */
|
|
40
|
+
const BALANCES_PAGE = 50
|
|
41
|
+
|
|
42
|
+
export const ListBalances = GraphQL.query("ListBalances", {
|
|
43
|
+
document: "query ListBalances($owner:SuiAddress!,$after:String){" +
|
|
44
|
+
`address(address:$owner){balances(first:${BALANCES_PAGE},after:$after){pageInfo{hasNextPage endCursor} nodes{${BALANCE_FIELDS}}}}}`,
|
|
45
|
+
variables: { owner: Schema.String, after: Schema.NullOr(Schema.String) },
|
|
46
|
+
result: Schema.Struct({
|
|
47
|
+
address: Schema.NullOr(Schema.Struct({
|
|
48
|
+
balances: Schema.NullOr(Schema.Struct({
|
|
49
|
+
pageInfo: Schema.Struct({ hasNextPage: Schema.Boolean, endCursor: Schema.NullOr(Schema.String) }),
|
|
50
|
+
// A listed balance always names its coin type.
|
|
51
|
+
nodes: Schema.Array(Schema.Struct({ ...BalanceNode.fields, coinType: Schema.Struct({ repr: Schema.String }) }))
|
|
52
|
+
}))
|
|
53
|
+
}))
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
export const group = GraphQLGroup.make(GetBalance, ListBalances)
|
|
58
|
+
|
|
59
|
+
/** `Coins` over GraphQL. Coin listing goes through `Objects.listOwned`. */
|
|
60
|
+
export const layer: Layer.Layer<Coins.Coins, never, GraphQLProtocol.GraphQLProtocol | Objects.Objects> = Layer.effect(
|
|
61
|
+
Coins.Coins,
|
|
62
|
+
Effect.gen(function*() {
|
|
63
|
+
const client = yield* GraphQLClient.make(group)
|
|
64
|
+
const objects = yield* Objects.Objects
|
|
65
|
+
return Coins.Coins.of({
|
|
66
|
+
getBalance: (owner: Address, coinType = TypeTag.SUI) =>
|
|
67
|
+
client.GetBalance({ owner, coinType }).pipe(
|
|
68
|
+
call,
|
|
69
|
+
Effect.map((r) => balance(r.address?.balance ?? null, coinType))
|
|
70
|
+
),
|
|
71
|
+
listBalances: (owner) =>
|
|
72
|
+
Stream.paginate(null as string | null, (after) =>
|
|
73
|
+
client.ListBalances({ owner, after }).pipe(
|
|
74
|
+
call,
|
|
75
|
+
Effect.map((r) => {
|
|
76
|
+
const page = r.address?.balances
|
|
77
|
+
const next = page?.pageInfo.hasNextPage ? page.pageInfo.endCursor : null
|
|
78
|
+
return [(page?.nodes ?? []).map((b) => balance(b, b.coinType.repr)), Option.fromNullishOr(next)] as const
|
|
79
|
+
})
|
|
80
|
+
)),
|
|
81
|
+
list: (owner: Address, coinType?: string) =>
|
|
82
|
+
Coins.fromObjects("ListOwnedObjects", coinType, (type) => objects.listOwned(owner, { type }))
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
)
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect"
|
|
2
|
+
import * as GraphQL from "effect/graphql/GraphQL"
|
|
3
|
+
import * as GraphQLClient from "effect/graphql/GraphQLClient"
|
|
4
|
+
import * as GraphQLGroup from "effect/graphql/GraphQLGroup"
|
|
5
|
+
import type * as GraphQLProtocol from "effect/graphql/GraphQLProtocol"
|
|
6
|
+
import * as Layer from "effect/Layer"
|
|
7
|
+
import * as Option from "effect/Option"
|
|
8
|
+
import * as Schema from "effect/Schema"
|
|
9
|
+
import * as Stream from "effect/Stream"
|
|
10
|
+
import * as Bcs from "@unconfirmed/effect-bcs/Bcs"
|
|
11
|
+
import * as Address from "../Address.ts"
|
|
12
|
+
import * as DynamicFields from "../DynamicFields.ts"
|
|
13
|
+
import * as Objects from "../Objects.ts"
|
|
14
|
+
import { RpcError } from "../RpcError.ts"
|
|
15
|
+
import * as TypeTag from "../TypeTag.ts"
|
|
16
|
+
import { Bytes, call } from "./convert.ts"
|
|
17
|
+
|
|
18
|
+
/** The largest page the server allows for `dynamicFields`. */
|
|
19
|
+
const MAX_PAGE = 50
|
|
20
|
+
|
|
21
|
+
const Repr = Schema.Struct({ repr: Schema.String })
|
|
22
|
+
|
|
23
|
+
const FieldNode = Schema.Struct({
|
|
24
|
+
address: Schema.String,
|
|
25
|
+
name: Schema.Struct({ type: Repr, bcs: Bytes }),
|
|
26
|
+
value: Schema.Union([
|
|
27
|
+
Schema.Struct({ __typename: Schema.Literal("MoveValue"), type: Repr, bcs: Bytes }),
|
|
28
|
+
Schema.Struct({ __typename: Schema.Literal("MoveObject"), address: Schema.String, contents: Schema.Struct({ type: Repr }) })
|
|
29
|
+
])
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
export const ListDynamicFields = GraphQL.query("ListDynamicFields", {
|
|
33
|
+
document: "query ListDynamicFields($parent:SuiAddress!,$first:Int,$after:String){address(address:$parent){" +
|
|
34
|
+
"dynamicFields(first:$first,after:$after){pageInfo{hasNextPage endCursor}nodes{address name{type{repr} bcs} " +
|
|
35
|
+
"value{__typename ...on MoveValue{type{repr} bcs} ...on MoveObject{address contents{type{repr}}}}}}}}",
|
|
36
|
+
variables: { parent: Schema.String, first: Schema.Number, after: Schema.NullOr(Schema.String) },
|
|
37
|
+
result: Schema.Struct({
|
|
38
|
+
address: Schema.NullOr(Schema.Struct({
|
|
39
|
+
dynamicFields: Schema.NullOr(Schema.Struct({
|
|
40
|
+
pageInfo: Schema.Struct({ hasNextPage: Schema.Boolean, endCursor: Schema.NullOr(Schema.String) }),
|
|
41
|
+
nodes: Schema.Array(FieldNode)
|
|
42
|
+
}))
|
|
43
|
+
}))
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
export const group = GraphQLGroup.make(ListDynamicFields)
|
|
48
|
+
|
|
49
|
+
const addressBytes = (a: string): Uint8Array => Bcs.encodeSync(Bcs.Address)(Address.normalize(a))
|
|
50
|
+
|
|
51
|
+
const canonical = (type: string) => {
|
|
52
|
+
try {
|
|
53
|
+
return TypeTag.normalizeString(type)
|
|
54
|
+
} catch {
|
|
55
|
+
return type
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const info = (parent: Address.Address, f: typeof FieldNode.Type): DynamicFields.FieldInfo =>
|
|
60
|
+
f.value.__typename === "MoveObject"
|
|
61
|
+
? {
|
|
62
|
+
kind: "Object",
|
|
63
|
+
parent,
|
|
64
|
+
fieldId: Address.normalize(f.address),
|
|
65
|
+
name: { type: canonical(f.name.type.repr), bcs: f.name.bcs },
|
|
66
|
+
valueType: canonical(f.value.contents.type.repr),
|
|
67
|
+
value: addressBytes(f.value.address),
|
|
68
|
+
childId: Address.normalize(f.value.address)
|
|
69
|
+
}
|
|
70
|
+
: {
|
|
71
|
+
kind: "Field",
|
|
72
|
+
parent,
|
|
73
|
+
fieldId: Address.normalize(f.address),
|
|
74
|
+
name: { type: canonical(f.name.type.repr), bcs: f.name.bcs },
|
|
75
|
+
valueType: canonical(f.value.type.repr),
|
|
76
|
+
value: f.value.bcs,
|
|
77
|
+
childId: undefined
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const fieldIdOf = (parent: Address.Address, type: string, name: DynamicFields.Name) =>
|
|
81
|
+
Effect.try({
|
|
82
|
+
try: () => DynamicFields.deriveId(parent, type, name.bcs),
|
|
83
|
+
catch: (e) => new DynamicFields.InvalidDynamicFieldName({ nameType: type, issue: e instanceof Error ? e.message : String(e) })
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
/** `Field<N, V>` -> `V`, canonical. */
|
|
87
|
+
const valueTypeOf = (fieldType: string) => {
|
|
88
|
+
try {
|
|
89
|
+
const t = TypeTag.parse(fieldType)
|
|
90
|
+
return t._tag === "struct" && t.typeParams[1] ? TypeTag.format(t.typeParams[1]) : fieldType
|
|
91
|
+
} catch {
|
|
92
|
+
return fieldType
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* `DynamicFields` over GraphQL. `get` and `getObject` derive the field id and
|
|
98
|
+
* read through `Objects.get`, so concurrent reads batch with every other object
|
|
99
|
+
* read into `multiGetObjects`; `list` pages `Address.dynamicFields`.
|
|
100
|
+
*
|
|
101
|
+
* GraphQL's `dynamicFields` has no name-type filter, so `nameType` is applied
|
|
102
|
+
* client-side (same matching as the gRPC layer); a sparse match still pages
|
|
103
|
+
* through every field.
|
|
104
|
+
*/
|
|
105
|
+
export const layer: Layer.Layer<DynamicFields.DynamicFields, never, GraphQLProtocol.GraphQLProtocol | Objects.Objects> =
|
|
106
|
+
Layer.effect(
|
|
107
|
+
DynamicFields.DynamicFields,
|
|
108
|
+
Effect.gen(function*() {
|
|
109
|
+
const client = yield* GraphQLClient.make(group)
|
|
110
|
+
const objects = yield* Objects.Objects
|
|
111
|
+
|
|
112
|
+
const readField = (parent: Address.Address, type: string, name: DynamicFields.Name) =>
|
|
113
|
+
Effect.flatMap(fieldIdOf(parent, type, name), (fieldId) =>
|
|
114
|
+
objects.get(fieldId).pipe(
|
|
115
|
+
Effect.catchTag("ObjectNotFound", () =>
|
|
116
|
+
Effect.fail(new DynamicFields.DynamicFieldNotFound({ parent, nameType: name.type, fieldId }))),
|
|
117
|
+
// Field<N, V> = { id: UID, name: N, value: V }; the name's bytes are the ones hashed into the id.
|
|
118
|
+
Effect.map((field): DynamicFields.DynamicField => ({
|
|
119
|
+
parent,
|
|
120
|
+
fieldId,
|
|
121
|
+
name,
|
|
122
|
+
valueType: valueTypeOf(field.type),
|
|
123
|
+
value: field.contents.subarray(32 + name.bcs.length),
|
|
124
|
+
field
|
|
125
|
+
}))
|
|
126
|
+
))
|
|
127
|
+
|
|
128
|
+
return DynamicFields.DynamicFields.of({
|
|
129
|
+
get: (parent, name) =>
|
|
130
|
+
readField(parent, name.type, name).pipe(
|
|
131
|
+
Effect.withSpan("DynamicFields.get", { attributes: { parent, nameType: name.type } })
|
|
132
|
+
),
|
|
133
|
+
getObject: (parent, name) =>
|
|
134
|
+
readField(parent, DynamicFields.objectFieldNameType(name.type), name).pipe(
|
|
135
|
+
Effect.flatMap((f) =>
|
|
136
|
+
f.value.length < 32
|
|
137
|
+
? Effect.fail(
|
|
138
|
+
new RpcError({
|
|
139
|
+
method: "GetObject",
|
|
140
|
+
code: "DATA_LOSS",
|
|
141
|
+
message: `dynamic object field ${f.fieldId} holds ${f.value.length} bytes, not an object id`
|
|
142
|
+
})
|
|
143
|
+
)
|
|
144
|
+
: objects.get(Address.fromBytes(f.value.subarray(0, 32))).pipe(
|
|
145
|
+
Effect.catchTag("ObjectNotFound", () =>
|
|
146
|
+
Effect.fail(new DynamicFields.DynamicFieldNotFound({ parent, nameType: name.type, fieldId: f.fieldId })))
|
|
147
|
+
)
|
|
148
|
+
),
|
|
149
|
+
Effect.withSpan("DynamicFields.getObject", { attributes: { parent, nameType: name.type } })
|
|
150
|
+
),
|
|
151
|
+
list: (parent, options) =>
|
|
152
|
+
Stream.paginate(null as string | null, (after) =>
|
|
153
|
+
client
|
|
154
|
+
.ListDynamicFields({ parent, first: Math.min(options?.pageSize ?? MAX_PAGE, MAX_PAGE), after })
|
|
155
|
+
.pipe(
|
|
156
|
+
call,
|
|
157
|
+
Effect.map((r) => {
|
|
158
|
+
const page = r.address?.dynamicFields
|
|
159
|
+
const fields = (page?.nodes ?? [])
|
|
160
|
+
.map((f) => info(parent, f))
|
|
161
|
+
.filter((i) => !options?.nameType || TypeTag.matchesPath(options.nameType, i.name.type))
|
|
162
|
+
return [fields, Option.fromNullishOr(page?.pageInfo.hasNextPage ? page.pageInfo.endCursor : null)] as const
|
|
163
|
+
})
|
|
164
|
+
))
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
)
|