@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,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The outcome taxonomy. Every failure of a submission is on exactly one axis:
|
|
3
|
+
*
|
|
4
|
+
* applied on chain; gas was charged ExecutionFailed
|
|
5
|
+
* not_applied provably never applied, never will NotApplied, JournalError
|
|
6
|
+
* (only raised before these bytes were ever sent)
|
|
7
|
+
* unknown may or may not have applied SubmissionUnknown,
|
|
8
|
+
* DigestMismatch, and anything outside this taxonomy
|
|
9
|
+
*
|
|
10
|
+
* Only `not_applied` is safe to retry by rebuilding. `unknown` carries the
|
|
11
|
+
* signed bytes: re-send them (`Lifecycle.resubmit`) or reconcile them later;
|
|
12
|
+
* identical bytes land at most once.
|
|
13
|
+
*/
|
|
14
|
+
import * as Tx from "../Tx.ts"
|
|
15
|
+
import type { Effects } from "../Transactions.ts"
|
|
16
|
+
import * as Schema from "effect/Schema"
|
|
17
|
+
import { SignedTransaction } from "./SignedTransaction.ts"
|
|
18
|
+
|
|
19
|
+
/** The transaction reached the chain and Move aborted. Gas was charged. (Core's error, reused.) */
|
|
20
|
+
export const ExecutionFailed = Tx.ExecutionFailed
|
|
21
|
+
export type ExecutionFailed = Tx.ExecutionFailed
|
|
22
|
+
|
|
23
|
+
export const NotAppliedEvidence = Schema.Literals(["expired", "inputConsumed", "refused"])
|
|
24
|
+
export type NotAppliedEvidence = typeof NotAppliedEvidence.Type
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The transaction did not apply, and the lifecycle will not send it again:
|
|
28
|
+
* - `expired`: its epoch window closed and it is absent, observed twice (around
|
|
29
|
+
* a recheck) by one `Evidence` backend whose history covers the window, with
|
|
30
|
+
* `Transactions` missing it too: it never applied and never will;
|
|
31
|
+
* - `inputConsumed`: another transaction consumed an object version these bytes
|
|
32
|
+
* pinned: it never applied and never will;
|
|
33
|
+
* - `refused`: the node refused the first send outright (`INVALID_ARGUMENT`),
|
|
34
|
+
* so nothing executed then. This is the node's verdict at that moment, not
|
|
35
|
+
* proof that the bytes can never land: some refusals are time-dependent
|
|
36
|
+
* (e.g. an unfunded address balance) and the node may still hold the bytes.
|
|
37
|
+
* It means this process will not send them again on its own
|
|
38
|
+
* (`Lifecycle.resubmit(..., { retryRefused: true })` does on request).
|
|
39
|
+
*/
|
|
40
|
+
export class NotApplied extends Schema.TaggedError<NotApplied>()("NotApplied", {
|
|
41
|
+
digest: Schema.String,
|
|
42
|
+
evidence: NotAppliedEvidence,
|
|
43
|
+
message: Schema.optionalKey(Schema.String)
|
|
44
|
+
}) {}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The outcome is not known. `signed` (absent only when reconciling a bare
|
|
48
|
+
* digest) is what to re-send or reconcile later.
|
|
49
|
+
*/
|
|
50
|
+
export class SubmissionUnknown extends Schema.TaggedError<SubmissionUnknown>()("SubmissionUnknown", {
|
|
51
|
+
digest: Schema.String,
|
|
52
|
+
signed: Schema.optionalKey(SignedTransaction),
|
|
53
|
+
reason: Schema.String
|
|
54
|
+
}) {
|
|
55
|
+
override get message(): string {
|
|
56
|
+
return `outcome of ${this.digest} unknown: ${this.reason}`
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The journal could not be read or written. Raised only before bytes that were
|
|
62
|
+
* never sent go out (so `not_applied`): by `run` (bytes it signed just now) on
|
|
63
|
+
* any journal failure before the send, and by `submit` when the `Signed` write
|
|
64
|
+
* fails for bytes the journal has never seen. Once the bytes may have left — an
|
|
65
|
+
* earlier send, a re-send, `submit` unable to read the journal — a journal
|
|
66
|
+
* failure becomes `SubmissionUnknown` instead, and later writes are logged,
|
|
67
|
+
* never raised.
|
|
68
|
+
*/
|
|
69
|
+
export class JournalError extends Schema.TaggedError<JournalError>()("JournalError", {
|
|
70
|
+
message: Schema.String
|
|
71
|
+
}) {}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* A `SignedTransaction` whose `digest` is not the digest of its bytes: a
|
|
75
|
+
* corrupt or tampered record. Nothing was sent or concluded; what happened to
|
|
76
|
+
* either transaction is unknown.
|
|
77
|
+
*/
|
|
78
|
+
export class DigestMismatch extends Schema.TaggedError<DigestMismatch>()("DigestMismatch", {
|
|
79
|
+
digest: Schema.String,
|
|
80
|
+
computed: Schema.String
|
|
81
|
+
}) {
|
|
82
|
+
override get message(): string {
|
|
83
|
+
return `digest ${this.digest} does not match the bytes (${this.computed})`
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type Outcome = "applied" | "not_applied" | "unknown"
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Where a failure sits. Within the taxonomy: `ExecutionFailed` is `applied`,
|
|
91
|
+
* `NotApplied` and `JournalError` are `not_applied`, `SubmissionUnknown` and
|
|
92
|
+
* `DigestMismatch` are `unknown`.
|
|
93
|
+
*
|
|
94
|
+
* Every other value — a timeout around `run`, a raw `RpcError`, a defect — is
|
|
95
|
+
* `unknown`, because nothing says it happened before the bytes left. Pass
|
|
96
|
+
* `{ phase: "beforeSubmit" }` when you know it did: every error of
|
|
97
|
+
* `Lifecycle.run` outside the taxonomy (build, resolve, sign) is raised before
|
|
98
|
+
* submission, so `outcome(e, { phase: "beforeSubmit" })` is right for an error
|
|
99
|
+
* taken straight from `run`'s error channel, and wrong for one you added around it.
|
|
100
|
+
*/
|
|
101
|
+
export const outcome = (error: unknown, options?: { readonly phase?: "beforeSubmit" }): Outcome => {
|
|
102
|
+
const tag = typeof error === "object" && error !== null ? (error as { readonly _tag?: unknown })._tag : undefined
|
|
103
|
+
switch (tag) {
|
|
104
|
+
case "ExecutionFailed":
|
|
105
|
+
return "applied"
|
|
106
|
+
case "NotApplied":
|
|
107
|
+
case "JournalError":
|
|
108
|
+
return "not_applied"
|
|
109
|
+
case "SubmissionUnknown":
|
|
110
|
+
case "DigestMismatch":
|
|
111
|
+
return "unknown"
|
|
112
|
+
default:
|
|
113
|
+
return options?.phase === "beforeSubmit" && typeof tag === "string" ? "not_applied" : "unknown"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Everything a submission can end in besides success. */
|
|
118
|
+
export type SubmitError = ExecutionFailed | NotApplied | SubmissionUnknown | JournalError | DigestMismatch
|
|
119
|
+
|
|
120
|
+
/** What one reconciled journal entry settled to. */
|
|
121
|
+
export type Reconciled =
|
|
122
|
+
| { readonly _tag: "Executed"; readonly digest: string; readonly effects: Effects }
|
|
123
|
+
| { readonly _tag: "ExecutionFailed"; readonly digest: string; readonly error: ExecutionFailed }
|
|
124
|
+
| { readonly _tag: "NotApplied"; readonly digest: string; readonly error: NotApplied }
|
|
125
|
+
| { readonly _tag: "SubmissionUnknown"; readonly digest: string; readonly error: SubmissionUnknown }
|
|
126
|
+
/**
|
|
127
|
+
* The journal entry could not be read (see `Journal.CorruptEntry`); `digest`
|
|
128
|
+
* is its key. Nothing was concluded or sent; `Journal.remove(digest)` drops it.
|
|
129
|
+
*/
|
|
130
|
+
| { readonly _tag: "Corrupt"; readonly digest: string; readonly reason: string }
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-address locks for `Lifecycle.run`.
|
|
3
|
+
*
|
|
4
|
+
* Two builds from one sender that overlap can resolve the same gas coin or
|
|
5
|
+
* owned object at the same version, and one of the two transactions then
|
|
6
|
+
* fails or equivocates. So `run` holds the sender's (and a distinct gas
|
|
7
|
+
* owner's) lock for every build, and keeps it through signing and submission
|
|
8
|
+
* when the built bytes pin a versioned object (owned or receiving input, any
|
|
9
|
+
* gas payment ref). Bytes that pin nothing release it after the build, so
|
|
10
|
+
* address-balance transactions from one sender are sent concurrently.
|
|
11
|
+
*
|
|
12
|
+
* A `Context.Reference` with an in-memory default (one semaphore per address,
|
|
13
|
+
* process-wide), so every `run` in the process shares it with no wiring.
|
|
14
|
+
* Provide `layerMemory` for an isolated set, or your own (e.g. a distributed
|
|
15
|
+
* lock) for several processes.
|
|
16
|
+
*/
|
|
17
|
+
import * as Context from "effect/Context"
|
|
18
|
+
import * as Effect from "effect/Effect"
|
|
19
|
+
import * as Layer from "effect/Layer"
|
|
20
|
+
import * as Semaphore from "effect/Semaphore"
|
|
21
|
+
|
|
22
|
+
export interface SenderLockService {
|
|
23
|
+
/** Run `effect` holding the locks of every address (deduplicated, taken in ascending order). */
|
|
24
|
+
readonly withLocks: (
|
|
25
|
+
addresses: ReadonlyArray<string>
|
|
26
|
+
) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* One semaphore per address, kept only while some fiber holds or waits for it
|
|
31
|
+
* (a count of users per address), so a long-lived process does not keep a
|
|
32
|
+
* lock for every sender it has ever seen.
|
|
33
|
+
*/
|
|
34
|
+
export const makeMemory = (): SenderLockService & { readonly size: () => number } => {
|
|
35
|
+
const locks = new Map<string, { readonly semaphore: Semaphore.Semaphore; users: number }>()
|
|
36
|
+
const acquire = (address: string) =>
|
|
37
|
+
Effect.sync(() => {
|
|
38
|
+
let lock = locks.get(address)
|
|
39
|
+
if (lock === undefined) {
|
|
40
|
+
lock = { semaphore: Semaphore.makeUnsafe(1), users: 0 }
|
|
41
|
+
locks.set(address, lock)
|
|
42
|
+
}
|
|
43
|
+
lock.users++
|
|
44
|
+
return lock
|
|
45
|
+
})
|
|
46
|
+
const release = (address: string, lock: { users: number }) =>
|
|
47
|
+
Effect.sync(() => {
|
|
48
|
+
lock.users--
|
|
49
|
+
if (lock.users === 0 && locks.get(address) === lock) locks.delete(address)
|
|
50
|
+
})
|
|
51
|
+
const withLock = (address: string) => <A, E, R>(inner: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
|
|
52
|
+
Effect.acquireUseRelease(
|
|
53
|
+
acquire(address),
|
|
54
|
+
(lock) => lock.semaphore.withPermits(1)(inner),
|
|
55
|
+
(lock) => release(address, lock)
|
|
56
|
+
)
|
|
57
|
+
return {
|
|
58
|
+
withLocks: (addresses) => (effect) =>
|
|
59
|
+
// Ascending order, so two runs needing the same pair cannot deadlock.
|
|
60
|
+
[...new Set(addresses)].sort().reverse().reduce((inner, address) => withLock(address)(inner), effect),
|
|
61
|
+
size: () => locks.size
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const SenderLock = Context.Reference<SenderLockService>("@unconfirmed/effect-sui/lifecycle/SenderLock", {
|
|
66
|
+
defaultValue: makeMemory
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
/** A fresh, isolated set of in-memory locks. */
|
|
70
|
+
export const layerMemory: Layer.Layer<never> = Layer.sync(SenderLock, makeMemory)
|
|
71
|
+
|
|
72
|
+
/** No locking at all, for callers that serialise themselves. */
|
|
73
|
+
export const layerNone: Layer.Layer<never> = Layer.succeed(SenderLock, { withLocks: () => (effect) => effect })
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `SenderLock` over the Web Locks API (`navigator.locks`), so the tabs,
|
|
3
|
+
* iframes and workers of one origin serialise their submissions per sender,
|
|
4
|
+
* not only the fibers of one tab. `SenderLock.makeMemory` cannot see another
|
|
5
|
+
* tab: two tabs running for the same address could resolve the same gas coin
|
|
6
|
+
* or owned object and equivocate.
|
|
7
|
+
*
|
|
8
|
+
* - One exclusive lock per address, named `<prefix><address>` (default prefix
|
|
9
|
+
* {@link DEFAULT_PREFIX}), held for exactly the wrapped effect. Addresses are
|
|
10
|
+
* deduplicated and taken in ascending order, outermost first, as
|
|
11
|
+
* `SenderLock.makeMemory` does, so two runs needing the same pair cannot
|
|
12
|
+
* deadlock (in one tab or across tabs).
|
|
13
|
+
* - Interrupting the effect releases the lock: while waiting, the request's
|
|
14
|
+
* `AbortSignal` takes it out of the queue; once granted, the promise the
|
|
15
|
+
* lock callback returned is resolved. A grant that races the interruption
|
|
16
|
+
* is released at once. A tab that closes or crashes loses its locks (the
|
|
17
|
+
* browser releases them), so a dead tab never strands a sender.
|
|
18
|
+
* - Not reentrant (nor is the memory lock): don't nest `withLocks` for the
|
|
19
|
+
* same address in one fiber.
|
|
20
|
+
*
|
|
21
|
+
* **When Web Locks are missing** (`navigator.locks` is undefined outside a
|
|
22
|
+
* secure context, in old browsers, in Node/Bun; `query()` rejects in opaque
|
|
23
|
+
* origins), building `layer` fails with `SenderLockUnavailable`. It does not
|
|
24
|
+
* fall back to in-process locks on its own: a silent fallback would look the
|
|
25
|
+
* same as cross-tab locking and let two tabs equivocate, and the
|
|
26
|
+
* `SenderLockService` contract has no error channel to report it at run
|
|
27
|
+
* time. Opt in with `layerWith({ ifUnavailable: "memory" })` where one
|
|
28
|
+
* context per origin is guaranteed (server-side rendering, a single-tab
|
|
29
|
+
* kiosk), or provide `SenderLock.layerMemory` yourself. A lock request the
|
|
30
|
+
* browser rejects after the probe succeeded (a document that is no longer
|
|
31
|
+
* fully active) is a defect, for the same contract reason.
|
|
32
|
+
*/
|
|
33
|
+
import * as Effect from "effect/Effect"
|
|
34
|
+
import * as Layer from "effect/Layer"
|
|
35
|
+
import * as Schema from "effect/Schema"
|
|
36
|
+
import { makeMemory, SenderLock, type SenderLockService } from "./SenderLock.ts"
|
|
37
|
+
|
|
38
|
+
export const DEFAULT_PREFIX = "@unconfirmed/effect-sui/lifecycle/sender/"
|
|
39
|
+
|
|
40
|
+
/** The Web Locks API is missing or unusable here; nothing was locked. */
|
|
41
|
+
export class SenderLockUnavailable extends Schema.TaggedError<SenderLockUnavailable>()("SenderLockUnavailable", {
|
|
42
|
+
message: Schema.String
|
|
43
|
+
}) {}
|
|
44
|
+
|
|
45
|
+
/** The subset of `LockManager` used here. */
|
|
46
|
+
export interface Locks {
|
|
47
|
+
readonly request: (name: string, options: LockOptions, callback: (lock: Lock | null) => Promise<void>) => Promise<void>
|
|
48
|
+
readonly query?: () => Promise<unknown>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface Options {
|
|
52
|
+
/** Lock-name prefix; the address is appended. Default {@link DEFAULT_PREFIX}. */
|
|
53
|
+
readonly prefix?: string
|
|
54
|
+
/** The `LockManager` to use instead of `navigator.locks` (tests). */
|
|
55
|
+
readonly locks?: Locks
|
|
56
|
+
/**
|
|
57
|
+
* What `layerWith` does without Web Locks: `"fail"` (default) fails with
|
|
58
|
+
* `SenderLockUnavailable`; `"memory"` falls back to `SenderLock.makeMemory`,
|
|
59
|
+
* which serialises only within this context.
|
|
60
|
+
*/
|
|
61
|
+
readonly ifUnavailable?: "fail" | "memory"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Hold the exclusive lock `name` for `inner`. */
|
|
65
|
+
const withLock = (locks: Locks, name: string) => <A, E, R>(inner: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
|
|
66
|
+
Effect.uninterruptibleMask((restore) =>
|
|
67
|
+
Effect.flatMap(
|
|
68
|
+
restore(
|
|
69
|
+
Effect.callback<() => void>((resume, signal) => {
|
|
70
|
+
let release: (() => void) | undefined
|
|
71
|
+
locks.request(name, { mode: "exclusive", signal }, () =>
|
|
72
|
+
new Promise<void>((done) => {
|
|
73
|
+
let released = false
|
|
74
|
+
release = () => {
|
|
75
|
+
if (released) return
|
|
76
|
+
released = true
|
|
77
|
+
done()
|
|
78
|
+
}
|
|
79
|
+
// Interrupted between the grant and now: give it straight back.
|
|
80
|
+
if (signal.aborted) release()
|
|
81
|
+
else resume(Effect.succeed(release))
|
|
82
|
+
})).catch((cause: unknown) => {
|
|
83
|
+
if (signal.aborted) return // our own abort while queued
|
|
84
|
+
resume(Effect.die(cause))
|
|
85
|
+
})
|
|
86
|
+
return Effect.sync(() => release?.())
|
|
87
|
+
})
|
|
88
|
+
),
|
|
89
|
+
(release) => Effect.ensuring(restore(inner), Effect.sync(release))
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
/** `SenderLockService` over `locks`. */
|
|
94
|
+
export const make = (locks: Locks, options?: { readonly prefix?: string }): SenderLockService => {
|
|
95
|
+
const prefix = options?.prefix ?? DEFAULT_PREFIX
|
|
96
|
+
return {
|
|
97
|
+
withLocks: (addresses) => (effect) =>
|
|
98
|
+
// Ascending order, outermost first, so two runs needing the same pair cannot deadlock.
|
|
99
|
+
[...new Set(addresses)].sort().reverse().reduce((inner, address) => withLock(locks, `${prefix}${address}`)(inner), effect)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const globalLocks = (): Locks | undefined => {
|
|
104
|
+
const locks = (globalThis as { navigator?: { locks?: Locks } }).navigator?.locks
|
|
105
|
+
return locks !== undefined && locks !== null && typeof locks.request === "function" ? locks : undefined
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** `SenderLock` over `navigator.locks` (or `options.locks`); see the module notes for `ifUnavailable`. */
|
|
109
|
+
export const layerWith = (options?: Options): Layer.Layer<never, SenderLockUnavailable> =>
|
|
110
|
+
Layer.effect(
|
|
111
|
+
SenderLock,
|
|
112
|
+
Effect.gen(function*() {
|
|
113
|
+
const locks = options?.locks ?? globalLocks()
|
|
114
|
+
const unavailable = (message: string) =>
|
|
115
|
+
options?.ifUnavailable === "memory"
|
|
116
|
+
? Effect.as(Effect.logWarning(`${message}; falling back to in-process sender locks`), makeMemory())
|
|
117
|
+
: Effect.fail(new SenderLockUnavailable({ message }))
|
|
118
|
+
if (locks === undefined) {
|
|
119
|
+
return yield* unavailable("the Web Locks API (navigator.locks) is not available (it needs a secure context)")
|
|
120
|
+
}
|
|
121
|
+
if (typeof locks.query === "function") {
|
|
122
|
+
const query = locks.query.bind(locks)
|
|
123
|
+
const probe = yield* Effect.result(Effect.tryPromise(() => query()))
|
|
124
|
+
if (probe._tag === "Failure") {
|
|
125
|
+
const cause = probe.failure.cause
|
|
126
|
+
return yield* unavailable(
|
|
127
|
+
`the Web Locks API refused a query: ${cause instanceof Error ? `${cause.name}: ${cause.message}` : String(cause)}`
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return make(locks, options?.prefix === undefined ? {} : { prefix: options.prefix })
|
|
132
|
+
})
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
/** `SenderLock` over `navigator.locks`; fails with `SenderLockUnavailable` without it. */
|
|
136
|
+
export const layer: Layer.Layer<never, SenderLockUnavailable> = layerWith()
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signed bytes: the one representation of "a transaction that may be on the
|
|
3
|
+
* wire", shared by the journal, `SubmissionUnknown` and every lifecycle
|
|
4
|
+
* function. Everything else (sender, expiration, pinned objects) is read back
|
|
5
|
+
* out of the bytes, so what is reasoned about is what was signed.
|
|
6
|
+
*/
|
|
7
|
+
import * as Bcs from "@unconfirmed/effect-bcs/Bcs"
|
|
8
|
+
import * as Hash from "../Hash.ts"
|
|
9
|
+
import * as T from "../TransactionData.ts"
|
|
10
|
+
import * as Option from "effect/Option"
|
|
11
|
+
import * as Result from "effect/Result"
|
|
12
|
+
import * as Schema from "effect/Schema"
|
|
13
|
+
|
|
14
|
+
export const SignedTransaction = Schema.Struct({
|
|
15
|
+
/** `Hash.transactionDigest(bytes)`; identical bytes have one digest and execute at most once. */
|
|
16
|
+
digest: Schema.String,
|
|
17
|
+
bytes: Schema.Uint8ArrayFromBase64,
|
|
18
|
+
signatures: Schema.Array(Schema.Uint8ArrayFromBase64),
|
|
19
|
+
/**
|
|
20
|
+
* The chain id the bytes were built against, for the expiration variants that
|
|
21
|
+
* name none (`None`, `Epoch`). `ValidDuring` / `Validity` carry their own.
|
|
22
|
+
*/
|
|
23
|
+
chain: Schema.optionalKey(Schema.String)
|
|
24
|
+
})
|
|
25
|
+
export type SignedTransaction = typeof SignedTransaction.Type
|
|
26
|
+
|
|
27
|
+
/** Bundle signed bytes; the digest is computed, never trusted from outside. */
|
|
28
|
+
export const make = (
|
|
29
|
+
bytes: Uint8Array,
|
|
30
|
+
signatures: ReadonlyArray<Uint8Array>,
|
|
31
|
+
options?: { readonly chain?: string }
|
|
32
|
+
): SignedTransaction => ({
|
|
33
|
+
digest: Hash.transactionDigest(bytes),
|
|
34
|
+
bytes,
|
|
35
|
+
signatures,
|
|
36
|
+
...(options?.chain !== undefined && { chain: options.chain })
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const decodeData = T.decode
|
|
40
|
+
|
|
41
|
+
/** The transaction data inside the bytes, if they parse. */
|
|
42
|
+
export const dataOf = (signed: SignedTransaction): Option.Option<T.TransactionData> =>
|
|
43
|
+
Result.match(decodeData(signed.bytes), { onSuccess: Option.some, onFailure: () => Option.none() })
|
|
44
|
+
|
|
45
|
+
export const expirationOf = (signed: SignedTransaction): T.TransactionExpiration | undefined =>
|
|
46
|
+
Option.match(dataOf(signed), { onNone: () => undefined, onSome: (d) => d.expiration })
|
|
47
|
+
|
|
48
|
+
/** The last epoch the bytes may execute in, when the expiration says. */
|
|
49
|
+
export const maxEpochOf = (expiration: T.TransactionExpiration | undefined): bigint | undefined => {
|
|
50
|
+
switch (expiration?._tag) {
|
|
51
|
+
case "Epoch":
|
|
52
|
+
return expiration.value
|
|
53
|
+
case "ValidDuring":
|
|
54
|
+
case "Validity":
|
|
55
|
+
return Option.getOrUndefined(expiration.maxEpoch)
|
|
56
|
+
default:
|
|
57
|
+
return undefined
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The first epoch the bytes may execute in (genesis when unbounded). */
|
|
62
|
+
export const minEpochOf = (expiration: T.TransactionExpiration | undefined): bigint | undefined =>
|
|
63
|
+
expiration?._tag === "ValidDuring" || expiration?._tag === "Validity"
|
|
64
|
+
? Option.getOrUndefined(expiration.minEpoch)
|
|
65
|
+
: undefined
|
|
66
|
+
|
|
67
|
+
/** The chain the bytes belong to: the one the expiration names, else the recorded one. */
|
|
68
|
+
export const chainOf = (signed: SignedTransaction): string | undefined => {
|
|
69
|
+
const expiration = expirationOf(signed)
|
|
70
|
+
return expiration?._tag === "ValidDuring" || expiration?._tag === "Validity" ? expiration.chain : signed.chain
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface PinnedRef {
|
|
74
|
+
readonly objectId: string
|
|
75
|
+
readonly version: bigint
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const COIN_RESERVATION_MAGIC = 0xac
|
|
79
|
+
const COIN_RESERVATION_MAGIC_OFFSET = 12
|
|
80
|
+
const encodeDigest = Bcs.encodeSync(T.ObjectDigest)
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A synthetic gas ref drawing on an address balance (version 0, a digest
|
|
84
|
+
* whose last 20 bytes are `0xac`). It names no object and pins nothing.
|
|
85
|
+
*/
|
|
86
|
+
export const isCoinReservation = (ref: T.ObjectRef): boolean => {
|
|
87
|
+
if (ref.version !== 0n) return false
|
|
88
|
+
const bytes = encodeDigest(ref.digest)
|
|
89
|
+
const digest = bytes.subarray(bytes.length - 32)
|
|
90
|
+
return digest.subarray(COIN_RESERVATION_MAGIC_OFFSET).every((b) => b === COIN_RESERVATION_MAGIC)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The object versions whose consumption by another transaction proves these
|
|
95
|
+
* bytes can never execute: owned inputs and gas coins. `Receiving` inputs are
|
|
96
|
+
* left out — a transaction can still execute after its receiving object was
|
|
97
|
+
* received elsewhere (the receive fails, the transaction runs), so another
|
|
98
|
+
* transaction consuming one proves nothing about ours.
|
|
99
|
+
*/
|
|
100
|
+
export const pinnedRefsOf = (signed: SignedTransaction): ReadonlyArray<PinnedRef> =>
|
|
101
|
+
Option.match(dataOf(signed), {
|
|
102
|
+
onNone: () => [],
|
|
103
|
+
onSome: (data) => {
|
|
104
|
+
const out: Array<PinnedRef> = []
|
|
105
|
+
for (const input of data.kind.inputs) {
|
|
106
|
+
if (input._tag !== "Object") continue
|
|
107
|
+
const arg = input.value
|
|
108
|
+
if (arg._tag === "ImmOrOwnedObject") {
|
|
109
|
+
out.push({ objectId: arg.objectId, version: arg.version })
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
for (const ref of data.gasData.payment) {
|
|
113
|
+
if (!isCoinReservation(ref)) out.push({ objectId: ref.objectId, version: ref.version })
|
|
114
|
+
}
|
|
115
|
+
return out
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Whether two transactions from the same sender built concurrently could race
|
|
121
|
+
* over these bytes: any owned or receiving input, or any gas payment ref
|
|
122
|
+
* (coins, or a coin reservation). Bytes that pin none of these — address
|
|
123
|
+
* balance gas, pure / shared / withdrawal inputs — cannot.
|
|
124
|
+
*/
|
|
125
|
+
export const pinsObjects = (data: T.TransactionData): boolean =>
|
|
126
|
+
data.gasData.payment.length > 0 ||
|
|
127
|
+
data.kind.inputs.some((i) => i._tag === "Object" && (i.value._tag === "ImmOrOwnedObject" || i.value._tag === "Receiving"))
|
|
128
|
+
|
|
129
|
+
/** `undefined` when the digest is the digest of the bytes, else the computed one. */
|
|
130
|
+
export const digestMismatch = (signed: SignedTransaction): string | undefined => {
|
|
131
|
+
const computed = Hash.transactionDigest(signed.bytes)
|
|
132
|
+
return computed === signed.digest ? undefined : computed
|
|
133
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lifecycle's policies, as a `Context.Reference`: every default is in
|
|
3
|
+
* force with no setup, and any of them can be overridden for one fiber with
|
|
4
|
+
* `SubmitConfig.with({...})(effect)` or for a program with `layer({...})`.
|
|
5
|
+
*/
|
|
6
|
+
import * as Context from "effect/Context"
|
|
7
|
+
import * as Duration from "effect/Duration"
|
|
8
|
+
import * as Effect from "effect/Effect"
|
|
9
|
+
import * as Layer from "effect/Layer"
|
|
10
|
+
import * as Schedule from "effect/Schedule"
|
|
11
|
+
|
|
12
|
+
export interface SubmitConfigService {
|
|
13
|
+
/** Delays between re-sends of the identical bytes after a retryable transport failure. */
|
|
14
|
+
readonly resubmit: Schedule.Schedule<unknown, unknown>
|
|
15
|
+
/** Total execute attempts, the first included. */
|
|
16
|
+
readonly resubmitAttempts: number
|
|
17
|
+
/** One execute with no answer within this is a retryable failure (the bytes may have landed). */
|
|
18
|
+
readonly executeTimeout: Duration.Duration
|
|
19
|
+
/** How long `reconcile` keeps asking for a digest the node does not (yet) serve. */
|
|
20
|
+
readonly lookupTimeout: Duration.Duration
|
|
21
|
+
/** Spacing of those lookups. */
|
|
22
|
+
readonly lookupInterval: Duration.Duration
|
|
23
|
+
/** The delay between the two observations the expiry rule needs. */
|
|
24
|
+
readonly reconcileRecheck: Duration.Duration
|
|
25
|
+
/**
|
|
26
|
+
* Whether a closed epoch window may be evidence at all. `"never"` is for a
|
|
27
|
+
* deployment behind a mixed-node load balancer, where even a repeated
|
|
28
|
+
* observation may be answered by two different nodes.
|
|
29
|
+
*/
|
|
30
|
+
readonly expiryEvidence: "epochThenMiss" | "never"
|
|
31
|
+
/** After a successful execute, wait until reads see the transaction (never changes the outcome). */
|
|
32
|
+
readonly awaitVisibility: boolean
|
|
33
|
+
readonly visibilityTimeout: Duration.Duration
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type Overrides = {
|
|
37
|
+
readonly [K in keyof SubmitConfigService]?: SubmitConfigService[K] extends Duration.Duration ? Duration.Input
|
|
38
|
+
: SubmitConfigService[K]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const defaults: SubmitConfigService = {
|
|
42
|
+
resubmit: Schedule.exponential("250 millis").pipe(
|
|
43
|
+
Schedule.modifyDelay(({ duration }) => Effect.succeed(Duration.min(duration, Duration.seconds(30)))),
|
|
44
|
+
Schedule.jittered
|
|
45
|
+
),
|
|
46
|
+
resubmitAttempts: 5,
|
|
47
|
+
executeTimeout: Duration.seconds(60),
|
|
48
|
+
lookupTimeout: Duration.seconds(5),
|
|
49
|
+
lookupInterval: Duration.millis(500),
|
|
50
|
+
reconcileRecheck: Duration.seconds(2),
|
|
51
|
+
expiryEvidence: "epochThenMiss",
|
|
52
|
+
awaitVisibility: true,
|
|
53
|
+
visibilityTimeout: Duration.seconds(15)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const SubmitConfig = Context.Reference<SubmitConfigService>("@unconfirmed/effect-sui/lifecycle/SubmitConfig", {
|
|
57
|
+
defaultValue: () => defaults
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const merge = (base: SubmitConfigService, overrides: Overrides): SubmitConfigService => {
|
|
61
|
+
const out: Record<string, unknown> = { ...base }
|
|
62
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
63
|
+
if (value === undefined) continue
|
|
64
|
+
out[key] = Duration.isDuration((base as any)[key]) ? Duration.fromInputUnsafe(value as Duration.Input) : value
|
|
65
|
+
}
|
|
66
|
+
return out as unknown as SubmitConfigService
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Overrides merged over the defaults. */
|
|
70
|
+
export const layer = (overrides: Overrides): Layer.Layer<never> => Layer.succeed(SubmitConfig, merge(defaults, overrides))
|
|
71
|
+
|
|
72
|
+
/** Overrides merged over the config in force, for one effect. */
|
|
73
|
+
export const with_ = (overrides: Overrides) => <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
|
|
74
|
+
Effect.flatMap(Effect.service(SubmitConfig), (config) =>
|
|
75
|
+
Effect.provideService(effect, SubmitConfig, merge(config, overrides)))
|
|
76
|
+
|
|
77
|
+
export { with_ as with }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@unconfirmed/effect-sui/lifecycle`: crash-safe submission for `@unconfirmed/effect-sui`.
|
|
3
|
+
*/
|
|
4
|
+
export * as Evidence from "./Evidence.ts"
|
|
5
|
+
export * as Journal from "./Journal.ts"
|
|
6
|
+
export * as JournalEntry from "./JournalEntry.ts"
|
|
7
|
+
export * as JournalKeyValueStore from "./JournalKeyValueStore.ts"
|
|
8
|
+
export * as Lifecycle from "./Lifecycle.ts"
|
|
9
|
+
export * as Outcome from "./Outcome.ts"
|
|
10
|
+
export * as SenderLock from "./SenderLock.ts"
|
|
11
|
+
export * as SignedTransaction from "./SignedTransaction.ts"
|
|
12
|
+
export * as SubmitConfig from "./SubmitConfig.ts"
|