@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,450 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL values -> domain values and GraphQL failures -> `RpcError`, shared by
|
|
3
|
+
* the GraphQL implementations. Every invariant the domain types need (an
|
|
4
|
+
* object has an owner, a status is SUCCESS or FAILURE, ...) is in a Schema,
|
|
5
|
+
* so a response that breaks one is a `DecodeError` (-> `DATA_LOSS`) and the
|
|
6
|
+
* conversions below are total.
|
|
7
|
+
*/
|
|
8
|
+
import * as Effect from "effect/Effect"
|
|
9
|
+
import * as GraphQLClientError from "effect/graphql/GraphQLClientError"
|
|
10
|
+
import * as Schema from "effect/Schema"
|
|
11
|
+
import * as SchemaGetter from "effect/SchemaGetter"
|
|
12
|
+
import * as Stream from "effect/Stream"
|
|
13
|
+
import * as Address from "../Address.ts"
|
|
14
|
+
import type * as Events from "../Events.ts"
|
|
15
|
+
import type * as Objects from "../Objects.ts"
|
|
16
|
+
import { type RpcCode, RpcError } from "../RpcError.ts"
|
|
17
|
+
import type { ObjectDigest } from "../TransactionData.ts"
|
|
18
|
+
import type * as Transactions from "../Transactions.ts"
|
|
19
|
+
|
|
20
|
+
// -----------------------------------------------------------------------------
|
|
21
|
+
// Scalars
|
|
22
|
+
// -----------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
/** `UInt53` (a JSON number) or `BigInt` (a JSON string of digits), decoded to `bigint`. */
|
|
25
|
+
export const U64 = Schema.Union([Schema.Int, Schema.String.check(Schema.isPattern(/^-?\d+$/))]).pipe(
|
|
26
|
+
Schema.decodeTo(Schema.BigInt, {
|
|
27
|
+
decode: SchemaGetter.BigInt(),
|
|
28
|
+
encode: SchemaGetter.transform((b: bigint) => b.toString())
|
|
29
|
+
})
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
/** `Base64` -> bytes. */
|
|
33
|
+
export const Bytes = Schema.Uint8ArrayFromBase64
|
|
34
|
+
|
|
35
|
+
const toBase64 = Schema.encodeSync(Schema.Uint8ArrayFromBase64)
|
|
36
|
+
export const base64 = (bytes: Uint8Array): string => toBase64(bytes)
|
|
37
|
+
|
|
38
|
+
const SuiAddress = Schema.Struct({ address: Schema.String })
|
|
39
|
+
|
|
40
|
+
// -----------------------------------------------------------------------------
|
|
41
|
+
// Objects
|
|
42
|
+
// -----------------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
export const OWNER_FIELDS =
|
|
45
|
+
"__typename ...on AddressOwner{address{address}} ...on ObjectOwner{address{address}} ...on Shared{initialSharedVersion} ...on ConsensusAddressOwner{startVersion address{address}}"
|
|
46
|
+
|
|
47
|
+
export const Owner = Schema.Union([
|
|
48
|
+
Schema.Struct({ __typename: Schema.Literal("AddressOwner"), address: SuiAddress }),
|
|
49
|
+
Schema.Struct({ __typename: Schema.Literal("ObjectOwner"), address: SuiAddress }),
|
|
50
|
+
Schema.Struct({ __typename: Schema.Literal("Shared"), initialSharedVersion: U64 }),
|
|
51
|
+
Schema.Struct({ __typename: Schema.Literal("Immutable") }),
|
|
52
|
+
Schema.Struct({ __typename: Schema.Literal("ConsensusAddressOwner"), startVersion: U64, address: SuiAddress })
|
|
53
|
+
])
|
|
54
|
+
|
|
55
|
+
export const owner = (o: typeof Owner.Type): Objects.Owner => {
|
|
56
|
+
switch (o.__typename) {
|
|
57
|
+
case "AddressOwner":
|
|
58
|
+
return { _tag: "AddressOwner", address: Address.normalize(o.address.address) }
|
|
59
|
+
case "ObjectOwner":
|
|
60
|
+
return { _tag: "ObjectOwner", address: Address.normalize(o.address.address) }
|
|
61
|
+
case "Shared":
|
|
62
|
+
return { _tag: "Shared", initialSharedVersion: o.initialSharedVersion }
|
|
63
|
+
case "Immutable":
|
|
64
|
+
return { _tag: "Immutable" }
|
|
65
|
+
case "ConsensusAddressOwner":
|
|
66
|
+
return {
|
|
67
|
+
_tag: "ConsensusAddressOwner",
|
|
68
|
+
startVersion: o.startVersion,
|
|
69
|
+
address: Address.normalize(o.address.address)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Selection on `Object` for a `SuiObject`. */
|
|
75
|
+
export const OBJECT_FIELDS =
|
|
76
|
+
`address version digest owner{${OWNER_FIELDS}} asMoveObject{contents{type{repr} bcs}} asMovePackage{address} previousTransaction{digest}`
|
|
77
|
+
|
|
78
|
+
const MoveContents = Schema.Struct({ type: Schema.Struct({ repr: Schema.String }), bcs: Bytes })
|
|
79
|
+
const PreviousTransaction = Schema.NullOr(Schema.Struct({ digest: Schema.String }))
|
|
80
|
+
|
|
81
|
+
export const ObjectNode = Schema.Struct({
|
|
82
|
+
address: Schema.String,
|
|
83
|
+
version: U64,
|
|
84
|
+
digest: Schema.String,
|
|
85
|
+
owner: Owner,
|
|
86
|
+
asMoveObject: Schema.NullOr(Schema.Struct({ contents: MoveContents })),
|
|
87
|
+
asMovePackage: Schema.NullOr(Schema.Struct({ address: Schema.String })),
|
|
88
|
+
previousTransaction: PreviousTransaction
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
/** Selection on `MoveObject` (owned-object listings) for a `SuiObject`. */
|
|
92
|
+
export const MOVE_OBJECT_FIELDS = `address version digest owner{${OWNER_FIELDS}} contents{type{repr} bcs} previousTransaction{digest}`
|
|
93
|
+
|
|
94
|
+
export const MoveObjectNode = Schema.Struct({
|
|
95
|
+
address: Schema.String,
|
|
96
|
+
version: U64,
|
|
97
|
+
digest: Schema.String,
|
|
98
|
+
owner: Owner,
|
|
99
|
+
contents: MoveContents,
|
|
100
|
+
previousTransaction: PreviousTransaction
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
export const object = (o: typeof ObjectNode.Type): Objects.SuiObject => ({
|
|
104
|
+
objectId: Address.normalize(o.address),
|
|
105
|
+
version: o.version,
|
|
106
|
+
digest: o.digest as ObjectDigest,
|
|
107
|
+
owner: owner(o.owner),
|
|
108
|
+
// Same as gRPC: a package's type is `package` and its contents are empty.
|
|
109
|
+
type: o.asMoveObject?.contents.type.repr ?? "package",
|
|
110
|
+
contents: o.asMoveObject?.contents.bcs ?? new Uint8Array(),
|
|
111
|
+
previousTransaction: o.previousTransaction?.digest
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
export const moveObject = (o: typeof MoveObjectNode.Type): Objects.SuiObject => ({
|
|
115
|
+
objectId: Address.normalize(o.address),
|
|
116
|
+
version: o.version,
|
|
117
|
+
digest: o.digest as ObjectDigest,
|
|
118
|
+
owner: owner(o.owner),
|
|
119
|
+
type: o.contents.type.repr,
|
|
120
|
+
contents: o.contents.bcs,
|
|
121
|
+
previousTransaction: o.previousTransaction?.digest
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
// -----------------------------------------------------------------------------
|
|
125
|
+
// Effects
|
|
126
|
+
// -----------------------------------------------------------------------------
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The largest `objectChanges` page the public services allow. The effects
|
|
130
|
+
* selection reads the first page; when `pageInfo.hasNextPage` is set the
|
|
131
|
+
* Transactions layer reads the rest by digest (see `TransactionsGraphQL.ts`).
|
|
132
|
+
*/
|
|
133
|
+
export const OBJECT_CHANGES_PAGE = 1024
|
|
134
|
+
|
|
135
|
+
const STATE_FIELDS = `version digest owner{${OWNER_FIELDS}} asMoveObject{contents{type{repr}}} asMovePackage{address}`
|
|
136
|
+
|
|
137
|
+
/** Selection on `ObjectChangeConnection` for one page of `ChangedObject`s. */
|
|
138
|
+
export const OBJECT_CHANGES_FIELDS = `pageInfo{hasNextPage endCursor} nodes{address idCreated idDeleted ` +
|
|
139
|
+
`inputState{${STATE_FIELDS}} outputState{${STATE_FIELDS}}}`
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Selection on `TransactionEffects` for `Effects`, with the first `changesPage`
|
|
143
|
+
* object changes. Nested under a list (checkpoint transactions) the page is
|
|
144
|
+
* kept small, because the server bounds the product of nested page sizes.
|
|
145
|
+
*/
|
|
146
|
+
export const effectsFields = (changesPage: number) =>
|
|
147
|
+
`digest status executionError{message abortCode module{name package{address}} function{name} instructionOffset sourceLineNumber identifier constant} ` +
|
|
148
|
+
`gasEffects{gasSummary{computationCost storageCost storageRebate nonRefundableStorageFee}} ` +
|
|
149
|
+
`objectChanges(first:${changesPage}){${OBJECT_CHANGES_FIELDS}}`
|
|
150
|
+
|
|
151
|
+
export const EFFECTS_FIELDS = effectsFields(OBJECT_CHANGES_PAGE)
|
|
152
|
+
|
|
153
|
+
const TypeOnly = Schema.Struct({
|
|
154
|
+
asMoveObject: Schema.NullOr(Schema.Struct({ contents: Schema.NullOr(Schema.Struct({ type: Schema.Struct({ repr: Schema.String }) })) })),
|
|
155
|
+
asMovePackage: Schema.NullOr(Schema.Struct({ address: Schema.String }))
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
const State = Schema.Struct({
|
|
159
|
+
...TypeOnly.fields,
|
|
160
|
+
version: U64,
|
|
161
|
+
digest: Schema.NullOr(Schema.String),
|
|
162
|
+
owner: Schema.NullOr(Owner)
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
const ObjectChange = Schema.Struct({
|
|
166
|
+
address: Schema.String,
|
|
167
|
+
idCreated: Schema.NullOr(Schema.Boolean),
|
|
168
|
+
idDeleted: Schema.NullOr(Schema.Boolean),
|
|
169
|
+
inputState: Schema.NullOr(State),
|
|
170
|
+
outputState: Schema.NullOr(State)
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
export const ObjectChangesPage = Schema.Struct({
|
|
174
|
+
pageInfo: Schema.Struct({ hasNextPage: Schema.Boolean, endCursor: Schema.NullOr(Schema.String) }),
|
|
175
|
+
nodes: Schema.Array(ObjectChange)
|
|
176
|
+
})
|
|
177
|
+
export type ObjectChange = typeof ObjectChange.Type
|
|
178
|
+
|
|
179
|
+
const GasSummary = Schema.Struct({
|
|
180
|
+
computationCost: Schema.NullOr(U64),
|
|
181
|
+
storageCost: Schema.NullOr(U64),
|
|
182
|
+
storageRebate: Schema.NullOr(U64),
|
|
183
|
+
nonRefundableStorageFee: Schema.NullOr(U64)
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
export const EffectsNode = Schema.Struct({
|
|
187
|
+
digest: Schema.String,
|
|
188
|
+
status: Schema.Literals(["SUCCESS", "FAILURE"]),
|
|
189
|
+
executionError: Schema.NullOr(Schema.Struct({
|
|
190
|
+
message: Schema.String,
|
|
191
|
+
abortCode: Schema.NullOr(U64),
|
|
192
|
+
module: Schema.optionalKey(Schema.NullOr(Schema.Struct({ name: Schema.String, package: Schema.NullOr(Schema.Struct({ address: Schema.String })) }))),
|
|
193
|
+
function: Schema.optionalKey(Schema.NullOr(Schema.Struct({ name: Schema.String }))),
|
|
194
|
+
instructionOffset: Schema.optionalKey(Schema.NullOr(Schema.Number)),
|
|
195
|
+
sourceLineNumber: Schema.optionalKey(Schema.NullOr(Schema.Number)),
|
|
196
|
+
identifier: Schema.optionalKey(Schema.NullOr(Schema.String)),
|
|
197
|
+
constant: Schema.optionalKey(Schema.NullOr(Schema.String))
|
|
198
|
+
})),
|
|
199
|
+
gasEffects: Schema.NullOr(Schema.Struct({ gasSummary: Schema.NullOr(GasSummary) })),
|
|
200
|
+
objectChanges: Schema.NullOr(ObjectChangesPage)
|
|
201
|
+
})
|
|
202
|
+
export type EffectsNode = typeof EffectsNode.Type
|
|
203
|
+
|
|
204
|
+
const typeOf = (s: typeof State.Type | null): string | undefined =>
|
|
205
|
+
s === null ? undefined : s.asMoveObject?.contents?.type.repr ?? (s.asMovePackage ? "package" : undefined)
|
|
206
|
+
|
|
207
|
+
// The GraphQL schema has no field for the failing command; it is only in the
|
|
208
|
+
// message ("... in 2nd command"). Same as @mysten/sui's GraphQL client.
|
|
209
|
+
const commandOf = (message: string): number | undefined => {
|
|
210
|
+
const m = /in (\d+)\w* command/.exec(message)
|
|
211
|
+
return m ? Number(m[1]) - 1 : undefined
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const status = (e: typeof EffectsNode.Type): Transactions.Status => {
|
|
215
|
+
if (e.status === "SUCCESS") return { _tag: "Success" }
|
|
216
|
+
const x = e.executionError
|
|
217
|
+
const description = x?.message ?? "unknown execution failure"
|
|
218
|
+
const pkg = x?.module?.package?.address
|
|
219
|
+
return {
|
|
220
|
+
_tag: "Failure",
|
|
221
|
+
description,
|
|
222
|
+
command: commandOf(description),
|
|
223
|
+
abortCode: x?.abortCode ?? undefined,
|
|
224
|
+
...(x?.module && pkg !== undefined && {
|
|
225
|
+
location: {
|
|
226
|
+
package: Address.normalize(pkg),
|
|
227
|
+
module: x.module.name,
|
|
228
|
+
function: x.function?.name ?? undefined,
|
|
229
|
+
instruction: x.instructionOffset ?? undefined
|
|
230
|
+
}
|
|
231
|
+
}),
|
|
232
|
+
...(x && (x.identifier != null || x.sourceLineNumber != null) && {
|
|
233
|
+
cleverError: {
|
|
234
|
+
errorCode: undefined,
|
|
235
|
+
lineNumber: x.sourceLineNumber == null ? undefined : BigInt(x.sourceLineNumber),
|
|
236
|
+
constantName: x.identifier ?? undefined,
|
|
237
|
+
constantType: undefined,
|
|
238
|
+
rendered: x.constant ?? undefined
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const changed = (c: typeof ObjectChange.Type): Transactions.ChangedObject => {
|
|
245
|
+
const out = c.outputState
|
|
246
|
+
const input = c.inputState
|
|
247
|
+
return {
|
|
248
|
+
objectId: Address.normalize(c.address),
|
|
249
|
+
type: typeOf(out) ?? typeOf(c.inputState),
|
|
250
|
+
operation: c.idCreated ? "Created" : c.idDeleted ? "Deleted" : "None",
|
|
251
|
+
version: out?.version,
|
|
252
|
+
digest: (out?.digest ?? undefined) as ObjectDigest | undefined,
|
|
253
|
+
owner: out?.owner ? owner(out.owner) : undefined,
|
|
254
|
+
inputVersion: input?.version,
|
|
255
|
+
inputDigest: (input?.digest ?? undefined) as ObjectDigest | undefined,
|
|
256
|
+
inputOwner: input?.owner ? owner(input.owner) : undefined
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** `changes` defaults to the first page in `e`; pass every page when there are more. */
|
|
261
|
+
export const effects = (
|
|
262
|
+
e: typeof EffectsNode.Type,
|
|
263
|
+
changes: ReadonlyArray<ObjectChange> = e.objectChanges?.nodes ?? []
|
|
264
|
+
): Transactions.Effects => {
|
|
265
|
+
const g = e.gasEffects?.gasSummary
|
|
266
|
+
return {
|
|
267
|
+
digest: e.digest,
|
|
268
|
+
status: status(e),
|
|
269
|
+
gasUsed: {
|
|
270
|
+
computationCost: g?.computationCost ?? 0n,
|
|
271
|
+
storageCost: g?.storageCost ?? 0n,
|
|
272
|
+
storageRebate: g?.storageRebate ?? 0n,
|
|
273
|
+
nonRefundableStorageFee: g?.nonRefundableStorageFee ?? 0n
|
|
274
|
+
},
|
|
275
|
+
changedObjects: changes.map(changed)
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// -----------------------------------------------------------------------------
|
|
280
|
+
// Events
|
|
281
|
+
// -----------------------------------------------------------------------------
|
|
282
|
+
|
|
283
|
+
/** Selection on `Event` for an `Event`, without its position (nested under a transaction). */
|
|
284
|
+
export const EVENT_CONTENT_FIELDS = "sequenceNumber sender{address} transactionModule{package{address} name} contents{type{repr} bcs}"
|
|
285
|
+
|
|
286
|
+
/** Selection on `Event` for an `Event` read on its own (with its transaction and checkpoint). */
|
|
287
|
+
export const EVENT_FIELDS = `${EVENT_CONTENT_FIELDS} transaction{digest effects{checkpoint{sequenceNumber}}}`
|
|
288
|
+
|
|
289
|
+
export const EventContentNode = Schema.Struct({
|
|
290
|
+
sequenceNumber: Schema.Int,
|
|
291
|
+
sender: Schema.NullOr(SuiAddress),
|
|
292
|
+
transactionModule: Schema.NullOr(Schema.Struct({ package: Schema.NullOr(SuiAddress), name: Schema.String })),
|
|
293
|
+
contents: MoveContents
|
|
294
|
+
})
|
|
295
|
+
export type EventContentNode = typeof EventContentNode.Type
|
|
296
|
+
|
|
297
|
+
export const EventNode = Schema.Struct({
|
|
298
|
+
...EventContentNode.fields,
|
|
299
|
+
transaction: Schema.Struct({
|
|
300
|
+
digest: Schema.String,
|
|
301
|
+
effects: Schema.NullOr(Schema.Struct({ checkpoint: Schema.NullOr(Schema.Struct({ sequenceNumber: U64 })) }))
|
|
302
|
+
})
|
|
303
|
+
})
|
|
304
|
+
export type EventNode = typeof EventNode.Type
|
|
305
|
+
|
|
306
|
+
/** An event of the transaction `transactionDigest`. A system transaction's events have no sender over GraphQL: `0x0`, as over gRPC. */
|
|
307
|
+
export const transactionEvent = (e: EventContentNode, transactionDigest: string): Events.TransactionEvent => ({
|
|
308
|
+
type: e.contents.type.repr,
|
|
309
|
+
sender: Address.normalize(e.sender?.address ?? "0x0"),
|
|
310
|
+
packageId: Address.normalize(e.transactionModule?.package?.address ?? "0x0"),
|
|
311
|
+
module: e.transactionModule?.name ?? "",
|
|
312
|
+
contents: e.contents.bcs,
|
|
313
|
+
transactionDigest,
|
|
314
|
+
eventIndex: e.sequenceNumber
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
/** An event from its contents and its position. */
|
|
318
|
+
export const event = (
|
|
319
|
+
e: EventContentNode,
|
|
320
|
+
at: { readonly checkpoint: bigint; readonly transactionDigest: string; readonly transactionIndex: bigint }
|
|
321
|
+
): Events.Event => ({
|
|
322
|
+
...transactionEvent(e, at.transactionDigest),
|
|
323
|
+
checkpoint: at.checkpoint,
|
|
324
|
+
transactionIndex: at.transactionIndex
|
|
325
|
+
})
|
|
326
|
+
|
|
327
|
+
// -----------------------------------------------------------------------------
|
|
328
|
+
// Balance changes
|
|
329
|
+
// -----------------------------------------------------------------------------
|
|
330
|
+
|
|
331
|
+
/** Selection on `BalanceChange`. */
|
|
332
|
+
export const BALANCE_CHANGE_FIELDS = "owner{address} coinType{repr} amount"
|
|
333
|
+
|
|
334
|
+
export const BalanceChangeNode = Schema.Struct({
|
|
335
|
+
owner: SuiAddress,
|
|
336
|
+
coinType: Schema.Struct({ repr: Schema.String }),
|
|
337
|
+
amount: U64
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
export const balanceChange = (b: typeof BalanceChangeNode.Type): Transactions.BalanceChange => ({
|
|
341
|
+
address: Address.normalize(b.owner.address),
|
|
342
|
+
coinType: b.coinType.repr,
|
|
343
|
+
amount: b.amount
|
|
344
|
+
})
|
|
345
|
+
|
|
346
|
+
/** Sui's event cursors end with `checkpoint: u64 LE, transaction index: u64 LE, event index: u32 LE`. */
|
|
347
|
+
export const eventCursorPosition = (
|
|
348
|
+
cursor: string
|
|
349
|
+
): { readonly checkpoint: bigint; readonly transactionIndex: bigint; readonly eventIndex: number } | undefined => {
|
|
350
|
+
try {
|
|
351
|
+
const bytes = Uint8Array.from(atob(cursor), (c) => c.charCodeAt(0))
|
|
352
|
+
if (bytes.length < 20) return undefined
|
|
353
|
+
const view = new DataView(bytes.buffer, bytes.length - 20, 20)
|
|
354
|
+
return { checkpoint: view.getBigUint64(0, true), transactionIndex: view.getBigUint64(8, true), eventIndex: view.getUint32(16, true) }
|
|
355
|
+
} catch {
|
|
356
|
+
return undefined
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// -----------------------------------------------------------------------------
|
|
361
|
+
// Errors
|
|
362
|
+
// -----------------------------------------------------------------------------
|
|
363
|
+
|
|
364
|
+
/** Sui's `extensions.code` values -> gRPC codes. */
|
|
365
|
+
const GRAPHQL_CODES: Record<string, RpcCode> = {
|
|
366
|
+
BAD_USER_INPUT: "INVALID_ARGUMENT",
|
|
367
|
+
BAD_REQUEST: "INVALID_ARGUMENT",
|
|
368
|
+
GRAPHQL_VALIDATION_FAILED: "INVALID_ARGUMENT",
|
|
369
|
+
GRAPHQL_PARSE_FAILED: "INVALID_ARGUMENT",
|
|
370
|
+
FEATURE_UNAVAILABLE: "UNIMPLEMENTED",
|
|
371
|
+
NOT_FOUND: "NOT_FOUND",
|
|
372
|
+
UNAUTHENTICATED: "UNAUTHENTICATED",
|
|
373
|
+
FORBIDDEN: "PERMISSION_DENIED",
|
|
374
|
+
REQUEST_TIMEOUT: "DEADLINE_EXCEEDED",
|
|
375
|
+
GATEWAY_TIMEOUT: "DEADLINE_EXCEEDED",
|
|
376
|
+
TOO_MANY_REQUESTS: "RESOURCE_EXHAUSTED",
|
|
377
|
+
RATE_LIMITED: "RESOURCE_EXHAUSTED",
|
|
378
|
+
RESOURCE_EXHAUSTED: "RESOURCE_EXHAUSTED",
|
|
379
|
+
INTERNAL_SERVER_ERROR: "INTERNAL",
|
|
380
|
+
UNAVAILABLE: "UNAVAILABLE"
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** HTTP status -> gRPC code, for responses with no more specific information. */
|
|
384
|
+
export const httpCode = (status: number): RpcCode => {
|
|
385
|
+
if (status === 429) return "RESOURCE_EXHAUSTED"
|
|
386
|
+
if (status === 408 || status === 504) return "DEADLINE_EXCEEDED"
|
|
387
|
+
if (status === 401) return "UNAUTHENTICATED"
|
|
388
|
+
if (status === 403) return "PERMISSION_DENIED"
|
|
389
|
+
if (status === 404 || status === 405) return "UNIMPLEMENTED"
|
|
390
|
+
// Too large: sending it again won't help.
|
|
391
|
+
if (status === 413) return "INVALID_ARGUMENT"
|
|
392
|
+
if (status >= 500) return "UNAVAILABLE"
|
|
393
|
+
if (status >= 400) return "INVALID_ARGUMENT"
|
|
394
|
+
return "UNKNOWN"
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const codeOfGraphQLError = (e: GraphQLClientError.GraphQLError): RpcCode => {
|
|
398
|
+
const code = e.extensions?.["code"]
|
|
399
|
+
// Sui reports its per-query limits (rich queries, output nodes, page size) as
|
|
400
|
+
// RESOURCE_EXHAUSTED at HTTP 200: the same query fails again, so not retryable.
|
|
401
|
+
if (code === "RESOURCE_EXHAUSTED" && /^(Exceeded|Page size|Estimated)/.test(e.message)) return "INVALID_ARGUMENT"
|
|
402
|
+
if (typeof code === "string" && code in GRAPHQL_CODES) return GRAPHQL_CODES[code]!
|
|
403
|
+
// Scalar coercion failures (`Failed to parse "SuiAddress": ...`) carry no code.
|
|
404
|
+
if (e.message.startsWith("Failed to parse")) return "INVALID_ARGUMENT"
|
|
405
|
+
// E.g. a subscription sent to the query endpoint.
|
|
406
|
+
if (/\bnot supported\b/i.test(e.message)) return "UNIMPLEMENTED"
|
|
407
|
+
return "UNKNOWN"
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/** The one place a `GraphQLClientError` becomes an `RpcError`. */
|
|
411
|
+
export const rpcCode = (error: GraphQLClientError.GraphQLClientError): RpcCode => {
|
|
412
|
+
const reason = error.reason
|
|
413
|
+
switch (reason._tag) {
|
|
414
|
+
case "TransportError":
|
|
415
|
+
// No status: the request never got a response (DNS, TLS, reset, abort).
|
|
416
|
+
return reason.status === undefined ? "UNAVAILABLE" : httpCode(reason.status)
|
|
417
|
+
case "ResponseError": {
|
|
418
|
+
// A 429 or 5xx response is a failure of the service, whatever the body
|
|
419
|
+
// says (e.g. INTERNAL_SERVER_ERROR from an overloaded replica), so it
|
|
420
|
+
// keeps the HTTP code and stays retryable.
|
|
421
|
+
if (reason.status !== undefined && (reason.status === 429 || reason.status >= 500)) return httpCode(reason.status)
|
|
422
|
+
const code = codeOfGraphQLError(reason.errors[0])
|
|
423
|
+
// An `extensions.code` we don't know is not guessed at: the HTTP status
|
|
424
|
+
// decides if it is a 4xx, otherwise it is UNKNOWN (not retryable).
|
|
425
|
+
return code === "UNKNOWN" && reason.status !== undefined && reason.status >= 400 ? httpCode(reason.status) : code
|
|
426
|
+
}
|
|
427
|
+
case "EncodeError":
|
|
428
|
+
return "INVALID_ARGUMENT"
|
|
429
|
+
case "DecodeError":
|
|
430
|
+
return "DATA_LOSS"
|
|
431
|
+
case "PaginationError":
|
|
432
|
+
return "INTERNAL"
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export const toRpcError = (error: GraphQLClientError.GraphQLClientError): RpcError =>
|
|
437
|
+
new RpcError({ method: error.operation, code: rpcCode(error), message: error.reason.message })
|
|
438
|
+
|
|
439
|
+
type ClientError = GraphQLClientError.GraphQLClientError
|
|
440
|
+
|
|
441
|
+
const mapClientError = <E>(e: E): Exclude<E, ClientError> | RpcError =>
|
|
442
|
+
GraphQLClientError.isGraphQLClientError(e) ? toRpcError(e) : (e as Exclude<E, ClientError>)
|
|
443
|
+
|
|
444
|
+
/** Run a client call, its `GraphQLClientError`s becoming `RpcError`s. */
|
|
445
|
+
export const call = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, Exclude<E, ClientError> | RpcError, R> =>
|
|
446
|
+
Effect.mapError(effect, mapClientError)
|
|
447
|
+
|
|
448
|
+
export const callStream = <A, E, R>(
|
|
449
|
+
stream: Stream.Stream<A, E, R>
|
|
450
|
+
): Stream.Stream<A, Exclude<E, ClientError> | RpcError, R> => Stream.mapError(stream, mapClientError)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@unconfirmed/effect-sui/graphql`: every capability over Sui's GraphQL API.
|
|
3
|
+
*
|
|
4
|
+
* Take everything with `layer({ url })`, or compose only what you use, and mix
|
|
5
|
+
* with other transports:
|
|
6
|
+
*
|
|
7
|
+
* Layer.mergeAll(ObjectsGraphQL.layer, PackagesGraphQL.layer).pipe(Layer.provide(SuiGraphQL.protocol({ url })))
|
|
8
|
+
*/
|
|
9
|
+
import type * as GraphQLProtocol from "effect/graphql/GraphQLProtocol"
|
|
10
|
+
import type * as HttpClient from "effect/http/HttpClient"
|
|
11
|
+
import * as Layer from "effect/Layer"
|
|
12
|
+
import type { Chain } from "../Chain.ts"
|
|
13
|
+
import type { CheckpointData } from "../CheckpointData.ts"
|
|
14
|
+
import type { Checkpoints } from "../Checkpoints.ts"
|
|
15
|
+
import type { Coins } from "../Coins.ts"
|
|
16
|
+
import type { DynamicFields } from "../DynamicFields.ts"
|
|
17
|
+
import type { Events } from "../Events.ts"
|
|
18
|
+
import type { Objects } from "../Objects.ts"
|
|
19
|
+
import type { Packages } from "../Packages.ts"
|
|
20
|
+
import type { Transactions } from "../Transactions.ts"
|
|
21
|
+
import * as ChainGraphQL from "./ChainGraphQL.ts"
|
|
22
|
+
import * as CheckpointDataGraphQL from "./CheckpointDataGraphQL.ts"
|
|
23
|
+
import * as CheckpointsGraphQL from "./CheckpointsGraphQL.ts"
|
|
24
|
+
import * as CoinsGraphQL from "./CoinsGraphQL.ts"
|
|
25
|
+
import * as DynamicFieldsGraphQL from "./DynamicFieldsGraphQL.ts"
|
|
26
|
+
import * as EventsGraphQL from "./EventsGraphQL.ts"
|
|
27
|
+
import * as ObjectsGraphQL from "./ObjectsGraphQL.ts"
|
|
28
|
+
import * as PackagesGraphQL from "./PackagesGraphQL.ts"
|
|
29
|
+
import * as SuiGraphQL from "./SuiGraphQL.ts"
|
|
30
|
+
import * as TransactionsGraphQL from "./TransactionsGraphQL.ts"
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
ChainGraphQL,
|
|
34
|
+
CheckpointDataGraphQL,
|
|
35
|
+
CheckpointsGraphQL,
|
|
36
|
+
CoinsGraphQL,
|
|
37
|
+
DynamicFieldsGraphQL,
|
|
38
|
+
EventsGraphQL,
|
|
39
|
+
ObjectsGraphQL,
|
|
40
|
+
PackagesGraphQL,
|
|
41
|
+
SuiGraphQL,
|
|
42
|
+
TransactionsGraphQL
|
|
43
|
+
}
|
|
44
|
+
export type { SuiGraphQLOptions } from "./SuiGraphQL.ts"
|
|
45
|
+
export { DEVNET, MAINNET, TESTNET } from "./SuiGraphQL.ts"
|
|
46
|
+
|
|
47
|
+
export type Services =
|
|
48
|
+
| Chain
|
|
49
|
+
| Objects
|
|
50
|
+
| Coins
|
|
51
|
+
| Packages
|
|
52
|
+
| Transactions
|
|
53
|
+
| Checkpoints
|
|
54
|
+
| DynamicFields
|
|
55
|
+
| Events
|
|
56
|
+
| CheckpointData
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* All capability services over one Sui GraphQL endpoint, plus its
|
|
60
|
+
* `GraphQLProtocol` (for `EvidenceGraphQL` or your own queries on the same
|
|
61
|
+
* endpoint). Needs an `HttpClient`.
|
|
62
|
+
*/
|
|
63
|
+
export const layer = (
|
|
64
|
+
options: SuiGraphQL.SuiGraphQLOptions
|
|
65
|
+
): Layer.Layer<Services | GraphQLProtocol.GraphQLProtocol, never, HttpClient.HttpClient> =>
|
|
66
|
+
Layer.mergeAll(
|
|
67
|
+
ChainGraphQL.layer,
|
|
68
|
+
PackagesGraphQL.layer,
|
|
69
|
+
TransactionsGraphQL.layer,
|
|
70
|
+
CheckpointsGraphQL.layer,
|
|
71
|
+
EventsGraphQL.layer,
|
|
72
|
+
CheckpointDataGraphQL.layer,
|
|
73
|
+
Layer.mergeAll(CoinsGraphQL.layer, DynamicFieldsGraphQL.layer).pipe(Layer.provideMerge(ObjectsGraphQL.layer))
|
|
74
|
+
).pipe(Layer.provideMerge(SuiGraphQL.protocol(options)))
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Merging streams that are each sorted by the same key. */
|
|
2
|
+
import type * as Arr from "effect/Array"
|
|
3
|
+
import * as Cause from "effect/Cause"
|
|
4
|
+
import * as Effect from "effect/Effect"
|
|
5
|
+
import * as Pull from "effect/Pull"
|
|
6
|
+
import * as Stream from "effect/Stream"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* One stream in `compare` order from streams already in that order, pulling
|
|
10
|
+
* each only as far as needed. Consecutive items that compare equal (the same
|
|
11
|
+
* item from several sources) are emitted once.
|
|
12
|
+
*/
|
|
13
|
+
export const mergeSorted = <A, E>(
|
|
14
|
+
streams: ReadonlyArray<Stream.Stream<A, E>>,
|
|
15
|
+
compare: (a: A, b: A) => number
|
|
16
|
+
): Stream.Stream<A, E> => {
|
|
17
|
+
if (streams.length === 1) return streams[0]!
|
|
18
|
+
return Stream.unwrap(Effect.gen(function*() {
|
|
19
|
+
const pulls = yield* Effect.forEach(streams, Stream.toPull)
|
|
20
|
+
// `null`: that source has ended.
|
|
21
|
+
const buffers: Array<Array<A> | null> = streams.map(() => [])
|
|
22
|
+
const fill = (i: number) =>
|
|
23
|
+
buffers[i] !== null && buffers[i]!.length === 0
|
|
24
|
+
? pulls[i]!.pipe(
|
|
25
|
+
Effect.map((chunk) => {
|
|
26
|
+
buffers[i] = [...chunk]
|
|
27
|
+
}),
|
|
28
|
+
Pull.catchDone(() =>
|
|
29
|
+
Effect.sync(() => {
|
|
30
|
+
buffers[i] = null
|
|
31
|
+
})
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
: Effect.void
|
|
35
|
+
let last: { readonly value: A } | undefined
|
|
36
|
+
const pull: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E> = Effect.gen(function*() {
|
|
37
|
+
while (true) {
|
|
38
|
+
yield* Effect.forEach(streams, (_, i) => fill(i), { concurrency: "unbounded", discard: true })
|
|
39
|
+
let best = -1
|
|
40
|
+
for (let i = 0; i < buffers.length; i++) {
|
|
41
|
+
const b = buffers[i]
|
|
42
|
+
if (b && b.length > 0 && (best < 0 || compare(b[0]!, buffers[best]![0]!) < 0)) best = i
|
|
43
|
+
}
|
|
44
|
+
if (best < 0) return yield* Cause.done()
|
|
45
|
+
// Every live source has a head now: emit the run of `best` that sorts
|
|
46
|
+
// no later than any other head, as one chunk.
|
|
47
|
+
const out: Array<A> = []
|
|
48
|
+
const source = buffers[best]!
|
|
49
|
+
const otherHeadsAllow = (value: A) =>
|
|
50
|
+
buffers.every((b, i) => i === best || b === null || (b.length > 0 && compare(value, b[0]!) <= 0))
|
|
51
|
+
while (source.length > 0 && otherHeadsAllow(source[0]!)) {
|
|
52
|
+
const value = source.shift()!
|
|
53
|
+
if (last !== undefined && compare(last.value, value) === 0) continue
|
|
54
|
+
last = { value }
|
|
55
|
+
out.push(value)
|
|
56
|
+
}
|
|
57
|
+
if (out.length > 0) return out as unknown as Arr.NonEmptyReadonlyArray<A>
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
return Stream.fromPull(Effect.succeed(pull))
|
|
61
|
+
}))
|
|
62
|
+
}
|