@ar.io/sdk 4.0.0-solana.9 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +721 -673
- package/lib/esm/cli/cli.js +28 -152
- package/lib/esm/cli/commands/antCommands.js +5 -66
- package/lib/esm/cli/commands/arnsPurchaseCommands.js +7 -28
- package/lib/esm/cli/commands/escrowCommands.js +23 -4
- package/lib/esm/cli/commands/gatewayWriteCommands.js +15 -8
- package/lib/esm/cli/commands/pruneCommands.js +14 -26
- package/lib/esm/cli/commands/readCommands.js +12 -1
- package/lib/esm/cli/options.js +2 -75
- package/lib/esm/cli/utils.js +96 -209
- package/lib/esm/common/ant-registry.js +12 -160
- package/lib/esm/common/ant.js +40 -1208
- package/lib/esm/common/faucet.js +17 -6
- package/lib/esm/common/index.js +0 -4
- package/lib/esm/common/io.js +13 -1441
- package/lib/esm/constants.js +0 -18
- package/lib/esm/solana/ant-readable.js +391 -54
- package/lib/esm/solana/ant-registry-readable.js +15 -0
- package/lib/esm/solana/ant-registry-writeable.js +19 -4
- package/lib/esm/solana/ant-writeable.js +43 -11
- package/lib/esm/solana/ata.js +15 -0
- package/lib/esm/solana/canonical-message.js +45 -9
- package/lib/esm/solana/clusters.js +71 -22
- package/lib/esm/solana/constants.js +21 -5
- package/lib/esm/solana/delegation-math.js +49 -0
- package/lib/esm/solana/deserialize.js +263 -727
- package/lib/esm/solana/escrow.js +145 -103
- package/lib/esm/solana/events.js +20 -199
- package/lib/esm/solana/funding-plan.js +19 -2
- package/lib/esm/solana/index.js +53 -12
- package/lib/esm/solana/instruction.js +15 -0
- package/lib/esm/solana/io-readable.js +510 -58
- package/lib/esm/solana/io-writeable.js +1179 -183
- package/lib/esm/solana/json-rpc.js +20 -4
- package/lib/esm/solana/metadata.js +15 -0
- package/lib/esm/solana/mpl-core.js +55 -5
- package/lib/esm/solana/pda.js +15 -0
- package/lib/esm/solana/predict-prescribed-observers.js +110 -0
- package/lib/esm/solana/retry.js +117 -0
- package/lib/esm/solana/rpc-circuit-breaker.js +258 -0
- package/lib/esm/solana/send.js +258 -3
- package/lib/esm/solana/spawn-ant.js +16 -2
- package/lib/esm/types/ant.js +8 -8
- package/lib/esm/types/io.js +0 -10
- package/lib/esm/utils/ant.js +0 -64
- package/lib/esm/utils/index.js +0 -3
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/antCommands.d.ts +6 -9
- package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +27 -13
- package/lib/types/cli/commands/escrowCommands.d.ts +6 -0
- package/lib/types/cli/commands/gatewayWriteCommands.d.ts +12 -11
- package/lib/types/cli/commands/pruneCommands.d.ts +11 -11
- package/lib/types/cli/commands/readCommands.d.ts +25 -22
- package/lib/types/cli/commands/transfer.d.ts +9 -9
- package/lib/types/cli/options.d.ts +0 -57
- package/lib/types/cli/types.d.ts +6 -14
- package/lib/types/cli/utils.d.ts +34 -32
- package/lib/types/common/ant-registry.d.ts +35 -74
- package/lib/types/common/ant.d.ts +52 -570
- package/lib/types/common/faucet.d.ts +20 -8
- package/lib/types/common/index.d.ts +0 -3
- package/lib/types/common/io.d.ts +56 -288
- package/lib/types/constants.d.ts +0 -17
- package/lib/types/solana/ant-readable.d.ts +65 -6
- package/lib/types/solana/ant-registry-readable.d.ts +17 -2
- package/lib/types/solana/ant-registry-writeable.d.ts +20 -5
- package/lib/types/solana/ant-writeable.d.ts +39 -24
- package/lib/types/solana/ata.d.ts +15 -0
- package/lib/types/solana/canonical-message.d.ts +44 -5
- package/lib/types/solana/clusters.d.ts +68 -21
- package/lib/types/solana/constants.d.ts +16 -0
- package/lib/types/solana/delegation-math.d.ts +25 -0
- package/lib/types/solana/deserialize.d.ts +28 -198
- package/lib/types/solana/escrow.d.ts +128 -51
- package/lib/types/solana/events.d.ts +26 -144
- package/lib/types/solana/funding-plan.d.ts +15 -0
- package/lib/types/solana/index.d.ts +27 -3
- package/lib/types/solana/instruction.d.ts +15 -0
- package/lib/types/solana/io-readable.d.ts +185 -46
- package/lib/types/solana/io-writeable.d.ts +450 -77
- package/lib/types/solana/json-rpc.d.ts +15 -0
- package/lib/types/solana/metadata.d.ts +15 -0
- package/lib/types/solana/mpl-core.d.ts +44 -0
- package/lib/types/solana/predict-prescribed-observers.d.ts +28 -0
- package/lib/types/solana/retry.d.ts +62 -0
- package/lib/types/solana/rpc-circuit-breaker.d.ts +78 -0
- package/lib/types/solana/send.d.ts +80 -2
- package/lib/types/solana/spawn-ant.d.ts +15 -0
- package/lib/types/solana/types.d.ts +15 -0
- package/lib/types/types/ant-registry.d.ts +4 -4
- package/lib/types/types/ant.d.ts +92 -92
- package/lib/types/types/common.d.ts +18 -74
- package/lib/types/types/faucet.d.ts +2 -2
- package/lib/types/types/io.d.ts +189 -158
- package/lib/types/types/token.d.ts +0 -12
- package/lib/types/utils/ant.d.ts +1 -12
- package/lib/types/utils/index.d.ts +0 -3
- package/lib/types/version.d.ts +1 -1
- package/package.json +23 -37
- package/lib/esm/common/ant-versions.js +0 -87
- package/lib/esm/common/arweave.js +0 -21
- package/lib/esm/common/contracts/ao-process.js +0 -218
- package/lib/esm/common/hyperbeam/hb.js +0 -169
- package/lib/esm/common/marketplace.js +0 -669
- package/lib/esm/common/turbo.js +0 -215
- package/lib/esm/node/index.js +0 -20
- package/lib/esm/solana/generated/ant/events/aclEntryAddedEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/aclEntryRemovedEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/antMetadataUpdatedEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/antReconciledEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/antTransferredEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/attributesClearedEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/attributesSyncedEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/controllerAddedEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/controllerRemovedEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/index.js +0 -16
- package/lib/esm/solana/generated/ant/events/recordMetadataPrunedEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/recordMetadataRemovedEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/recordMetadataUpdatedEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/recordRemovedEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/recordSetEvent.js +0 -21
- package/lib/esm/solana/generated/ant/events/recordTransferredEvent.js +0 -21
- package/lib/esm/solana/generated/ant-escrow/events/escrowCancelledEvent.js +0 -21
- package/lib/esm/solana/generated/ant-escrow/events/escrowClaimedEvent.js +0 -21
- package/lib/esm/solana/generated/ant-escrow/events/escrowDepositedEvent.js +0 -21
- package/lib/esm/solana/generated/ant-escrow/events/escrowRecipientUpdatedEvent.js +0 -21
- package/lib/esm/solana/generated/ant-escrow/events/index.js +0 -5
- package/lib/esm/solana/generated/arns/events/demandFactorUpdatedEvent.js +0 -21
- package/lib/esm/solana/generated/arns/events/index.js +0 -13
- package/lib/esm/solana/generated/arns/events/leaseExtendedEvent.js +0 -21
- package/lib/esm/solana/generated/arns/events/namePurchasedEvent.js +0 -21
- package/lib/esm/solana/generated/arns/events/nameReassignedEvent.js +0 -21
- package/lib/esm/solana/generated/arns/events/nameReleasedEvent.js +0 -21
- package/lib/esm/solana/generated/arns/events/nameReservedEvent.js +0 -21
- package/lib/esm/solana/generated/arns/events/nameUnreservedEvent.js +0 -21
- package/lib/esm/solana/generated/arns/events/nameUpgradedEvent.js +0 -21
- package/lib/esm/solana/generated/arns/events/namesPrunedEvent.js +0 -21
- package/lib/esm/solana/generated/arns/events/reservedNameClaimedEvent.js +0 -21
- package/lib/esm/solana/generated/arns/events/returnedNamePurchasedEvent.js +0 -21
- package/lib/esm/solana/generated/arns/events/undernameIncreasedEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/configUpdatedEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/coreMigrationFinalizedEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/index.js +0 -14
- package/lib/esm/solana/generated/core/events/primaryNameRemovedEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/primaryNameRequestExpiredEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/primaryNameRequestedEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/primaryNameSetEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/supplyFinalizedEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/transferEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/vaultCreatedEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/vaultExtendedEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/vaultIncreasedEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/vaultReleasedEvent.js +0 -21
- package/lib/esm/solana/generated/core/events/vaultRevokedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/allowlistToggledEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/delegateAllowlistedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/delegationClosedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/delegationDecreasedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/delegationEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/epochClosedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/epochCreatedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/epochDistributedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/epochPrescribedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/epochWeightsTalliedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/epochsToggledEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/fundingPlanAppliedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/garMigrationFinalizedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/gatewayFinalizedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/gatewayJoinedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/gatewayLeavingEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/gatewayPrunedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/gatewaySettingsUpdatedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/index.js +0 -31
- package/lib/esm/solana/generated/gar/events/instantWithdrawalEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/observationSubmittedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/observerAddressUpdatedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/operatorStakeIncreasedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/redelegationEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/residueVaultCreatedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/rewardsCompoundedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/stakePaymentEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/withdrawalCancelledEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/withdrawalClaimedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/withdrawalCreatedEvent.js +0 -21
- package/lib/esm/solana/generated/gar/events/withdrawalPaymentEvent.js +0 -21
- package/lib/esm/solana/generated/mpl-core/accounts/assetV1.js +0 -42
- package/lib/esm/solana/generated/mpl-core/accounts/collectionV1.js +0 -42
- package/lib/esm/solana/generated/mpl-core/accounts/hashedAssetV1.js +0 -45
- package/lib/esm/solana/generated/mpl-core/accounts/index.js +0 -12
- package/lib/esm/solana/generated/mpl-core/accounts/pluginHeaderV1.js +0 -45
- package/lib/esm/solana/generated/mpl-core/accounts/pluginRegistryV1.js +0 -42
- package/lib/esm/solana/generated/mpl-core/errors/index.js +0 -8
- package/lib/esm/solana/generated/mpl-core/errors/mplCore.js +0 -136
- package/lib/esm/solana/generated/mpl-core/index.js +0 -8
- package/lib/esm/solana/generated/mpl-core/instructions/addCollectionExternalPluginAdapterV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/addCollectionPluginV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/addExternalPluginAdapterV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/addPluginV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/approveCollectionPluginAuthorityV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/approvePluginAuthorityV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/burnCollectionV1.js +0 -49
- package/lib/esm/solana/generated/mpl-core/instructions/burnV1.js +0 -49
- package/lib/esm/solana/generated/mpl-core/instructions/collect.js +0 -42
- package/lib/esm/solana/generated/mpl-core/instructions/compressV1.js +0 -50
- package/lib/esm/solana/generated/mpl-core/instructions/createCollectionV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/createCollectionV2.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/createV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/createV2.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/decompressV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/executeV1.js +0 -56
- package/lib/esm/solana/generated/mpl-core/instructions/index.js +0 -40
- package/lib/esm/solana/generated/mpl-core/instructions/removeCollectionExternalPluginAdapterV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/removeCollectionPluginV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/removeExternalPluginAdapterV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/removePluginV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/revokeCollectionPluginAuthorityV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/revokePluginAuthorityV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/transferV1.js +0 -49
- package/lib/esm/solana/generated/mpl-core/instructions/updateCollectionExternalPluginAdapterV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/updateCollectionInfoV1.js +0 -45
- package/lib/esm/solana/generated/mpl-core/instructions/updateCollectionPluginV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/updateCollectionV1.js +0 -52
- package/lib/esm/solana/generated/mpl-core/instructions/updateExternalPluginAdapterV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/updatePluginV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/updateV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/updateV2.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/writeCollectionExternalPluginAdapterDataV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/instructions/writeExternalPluginAdapterDataV1.js +0 -53
- package/lib/esm/solana/generated/mpl-core/program-address.js +0 -1
- package/lib/esm/solana/generated/mpl-core/types/addAssetsToGroupV1Args.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/addBlocker.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/addCollectionsToGroupV1Args.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/addGroupsToGroupV1Args.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/agentIdentity.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/agentIdentityInitInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/agentIdentityUpdateInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/appData.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/appDataInitInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/appDataUpdateInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/attribute.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/attributes.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/authority.js +0 -24
- package/lib/esm/solana/generated/mpl-core/types/autograph.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/autographSignature.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/bubblegumV2.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/burnDelegate.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/closeGroupV1Args.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/compressionProof.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/creator.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/dataSection.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/dataSectionInitInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/dataSectionUpdateInfo.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/dataState.js +0 -23
- package/lib/esm/solana/generated/mpl-core/types/edition.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/externalCheckResult.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/externalPluginAdapter.js +0 -25
- package/lib/esm/solana/generated/mpl-core/types/externalPluginAdapterInitInfo.js +0 -25
- package/lib/esm/solana/generated/mpl-core/types/externalPluginAdapterKey.js +0 -25
- package/lib/esm/solana/generated/mpl-core/types/externalPluginAdapterSchema.js +0 -24
- package/lib/esm/solana/generated/mpl-core/types/externalPluginAdapterType.js +0 -28
- package/lib/esm/solana/generated/mpl-core/types/externalPluginAdapterUpdateInfo.js +0 -25
- package/lib/esm/solana/generated/mpl-core/types/externalRegistryRecord.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/externalValidationResult.js +0 -24
- package/lib/esm/solana/generated/mpl-core/types/extraAccount.js +0 -25
- package/lib/esm/solana/generated/mpl-core/types/freezeDelegate.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/freezeExecute.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/groups.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/hashablePluginSchema.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/hashedAssetSchema.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/hookableLifecycleEvent.js +0 -26
- package/lib/esm/solana/generated/mpl-core/types/immutableMetadata.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/index.js +0 -89
- package/lib/esm/solana/generated/mpl-core/types/key.js +0 -28
- package/lib/esm/solana/generated/mpl-core/types/lifecycleHook.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/lifecycleHookInitInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/lifecycleHookUpdateInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/linkedAppData.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/linkedAppDataInitInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/linkedAppDataUpdateInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/linkedDataKey.js +0 -25
- package/lib/esm/solana/generated/mpl-core/types/linkedLifecycleHook.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/linkedLifecycleHookInitInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/linkedLifecycleHookUpdateInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/masterEdition.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/oracle.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/oracleInitInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/oracleUpdateInfo.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/oracleValidation.js +0 -25
- package/lib/esm/solana/generated/mpl-core/types/permanentBurnDelegate.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/permanentFreezeDelegate.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/permanentFreezeExecute.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/permanentTransferDelegate.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/plugin.js +0 -25
- package/lib/esm/solana/generated/mpl-core/types/pluginAuthorityPair.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/pluginType.js +0 -40
- package/lib/esm/solana/generated/mpl-core/types/registryRecord.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/relationshipKind.js +0 -25
- package/lib/esm/solana/generated/mpl-core/types/removeAssetsFromGroupV1Args.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/removeCollectionsFromGroupV1Args.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/removeGroupsFromGroupV1Args.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/royalties.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/ruleSet.js +0 -24
- package/lib/esm/solana/generated/mpl-core/types/seed.js +0 -24
- package/lib/esm/solana/generated/mpl-core/types/transferDelegate.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/updateAuthority.js +0 -24
- package/lib/esm/solana/generated/mpl-core/types/updateDelegate.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/updateGroupV1Args.js +0 -17
- package/lib/esm/solana/generated/mpl-core/types/updateType.js +0 -24
- package/lib/esm/solana/generated/mpl-core/types/validationResult.js +0 -25
- package/lib/esm/solana/generated/mpl-core/types/validationResultsOffset.js +0 -24
- package/lib/esm/solana/generated/mpl-core/types/verifiedCreators.js +0 -18
- package/lib/esm/solana/generated/mpl-core/types/verifiedCreatorsSignature.js +0 -17
- package/lib/esm/utils/ao.js +0 -421
- package/lib/esm/utils/arweave.js +0 -271
- package/lib/esm/utils/processes.js +0 -167
- package/lib/esm/web/index.js +0 -20
- package/lib/types/common/ant-versions.d.ts +0 -39
- package/lib/types/common/arweave.d.ts +0 -17
- package/lib/types/common/contracts/ao-process.d.ts +0 -33
- package/lib/types/common/hyperbeam/hb.d.ts +0 -88
- package/lib/types/common/marketplace.d.ts +0 -556
- package/lib/types/common/turbo.d.ts +0 -61
- package/lib/types/node/index.d.ts +0 -20
- package/lib/types/solana/generated/ant/events/aclEntryAddedEvent.d.ts +0 -26
- package/lib/types/solana/generated/ant/events/aclEntryRemovedEvent.d.ts +0 -26
- package/lib/types/solana/generated/ant/events/antMetadataUpdatedEvent.d.ts +0 -28
- package/lib/types/solana/generated/ant/events/antReconciledEvent.d.ts +0 -28
- package/lib/types/solana/generated/ant/events/antTransferredEvent.d.ts +0 -26
- package/lib/types/solana/generated/ant/events/attributesClearedEvent.d.ts +0 -26
- package/lib/types/solana/generated/ant/events/attributesSyncedEvent.d.ts +0 -24
- package/lib/types/solana/generated/ant/events/controllerAddedEvent.d.ts +0 -26
- package/lib/types/solana/generated/ant/events/controllerRemovedEvent.d.ts +0 -26
- package/lib/types/solana/generated/ant/events/index.d.ts +0 -15
- package/lib/types/solana/generated/ant/events/recordMetadataPrunedEvent.d.ts +0 -26
- package/lib/types/solana/generated/ant/events/recordMetadataRemovedEvent.d.ts +0 -26
- package/lib/types/solana/generated/ant/events/recordMetadataUpdatedEvent.d.ts +0 -28
- package/lib/types/solana/generated/ant/events/recordRemovedEvent.d.ts +0 -26
- package/lib/types/solana/generated/ant/events/recordSetEvent.d.ts +0 -34
- package/lib/types/solana/generated/ant/events/recordTransferredEvent.d.ts +0 -30
- package/lib/types/solana/generated/ant-escrow/events/escrowCancelledEvent.d.ts +0 -28
- package/lib/types/solana/generated/ant-escrow/events/escrowClaimedEvent.d.ts +0 -32
- package/lib/types/solana/generated/ant-escrow/events/escrowDepositedEvent.d.ts +0 -36
- package/lib/types/solana/generated/ant-escrow/events/escrowRecipientUpdatedEvent.d.ts +0 -26
- package/lib/types/solana/generated/ant-escrow/events/index.d.ts +0 -4
- package/lib/types/solana/generated/arns/events/demandFactorUpdatedEvent.d.ts +0 -28
- package/lib/types/solana/generated/arns/events/index.d.ts +0 -12
- package/lib/types/solana/generated/arns/events/leaseExtendedEvent.d.ts +0 -32
- package/lib/types/solana/generated/arns/events/namePurchasedEvent.d.ts +0 -34
- package/lib/types/solana/generated/arns/events/nameReassignedEvent.d.ts +0 -28
- package/lib/types/solana/generated/arns/events/nameReleasedEvent.d.ts +0 -24
- package/lib/types/solana/generated/arns/events/nameReservedEvent.d.ts +0 -28
- package/lib/types/solana/generated/arns/events/nameUnreservedEvent.d.ts +0 -24
- package/lib/types/solana/generated/arns/events/nameUpgradedEvent.d.ts +0 -28
- package/lib/types/solana/generated/arns/events/namesPrunedEvent.d.ts +0 -26
- package/lib/types/solana/generated/arns/events/reservedNameClaimedEvent.d.ts +0 -24
- package/lib/types/solana/generated/arns/events/returnedNamePurchasedEvent.d.ts +0 -32
- package/lib/types/solana/generated/arns/events/undernameIncreasedEvent.d.ts +0 -32
- package/lib/types/solana/generated/core/events/configUpdatedEvent.d.ts +0 -26
- package/lib/types/solana/generated/core/events/coreMigrationFinalizedEvent.d.ts +0 -26
- package/lib/types/solana/generated/core/events/index.d.ts +0 -13
- package/lib/types/solana/generated/core/events/primaryNameRemovedEvent.d.ts +0 -26
- package/lib/types/solana/generated/core/events/primaryNameRequestExpiredEvent.d.ts +0 -26
- package/lib/types/solana/generated/core/events/primaryNameRequestedEvent.d.ts +0 -30
- package/lib/types/solana/generated/core/events/primaryNameSetEvent.d.ts +0 -24
- package/lib/types/solana/generated/core/events/supplyFinalizedEvent.d.ts +0 -26
- package/lib/types/solana/generated/core/events/transferEvent.d.ts +0 -26
- package/lib/types/solana/generated/core/events/vaultCreatedEvent.d.ts +0 -28
- package/lib/types/solana/generated/core/events/vaultExtendedEvent.d.ts +0 -26
- package/lib/types/solana/generated/core/events/vaultIncreasedEvent.d.ts +0 -28
- package/lib/types/solana/generated/core/events/vaultReleasedEvent.d.ts +0 -26
- package/lib/types/solana/generated/core/events/vaultRevokedEvent.d.ts +0 -28
- package/lib/types/solana/generated/gar/events/allowlistToggledEvent.d.ts +0 -24
- package/lib/types/solana/generated/gar/events/delegateAllowlistedEvent.d.ts +0 -26
- package/lib/types/solana/generated/gar/events/delegationClosedEvent.d.ts +0 -24
- package/lib/types/solana/generated/gar/events/delegationDecreasedEvent.d.ts +0 -28
- package/lib/types/solana/generated/gar/events/delegationEvent.d.ts +0 -28
- package/lib/types/solana/generated/gar/events/epochClosedEvent.d.ts +0 -24
- package/lib/types/solana/generated/gar/events/epochCreatedEvent.d.ts +0 -26
- package/lib/types/solana/generated/gar/events/epochDistributedEvent.d.ts +0 -26
- package/lib/types/solana/generated/gar/events/epochPrescribedEvent.d.ts +0 -28
- package/lib/types/solana/generated/gar/events/epochWeightsTalliedEvent.d.ts +0 -26
- package/lib/types/solana/generated/gar/events/epochsToggledEvent.d.ts +0 -24
- package/lib/types/solana/generated/gar/events/fundingPlanAppliedEvent.d.ts +0 -28
- package/lib/types/solana/generated/gar/events/garMigrationFinalizedEvent.d.ts +0 -26
- package/lib/types/solana/generated/gar/events/gatewayFinalizedEvent.d.ts +0 -24
- package/lib/types/solana/generated/gar/events/gatewayJoinedEvent.d.ts +0 -26
- package/lib/types/solana/generated/gar/events/gatewayLeavingEvent.d.ts +0 -22
- package/lib/types/solana/generated/gar/events/gatewayPrunedEvent.d.ts +0 -26
- package/lib/types/solana/generated/gar/events/gatewaySettingsUpdatedEvent.d.ts +0 -24
- package/lib/types/solana/generated/gar/events/index.d.ts +0 -30
- package/lib/types/solana/generated/gar/events/instantWithdrawalEvent.d.ts +0 -30
- package/lib/types/solana/generated/gar/events/observationSubmittedEvent.d.ts +0 -28
- package/lib/types/solana/generated/gar/events/observerAddressUpdatedEvent.d.ts +0 -24
- package/lib/types/solana/generated/gar/events/operatorStakeIncreasedEvent.d.ts +0 -26
- package/lib/types/solana/generated/gar/events/redelegationEvent.d.ts +0 -30
- package/lib/types/solana/generated/gar/events/residueVaultCreatedEvent.d.ts +0 -30
- package/lib/types/solana/generated/gar/events/rewardsCompoundedEvent.d.ts +0 -26
- package/lib/types/solana/generated/gar/events/stakePaymentEvent.d.ts +0 -28
- package/lib/types/solana/generated/gar/events/withdrawalCancelledEvent.d.ts +0 -30
- package/lib/types/solana/generated/gar/events/withdrawalClaimedEvent.d.ts +0 -26
- package/lib/types/solana/generated/gar/events/withdrawalCreatedEvent.d.ts +0 -28
- package/lib/types/solana/generated/gar/events/withdrawalPaymentEvent.d.ts +0 -28
- package/lib/types/solana/generated/mpl-core/accounts/assetV1.d.ts +0 -37
- package/lib/types/solana/generated/mpl-core/accounts/collectionV1.d.ts +0 -37
- package/lib/types/solana/generated/mpl-core/accounts/hashedAssetV1.d.ts +0 -30
- package/lib/types/solana/generated/mpl-core/accounts/index.d.ts +0 -12
- package/lib/types/solana/generated/mpl-core/accounts/pluginHeaderV1.d.ts +0 -30
- package/lib/types/solana/generated/mpl-core/accounts/pluginRegistryV1.d.ts +0 -31
- package/lib/types/solana/generated/mpl-core/errors/index.d.ts +0 -8
- package/lib/types/solana/generated/mpl-core/errors/mplCore.d.ts +0 -133
- package/lib/types/solana/generated/mpl-core/index.d.ts +0 -8
- package/lib/types/solana/generated/mpl-core/instructions/addCollectionExternalPluginAdapterV1.d.ts +0 -56
- package/lib/types/solana/generated/mpl-core/instructions/addCollectionPluginV1.d.ts +0 -59
- package/lib/types/solana/generated/mpl-core/instructions/addExternalPluginAdapterV1.d.ts +0 -60
- package/lib/types/solana/generated/mpl-core/instructions/addPluginV1.d.ts +0 -63
- package/lib/types/solana/generated/mpl-core/instructions/approveCollectionPluginAuthorityV1.d.ts +0 -59
- package/lib/types/solana/generated/mpl-core/instructions/approvePluginAuthorityV1.d.ts +0 -63
- package/lib/types/solana/generated/mpl-core/instructions/burnCollectionV1.d.ts +0 -52
- package/lib/types/solana/generated/mpl-core/instructions/burnV1.d.ts +0 -60
- package/lib/types/solana/generated/mpl-core/instructions/collect.d.ts +0 -39
- package/lib/types/solana/generated/mpl-core/instructions/compressV1.d.ts +0 -55
- package/lib/types/solana/generated/mpl-core/instructions/createCollectionV1.d.ts +0 -58
- package/lib/types/solana/generated/mpl-core/instructions/createCollectionV2.d.ts +0 -61
- package/lib/types/solana/generated/mpl-core/instructions/createV1.d.ts +0 -77
- package/lib/types/solana/generated/mpl-core/instructions/createV2.d.ts +0 -80
- package/lib/types/solana/generated/mpl-core/instructions/decompressV1.d.ts +0 -60
- package/lib/types/solana/generated/mpl-core/instructions/executeV1.d.ts +0 -63
- package/lib/types/solana/generated/mpl-core/instructions/index.d.ts +0 -40
- package/lib/types/solana/generated/mpl-core/instructions/removeCollectionExternalPluginAdapterV1.d.ts +0 -56
- package/lib/types/solana/generated/mpl-core/instructions/removeCollectionPluginV1.d.ts +0 -56
- package/lib/types/solana/generated/mpl-core/instructions/removeExternalPluginAdapterV1.d.ts +0 -60
- package/lib/types/solana/generated/mpl-core/instructions/removePluginV1.d.ts +0 -60
- package/lib/types/solana/generated/mpl-core/instructions/revokeCollectionPluginAuthorityV1.d.ts +0 -56
- package/lib/types/solana/generated/mpl-core/instructions/revokePluginAuthorityV1.d.ts +0 -60
- package/lib/types/solana/generated/mpl-core/instructions/transferV1.d.ts +0 -64
- package/lib/types/solana/generated/mpl-core/instructions/updateCollectionExternalPluginAdapterV1.d.ts +0 -59
- package/lib/types/solana/generated/mpl-core/instructions/updateCollectionInfoV1.d.ts +0 -47
- package/lib/types/solana/generated/mpl-core/instructions/updateCollectionPluginV1.d.ts +0 -56
- package/lib/types/solana/generated/mpl-core/instructions/updateCollectionV1.d.ts +0 -62
- package/lib/types/solana/generated/mpl-core/instructions/updateExternalPluginAdapterV1.d.ts +0 -63
- package/lib/types/solana/generated/mpl-core/instructions/updatePluginV1.d.ts +0 -60
- package/lib/types/solana/generated/mpl-core/instructions/updateV1.d.ts +0 -66
- package/lib/types/solana/generated/mpl-core/instructions/updateV2.d.ts +0 -70
- package/lib/types/solana/generated/mpl-core/instructions/writeCollectionExternalPluginAdapterDataV1.d.ts +0 -63
- package/lib/types/solana/generated/mpl-core/instructions/writeExternalPluginAdapterDataV1.d.ts +0 -67
- package/lib/types/solana/generated/mpl-core/program-address.d.ts +0 -7
- package/lib/types/solana/generated/mpl-core/types/addAssetsToGroupV1Args.d.ts +0 -13
- package/lib/types/solana/generated/mpl-core/types/addBlocker.d.ts +0 -13
- package/lib/types/solana/generated/mpl-core/types/addCollectionsToGroupV1Args.d.ts +0 -13
- package/lib/types/solana/generated/mpl-core/types/addGroupsToGroupV1Args.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/agentIdentity.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/agentIdentityInitInfo.d.ts +0 -22
- package/lib/types/solana/generated/mpl-core/types/agentIdentityUpdateInfo.d.ts +0 -20
- package/lib/types/solana/generated/mpl-core/types/appData.d.ts +0 -20
- package/lib/types/solana/generated/mpl-core/types/appDataInitInfo.d.ts +0 -22
- package/lib/types/solana/generated/mpl-core/types/appDataUpdateInfo.d.ts +0 -18
- package/lib/types/solana/generated/mpl-core/types/attribute.d.ts +0 -16
- package/lib/types/solana/generated/mpl-core/types/attributes.d.ts +0 -18
- package/lib/types/solana/generated/mpl-core/types/authority.d.ts +0 -29
- package/lib/types/solana/generated/mpl-core/types/autograph.d.ts +0 -18
- package/lib/types/solana/generated/mpl-core/types/autographSignature.d.ts +0 -16
- package/lib/types/solana/generated/mpl-core/types/bubblegumV2.d.ts +0 -13
- package/lib/types/solana/generated/mpl-core/types/burnDelegate.d.ts +0 -13
- package/lib/types/solana/generated/mpl-core/types/closeGroupV1Args.d.ts +0 -13
- package/lib/types/solana/generated/mpl-core/types/compressionProof.d.ts +0 -28
- package/lib/types/solana/generated/mpl-core/types/creator.d.ts +0 -16
- package/lib/types/solana/generated/mpl-core/types/dataSection.d.ts +0 -20
- package/lib/types/solana/generated/mpl-core/types/dataSectionInitInfo.d.ts +0 -20
- package/lib/types/solana/generated/mpl-core/types/dataSectionUpdateInfo.d.ts +0 -13
- package/lib/types/solana/generated/mpl-core/types/dataState.d.ts +0 -16
- package/lib/types/solana/generated/mpl-core/types/edition.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/externalCheckResult.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/externalPluginAdapter.d.ts +0 -66
- package/lib/types/solana/generated/mpl-core/types/externalPluginAdapterInitInfo.d.ts +0 -66
- package/lib/types/solana/generated/mpl-core/types/externalPluginAdapterKey.d.ts +0 -64
- package/lib/types/solana/generated/mpl-core/types/externalPluginAdapterSchema.d.ts +0 -17
- package/lib/types/solana/generated/mpl-core/types/externalPluginAdapterType.d.ts +0 -21
- package/lib/types/solana/generated/mpl-core/types/externalPluginAdapterUpdateInfo.d.ts +0 -59
- package/lib/types/solana/generated/mpl-core/types/externalRegistryRecord.d.ts +0 -28
- package/lib/types/solana/generated/mpl-core/types/externalValidationResult.d.ts +0 -17
- package/lib/types/solana/generated/mpl-core/types/extraAccount.d.ts +0 -86
- package/lib/types/solana/generated/mpl-core/types/freezeDelegate.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/freezeExecute.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/groups.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/hashablePluginSchema.d.ts +0 -22
- package/lib/types/solana/generated/mpl-core/types/hashedAssetSchema.d.ts +0 -16
- package/lib/types/solana/generated/mpl-core/types/hookableLifecycleEvent.d.ts +0 -19
- package/lib/types/solana/generated/mpl-core/types/immutableMetadata.d.ts +0 -13
- package/lib/types/solana/generated/mpl-core/types/index.d.ts +0 -89
- package/lib/types/solana/generated/mpl-core/types/key.d.ts +0 -21
- package/lib/types/solana/generated/mpl-core/types/lifecycleHook.d.ts +0 -24
- package/lib/types/solana/generated/mpl-core/types/lifecycleHookInitInfo.d.ts +0 -28
- package/lib/types/solana/generated/mpl-core/types/lifecycleHookUpdateInfo.d.ts +0 -22
- package/lib/types/solana/generated/mpl-core/types/linkedAppData.d.ts +0 -20
- package/lib/types/solana/generated/mpl-core/types/linkedAppDataInitInfo.d.ts +0 -22
- package/lib/types/solana/generated/mpl-core/types/linkedAppDataUpdateInfo.d.ts +0 -18
- package/lib/types/solana/generated/mpl-core/types/linkedDataKey.d.ts +0 -31
- package/lib/types/solana/generated/mpl-core/types/linkedLifecycleHook.d.ts +0 -24
- package/lib/types/solana/generated/mpl-core/types/linkedLifecycleHookInitInfo.d.ts +0 -28
- package/lib/types/solana/generated/mpl-core/types/linkedLifecycleHookUpdateInfo.d.ts +0 -22
- package/lib/types/solana/generated/mpl-core/types/masterEdition.d.ts +0 -21
- package/lib/types/solana/generated/mpl-core/types/oracle.d.ts +0 -22
- package/lib/types/solana/generated/mpl-core/types/oracleInitInfo.d.ts +0 -26
- package/lib/types/solana/generated/mpl-core/types/oracleUpdateInfo.d.ts +0 -22
- package/lib/types/solana/generated/mpl-core/types/oracleValidation.d.ts +0 -35
- package/lib/types/solana/generated/mpl-core/types/permanentBurnDelegate.d.ts +0 -13
- package/lib/types/solana/generated/mpl-core/types/permanentFreezeDelegate.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/permanentFreezeExecute.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/permanentTransferDelegate.d.ts +0 -13
- package/lib/types/solana/generated/mpl-core/types/plugin.d.ts +0 -150
- package/lib/types/solana/generated/mpl-core/types/pluginAuthorityPair.d.ts +0 -20
- package/lib/types/solana/generated/mpl-core/types/pluginType.d.ts +0 -33
- package/lib/types/solana/generated/mpl-core/types/registryRecord.d.ts +0 -22
- package/lib/types/solana/generated/mpl-core/types/relationshipKind.d.ts +0 -18
- package/lib/types/solana/generated/mpl-core/types/removeAssetsFromGroupV1Args.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/removeCollectionsFromGroupV1Args.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/removeGroupsFromGroupV1Args.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/royalties.d.ts +0 -22
- package/lib/types/solana/generated/mpl-core/types/ruleSet.d.ts +0 -27
- package/lib/types/solana/generated/mpl-core/types/seed.d.ts +0 -36
- package/lib/types/solana/generated/mpl-core/types/transferDelegate.d.ts +0 -13
- package/lib/types/solana/generated/mpl-core/types/updateAuthority.d.ts +0 -27
- package/lib/types/solana/generated/mpl-core/types/updateDelegate.d.ts +0 -15
- package/lib/types/solana/generated/mpl-core/types/updateGroupV1Args.d.ts +0 -19
- package/lib/types/solana/generated/mpl-core/types/updateType.d.ts +0 -17
- package/lib/types/solana/generated/mpl-core/types/validationResult.d.ts +0 -18
- package/lib/types/solana/generated/mpl-core/types/validationResultsOffset.d.ts +0 -33
- package/lib/types/solana/generated/mpl-core/types/verifiedCreators.d.ts +0 -18
- package/lib/types/solana/generated/mpl-core/types/verifiedCreatorsSignature.d.ts +0 -16
- package/lib/types/utils/ao.d.ts +0 -80
- package/lib/types/utils/arweave.d.ts +0 -79
- package/lib/types/utils/processes.d.ts +0 -39
- package/lib/types/web/index.d.ts +0 -20
package/lib/esm/common/io.js
CHANGED
|
@@ -1,1458 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { connect } from '@permaweb/aoconnect';
|
|
17
|
-
import { ANT_REGISTRY_ID, ARIO_MAINNET_PROCESS_ID, ARIO_TESTNET_PROCESS_ID, } from '../constants.js';
|
|
18
1
|
import { SolanaARIOReadable } from '../solana/io-readable.js';
|
|
19
2
|
import { SolanaARIOWriteable } from '../solana/io-writeable.js';
|
|
20
|
-
import { isProcessConfiguration, isProcessIdConfiguration, } from '../types/index.js';
|
|
21
|
-
import { createAoSigner } from '../utils/ao.js';
|
|
22
|
-
import { getEpochDataFromGqlWithCUFallback, paginationParamsToTags, pruneTags, removeEligibleRewardsFromEpochData, sortAndPaginateEpochDataIntoEligibleDistributions, } from '../utils/arweave.js';
|
|
23
|
-
import { ANTRegistry } from './ant-registry.js';
|
|
24
|
-
import { ANT } from './ant.js';
|
|
25
|
-
import { defaultArweave } from './arweave.js';
|
|
26
|
-
import { AOProcess } from './contracts/ao-process.js';
|
|
27
|
-
import { InvalidContractConfigurationError } from './error.js';
|
|
28
|
-
import { createFaucet } from './faucet.js';
|
|
29
|
-
import { HB } from './hyperbeam/hb.js';
|
|
30
|
-
import { Logger } from './logger.js';
|
|
31
|
-
import { TurboArNSPaymentFactory, TurboArNSPaymentProviderAuthenticated, isTurboArNSSigner, } from './turbo.js';
|
|
32
3
|
export const DEFAULT_SOLANA_RPC_URL = 'https://api.mainnet-beta.solana.com';
|
|
33
4
|
export class ARIO {
|
|
34
|
-
// Implementation
|
|
35
5
|
static init(config) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
config.backend === 'solana') {
|
|
40
|
-
if (config.signer) {
|
|
41
|
-
if (!config.rpcSubscriptions) {
|
|
42
|
-
throw new Error('ARIO.init({ backend: "solana", signer }) requires rpcSubscriptions for transaction confirmation.');
|
|
43
|
-
}
|
|
44
|
-
return new SolanaARIOWriteable({
|
|
45
|
-
rpc: config.rpc,
|
|
46
|
-
rpcSubscriptions: config.rpcSubscriptions,
|
|
47
|
-
commitment: config.commitment,
|
|
48
|
-
signer: config.signer,
|
|
49
|
-
coreProgramId: config.coreProgramId,
|
|
50
|
-
garProgramId: config.garProgramId,
|
|
51
|
-
arnsProgramId: config.arnsProgramId,
|
|
52
|
-
antProgramId: config.antProgramId,
|
|
53
|
-
});
|
|
6
|
+
if (config.signer) {
|
|
7
|
+
if (!config.rpcSubscriptions) {
|
|
8
|
+
throw new Error('ARIO.init({ signer }) requires rpcSubscriptions for transaction confirmation.');
|
|
54
9
|
}
|
|
55
|
-
return new
|
|
10
|
+
return new SolanaARIOWriteable({
|
|
56
11
|
rpc: config.rpc,
|
|
12
|
+
rpcSubscriptions: config.rpcSubscriptions,
|
|
57
13
|
commitment: config.commitment,
|
|
14
|
+
signer: config.signer,
|
|
58
15
|
coreProgramId: config.coreProgramId,
|
|
59
16
|
garProgramId: config.garProgramId,
|
|
60
17
|
arnsProgramId: config.arnsProgramId,
|
|
61
18
|
antProgramId: config.antProgramId,
|
|
62
19
|
});
|
|
63
20
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (config !== undefined && 'signer' in config) {
|
|
72
|
-
return new ARIOWriteable({
|
|
73
|
-
...config,
|
|
74
|
-
process: new AOProcess({
|
|
75
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
76
|
-
ao: connect({
|
|
77
|
-
MODE: 'legacy',
|
|
78
|
-
CU_URL: 'https://cu.ardrive.io',
|
|
79
|
-
...config?.process?.ao,
|
|
80
|
-
}),
|
|
81
|
-
}),
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return new ARIOReadable({
|
|
85
|
-
...config,
|
|
86
|
-
process: new AOProcess({
|
|
87
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
88
|
-
ao: connect({
|
|
89
|
-
CU_URL: 'https://cu.ardrive.io',
|
|
90
|
-
MODE: 'legacy',
|
|
91
|
-
...config?.process?.ao,
|
|
92
|
-
}),
|
|
93
|
-
}),
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
static testnet(config) {
|
|
97
|
-
if (config !== undefined && 'signer' in config) {
|
|
98
|
-
return createFaucet({
|
|
99
|
-
arioInstance: new ARIOWriteable({
|
|
100
|
-
...config,
|
|
101
|
-
process: new AOProcess({
|
|
102
|
-
processId: ARIO_TESTNET_PROCESS_ID,
|
|
103
|
-
ao: connect({
|
|
104
|
-
MODE: 'legacy',
|
|
105
|
-
CU_URL: 'https://cu.ardrive.io',
|
|
106
|
-
...config?.process?.ao,
|
|
107
|
-
}),
|
|
108
|
-
}),
|
|
109
|
-
}),
|
|
110
|
-
faucetApiUrl: config?.faucetUrl,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
return createFaucet({
|
|
114
|
-
arioInstance: new ARIOReadable({
|
|
115
|
-
...config,
|
|
116
|
-
process: new AOProcess({
|
|
117
|
-
processId: ARIO_TESTNET_PROCESS_ID,
|
|
118
|
-
ao: connect({
|
|
119
|
-
MODE: 'legacy',
|
|
120
|
-
CU_URL: 'https://cu.ardrive.io',
|
|
121
|
-
...config?.process?.ao,
|
|
122
|
-
}),
|
|
123
|
-
}),
|
|
124
|
-
}),
|
|
125
|
-
faucetApiUrl: config?.faucetUrl,
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
export class ARIOReadable {
|
|
130
|
-
process;
|
|
131
|
-
epochSettings;
|
|
132
|
-
arweave;
|
|
133
|
-
hyperbeamUrl;
|
|
134
|
-
paymentProvider; // TODO: this could be an array/map of payment providers
|
|
135
|
-
logger = Logger.default;
|
|
136
|
-
hb;
|
|
137
|
-
constructor(config) {
|
|
138
|
-
this.arweave = config?.arweave ?? defaultArweave;
|
|
139
|
-
if (config === undefined || Object.keys(config).length === 0) {
|
|
140
|
-
this.process = new AOProcess({
|
|
141
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
else if (isProcessConfiguration(config)) {
|
|
145
|
-
this.process = config.process;
|
|
146
|
-
}
|
|
147
|
-
else if (isProcessIdConfiguration(config)) {
|
|
148
|
-
this.process = new AOProcess({
|
|
149
|
-
processId: config.processId,
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
throw new InvalidContractConfigurationError();
|
|
154
|
-
}
|
|
155
|
-
// only use hyperbeam if the client has provided a hyperbeamUrl
|
|
156
|
-
// this will avoid overwhelming the HyperBeam node with requests
|
|
157
|
-
// as we shift using HyperBEAM for all ANT operations
|
|
158
|
-
if (config?.hyperbeamUrl !== undefined) {
|
|
159
|
-
this.hyperbeamUrl = config.hyperbeamUrl;
|
|
160
|
-
this.hb = new HB({
|
|
161
|
-
url: this.hyperbeamUrl,
|
|
162
|
-
processId: this.process.processId,
|
|
163
|
-
});
|
|
164
|
-
this.logger.debug(`Using HyperBEAM node for process ${this.process.processId}`, {
|
|
165
|
-
hyperbeamUrl: this.hyperbeamUrl,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
this.paymentProvider = TurboArNSPaymentFactory.init({
|
|
169
|
-
paymentUrl: config?.paymentUrl,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
async getInfo() {
|
|
173
|
-
return this.process.read({
|
|
174
|
-
tags: [{ name: 'Action', value: 'Info' }],
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
async getTokenSupply() {
|
|
178
|
-
return this.process.read({
|
|
179
|
-
tags: [{ name: 'Action', value: 'Total-Token-Supply' }],
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
async computeEpochIndexForTimestamp(timestamp) {
|
|
183
|
-
const epochSettings = await this.getEpochSettings();
|
|
184
|
-
const epochZeroStartTimestamp = epochSettings.epochZeroStartTimestamp;
|
|
185
|
-
const epochLengthMs = epochSettings.durationMs;
|
|
186
|
-
return Math.floor((timestamp - epochZeroStartTimestamp) / epochLengthMs);
|
|
187
|
-
}
|
|
188
|
-
async computeCurrentEpochIndex() {
|
|
189
|
-
return this.computeEpochIndexForTimestamp(Date.now());
|
|
190
|
-
}
|
|
191
|
-
async computeEpochIndex(params) {
|
|
192
|
-
const epochIndex = params?.epochIndex;
|
|
193
|
-
if (epochIndex !== undefined) {
|
|
194
|
-
return epochIndex;
|
|
195
|
-
}
|
|
196
|
-
const timestamp = params?.timestamp;
|
|
197
|
-
if (timestamp !== undefined) {
|
|
198
|
-
return this.computeEpochIndexForTimestamp(timestamp);
|
|
199
|
-
}
|
|
200
|
-
return undefined;
|
|
201
|
-
}
|
|
202
|
-
async getEpochSettings() {
|
|
203
|
-
return (this.epochSettings ??= await this.process.read({
|
|
204
|
-
tags: [{ name: 'Action', value: 'Epoch-Settings' }],
|
|
205
|
-
}));
|
|
206
|
-
}
|
|
207
|
-
async getEpoch(epoch) {
|
|
208
|
-
const epochIndex = await this.computeEpochIndex(epoch);
|
|
209
|
-
const currentIndex = await this.computeCurrentEpochIndex();
|
|
210
|
-
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
211
|
-
const epochData = await getEpochDataFromGqlWithCUFallback({
|
|
212
|
-
arweave: this.arweave,
|
|
213
|
-
epochIndex: epochIndex,
|
|
214
|
-
processId: this.process.processId,
|
|
215
|
-
ao: this.process.ao,
|
|
216
|
-
});
|
|
217
|
-
if (!epochData) {
|
|
218
|
-
throw new Error('Epoch data not found for epoch index ' + epochIndex);
|
|
219
|
-
}
|
|
220
|
-
return removeEligibleRewardsFromEpochData(epochData);
|
|
221
|
-
}
|
|
222
|
-
// go to the process epoch and fetch the epoch data
|
|
223
|
-
const allTags = [
|
|
224
|
-
{ name: 'Action', value: 'Epoch' },
|
|
225
|
-
{
|
|
226
|
-
name: 'Epoch-Index',
|
|
227
|
-
value: currentIndex.toString(),
|
|
228
|
-
},
|
|
229
|
-
];
|
|
230
|
-
return this.process.read({
|
|
231
|
-
tags: pruneTags(allTags),
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
async getArNSRecord({ name }) {
|
|
235
|
-
return this.process.read({
|
|
236
|
-
tags: [
|
|
237
|
-
{ name: 'Action', value: 'Record' },
|
|
238
|
-
{ name: 'Name', value: name },
|
|
239
|
-
],
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
async getArNSRecords(params) {
|
|
243
|
-
return this.process.read({
|
|
244
|
-
tags: [
|
|
245
|
-
{ name: 'Action', value: 'Paginated-Records' },
|
|
246
|
-
...paginationParamsToTags(params),
|
|
247
|
-
],
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
async getArNSReservedNames(params) {
|
|
251
|
-
return this.process.read({
|
|
252
|
-
tags: [
|
|
253
|
-
{ name: 'Action', value: 'Reserved-Names' },
|
|
254
|
-
...paginationParamsToTags(params),
|
|
255
|
-
],
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
async getArNSReservedName({ name, }) {
|
|
259
|
-
return this.process.read({
|
|
260
|
-
tags: [
|
|
261
|
-
{ name: 'Action', value: 'Reserved-Name' },
|
|
262
|
-
{ name: 'Name', value: name },
|
|
263
|
-
],
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
async getBalance({ address }) {
|
|
267
|
-
if (this.hb && (await this.hb.checkHyperBeamCompatibility())) {
|
|
268
|
-
this.logger.debug('Getting balance from HyperBEAM', { address });
|
|
269
|
-
const res = await this.hb
|
|
270
|
-
.compute({
|
|
271
|
-
path: `balances/${address}`,
|
|
272
|
-
})
|
|
273
|
-
.then((res) => Number(res))
|
|
274
|
-
.catch((error) => {
|
|
275
|
-
this.logger.error('Failed to get balance from HyperBEAM', {
|
|
276
|
-
cause: error,
|
|
277
|
-
});
|
|
278
|
-
return null;
|
|
279
|
-
});
|
|
280
|
-
if (res !== null)
|
|
281
|
-
return res;
|
|
282
|
-
// else fall through to CU read
|
|
283
|
-
this.logger.info('Failed to get balance from HyperBEAM, failing over to to CU read', { address });
|
|
284
|
-
}
|
|
285
|
-
return this.process.read({
|
|
286
|
-
tags: [
|
|
287
|
-
{ name: 'Action', value: 'Balance' },
|
|
288
|
-
{ name: 'Address', value: address },
|
|
289
|
-
],
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
async getBalances(params) {
|
|
293
|
-
return this.process.read({
|
|
294
|
-
tags: [
|
|
295
|
-
{ name: 'Action', value: 'Paginated-Balances' },
|
|
296
|
-
...paginationParamsToTags(params),
|
|
297
|
-
],
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
async getVault({ address, vaultId, }) {
|
|
301
|
-
return this.process.read({
|
|
302
|
-
tags: [
|
|
303
|
-
{ name: 'Action', value: 'Vault' },
|
|
304
|
-
{ name: 'Address', value: address },
|
|
305
|
-
{ name: 'Vault-Id', value: vaultId },
|
|
306
|
-
],
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
async getVaults(params) {
|
|
310
|
-
return this.process.read({
|
|
311
|
-
tags: [
|
|
312
|
-
{ name: 'Action', value: 'Paginated-Vaults' },
|
|
313
|
-
...paginationParamsToTags(params),
|
|
314
|
-
],
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
async getGateway({ address, }) {
|
|
318
|
-
return this.process.read({
|
|
319
|
-
tags: [
|
|
320
|
-
{ name: 'Action', value: 'Gateway' },
|
|
321
|
-
{ name: 'Address', value: address },
|
|
322
|
-
],
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
async getGatewayDelegates({ address, ...pageParams }) {
|
|
326
|
-
return this.process.read({
|
|
327
|
-
tags: [
|
|
328
|
-
{ name: 'Action', value: 'Paginated-Delegates' },
|
|
329
|
-
{ name: 'Address', value: address },
|
|
330
|
-
...paginationParamsToTags(pageParams),
|
|
331
|
-
],
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
async getGatewayDelegateAllowList({ address, ...pageParams }) {
|
|
335
|
-
return this.process.read({
|
|
336
|
-
tags: [
|
|
337
|
-
{ name: 'Action', value: 'Paginated-Allowed-Delegates' },
|
|
338
|
-
{ name: 'Address', value: address },
|
|
339
|
-
...paginationParamsToTags(pageParams),
|
|
340
|
-
],
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
async getGateways(pageParams) {
|
|
344
|
-
return this.process.read({
|
|
345
|
-
tags: [
|
|
346
|
-
{ name: 'Action', value: 'Paginated-Gateways' },
|
|
347
|
-
...paginationParamsToTags(pageParams),
|
|
348
|
-
],
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
async getCurrentEpoch() {
|
|
352
|
-
return this.process.read({
|
|
353
|
-
tags: [{ name: 'Action', value: 'Epoch' }],
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
async getPrescribedObservers(epoch) {
|
|
357
|
-
const epochIndex = await this.computeEpochIndex(epoch);
|
|
358
|
-
const currentIndex = await this.computeCurrentEpochIndex();
|
|
359
|
-
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
360
|
-
const epochData = await getEpochDataFromGqlWithCUFallback({
|
|
361
|
-
ao: this.process.ao,
|
|
362
|
-
arweave: this.arweave,
|
|
363
|
-
epochIndex: epochIndex,
|
|
364
|
-
processId: this.process.processId,
|
|
365
|
-
});
|
|
366
|
-
if (!epochData) {
|
|
367
|
-
throw new Error('Epoch data not found for epoch index ' + epochIndex);
|
|
368
|
-
}
|
|
369
|
-
return epochData.prescribedObservers;
|
|
370
|
-
}
|
|
371
|
-
const allTags = [
|
|
372
|
-
{ name: 'Action', value: 'Epoch-Prescribed-Observers' },
|
|
373
|
-
{
|
|
374
|
-
name: 'Epoch-Index',
|
|
375
|
-
value: currentIndex.toString(),
|
|
376
|
-
},
|
|
377
|
-
];
|
|
378
|
-
return this.process.read({
|
|
379
|
-
tags: pruneTags(allTags),
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
async getPrescribedNames(epoch) {
|
|
383
|
-
const epochIndex = await this.computeEpochIndex(epoch);
|
|
384
|
-
const currentIndex = await this.computeCurrentEpochIndex();
|
|
385
|
-
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
386
|
-
const epochData = await getEpochDataFromGqlWithCUFallback({
|
|
387
|
-
arweave: this.arweave,
|
|
388
|
-
epochIndex: epochIndex,
|
|
389
|
-
processId: this.process.processId,
|
|
390
|
-
ao: this.process.ao,
|
|
391
|
-
});
|
|
392
|
-
if (!epochData) {
|
|
393
|
-
throw new Error('Epoch data not found for epoch index ' + epochIndex);
|
|
394
|
-
}
|
|
395
|
-
return epochData.prescribedNames;
|
|
396
|
-
}
|
|
397
|
-
const allTags = [
|
|
398
|
-
{ name: 'Action', value: 'Epoch-Prescribed-Names' },
|
|
399
|
-
{
|
|
400
|
-
name: 'Epoch-Index',
|
|
401
|
-
value: currentIndex.toString(),
|
|
402
|
-
},
|
|
403
|
-
];
|
|
404
|
-
return this.process.read({
|
|
405
|
-
tags: pruneTags(allTags),
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
// we need to find the epoch index for the epoch that is currently being distributed and fetch it from gql
|
|
409
|
-
async getObservations(epoch) {
|
|
410
|
-
const epochIndex = await this.computeEpochIndex(epoch);
|
|
411
|
-
const currentIndex = await this.computeCurrentEpochIndex();
|
|
412
|
-
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
413
|
-
const epochData = await getEpochDataFromGqlWithCUFallback({
|
|
414
|
-
arweave: this.arweave,
|
|
415
|
-
epochIndex: epochIndex,
|
|
416
|
-
processId: this.process.processId,
|
|
417
|
-
ao: this.process.ao,
|
|
418
|
-
});
|
|
419
|
-
if (!epochData) {
|
|
420
|
-
throw new Error('Epoch data not found for epoch index ' + epochIndex);
|
|
421
|
-
}
|
|
422
|
-
return epochData.observations;
|
|
423
|
-
}
|
|
424
|
-
// go to the process epoch and fetch the observations
|
|
425
|
-
const allTags = [
|
|
426
|
-
{ name: 'Action', value: 'Epoch-Observations' },
|
|
427
|
-
{
|
|
428
|
-
name: 'Epoch-Index',
|
|
429
|
-
value: currentIndex.toString(),
|
|
430
|
-
},
|
|
431
|
-
];
|
|
432
|
-
return this.process.read({
|
|
433
|
-
tags: pruneTags(allTags),
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
async getDistributions(epoch) {
|
|
437
|
-
const epochIndex = await this.computeEpochIndex(epoch);
|
|
438
|
-
const currentIndex = await this.computeCurrentEpochIndex();
|
|
439
|
-
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
440
|
-
const epochData = await getEpochDataFromGqlWithCUFallback({
|
|
441
|
-
arweave: this.arweave,
|
|
442
|
-
epochIndex: epochIndex,
|
|
443
|
-
processId: this.process.processId,
|
|
444
|
-
ao: this.process.ao,
|
|
445
|
-
});
|
|
446
|
-
if (epochData === undefined) {
|
|
447
|
-
throw new Error('Epoch data not found for epoch index ' + epochIndex);
|
|
448
|
-
}
|
|
449
|
-
return epochData.distributions;
|
|
450
|
-
}
|
|
451
|
-
// go to the process epoch and fetch the distributions
|
|
452
|
-
const allTags = [
|
|
453
|
-
{ name: 'Action', value: 'Epoch-Distributions' },
|
|
454
|
-
{
|
|
455
|
-
name: 'Epoch-Index',
|
|
456
|
-
value: currentIndex.toString(),
|
|
457
|
-
},
|
|
458
|
-
];
|
|
459
|
-
return this.process.read({
|
|
460
|
-
tags: pruneTags(allTags),
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
async getEligibleEpochRewards(epoch, params) {
|
|
464
|
-
const epochIndex = await this.computeEpochIndex(epoch);
|
|
465
|
-
const currentIndex = await this.computeCurrentEpochIndex();
|
|
466
|
-
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
467
|
-
const epochData = await getEpochDataFromGqlWithCUFallback({
|
|
468
|
-
arweave: this.arweave,
|
|
469
|
-
epochIndex: epochIndex,
|
|
470
|
-
processId: this.process.processId,
|
|
471
|
-
ao: this.process.ao,
|
|
472
|
-
});
|
|
473
|
-
if (!epochData) {
|
|
474
|
-
throw new Error('Epoch data not found for epoch index ' + epochIndex);
|
|
475
|
-
}
|
|
476
|
-
return sortAndPaginateEpochDataIntoEligibleDistributions(epochData, params);
|
|
477
|
-
}
|
|
478
|
-
// on current epoch, go to process and fetch the distributions
|
|
479
|
-
const allTags = [
|
|
480
|
-
{ name: 'Action', value: 'Epoch-Eligible-Rewards' },
|
|
481
|
-
...paginationParamsToTags(params),
|
|
482
|
-
];
|
|
483
|
-
return this.process.read({
|
|
484
|
-
tags: pruneTags(allTags),
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
async getTokenCost({ intent, type, years, name, quantity, fromAddress, }) {
|
|
488
|
-
const replacedBuyRecordWithBuyName = intent === 'Buy-Record' ? 'Buy-Name' : intent;
|
|
489
|
-
const allTags = [
|
|
490
|
-
{ name: 'Action', value: 'Token-Cost' },
|
|
491
|
-
{
|
|
492
|
-
name: 'Intent',
|
|
493
|
-
value: replacedBuyRecordWithBuyName,
|
|
494
|
-
},
|
|
495
|
-
{
|
|
496
|
-
name: 'Name',
|
|
497
|
-
value: name,
|
|
498
|
-
},
|
|
499
|
-
{
|
|
500
|
-
name: 'Years',
|
|
501
|
-
value: years?.toString(),
|
|
502
|
-
},
|
|
503
|
-
{
|
|
504
|
-
name: 'Quantity',
|
|
505
|
-
value: quantity?.toString(),
|
|
506
|
-
},
|
|
507
|
-
{
|
|
508
|
-
name: 'Purchase-Type',
|
|
509
|
-
value: type,
|
|
510
|
-
},
|
|
511
|
-
];
|
|
512
|
-
return this.process.read({
|
|
513
|
-
tags: pruneTags(allTags),
|
|
514
|
-
fromAddress,
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
// TODO: Can overload this function to refine different types of cost details params
|
|
518
|
-
async getCostDetails({ intent, type, years, name, quantity, fromAddress, fundFrom, }) {
|
|
519
|
-
const replacedBuyRecordWithBuyName = intent === 'Buy-Record' ? 'Buy-Name' : intent;
|
|
520
|
-
if (fundFrom === 'turbo') {
|
|
521
|
-
const { mARIO, winc } = await this.paymentProvider.getArNSPriceDetails({
|
|
522
|
-
intent: replacedBuyRecordWithBuyName,
|
|
523
|
-
name,
|
|
524
|
-
quantity,
|
|
525
|
-
type,
|
|
526
|
-
years,
|
|
527
|
-
});
|
|
528
|
-
return {
|
|
529
|
-
tokenCost: mARIO.valueOf(),
|
|
530
|
-
wincQty: winc,
|
|
531
|
-
discounts: [],
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
const allTags = [
|
|
535
|
-
{ name: 'Action', value: 'Cost-Details' },
|
|
536
|
-
{
|
|
537
|
-
name: 'Intent',
|
|
538
|
-
value: replacedBuyRecordWithBuyName,
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
name: 'Name',
|
|
542
|
-
value: name,
|
|
543
|
-
},
|
|
544
|
-
{
|
|
545
|
-
name: 'Years',
|
|
546
|
-
value: years?.toString(),
|
|
547
|
-
},
|
|
548
|
-
{
|
|
549
|
-
name: 'Quantity',
|
|
550
|
-
value: quantity?.toString(),
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
name: 'Purchase-Type',
|
|
554
|
-
value: type,
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
name: 'Fund-From',
|
|
558
|
-
value: fundFrom,
|
|
559
|
-
},
|
|
560
|
-
];
|
|
561
|
-
return this.process.read({
|
|
562
|
-
tags: pruneTags(allTags),
|
|
563
|
-
fromAddress,
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
async getRegistrationFees() {
|
|
567
|
-
return this.process.read({
|
|
568
|
-
tags: [{ name: 'Action', value: 'Registration-Fees' }],
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
async getDemandFactor() {
|
|
572
|
-
return this.process.read({
|
|
573
|
-
tags: [{ name: 'Action', value: 'Demand-Factor' }],
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
async getDemandFactorSettings() {
|
|
577
|
-
return this.process.read({
|
|
578
|
-
tags: [{ name: 'Action', value: 'Demand-Factor-Settings' }],
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
async getArNSReturnedNames(params) {
|
|
582
|
-
return this.process.read({
|
|
583
|
-
tags: [
|
|
584
|
-
{ name: 'Action', value: 'Returned-Names' },
|
|
585
|
-
...paginationParamsToTags(params),
|
|
586
|
-
],
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
async getArNSReturnedName({ name, }) {
|
|
590
|
-
const allTags = [
|
|
591
|
-
{ name: 'Action', value: 'Returned-Name' },
|
|
592
|
-
{ name: 'Name', value: name },
|
|
593
|
-
];
|
|
594
|
-
return this.process.read({
|
|
595
|
-
tags: allTags,
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
async getDelegations(params) {
|
|
599
|
-
const allTags = [
|
|
600
|
-
{ name: 'Action', value: 'Paginated-Delegations' },
|
|
601
|
-
{ name: 'Address', value: params.address },
|
|
602
|
-
...paginationParamsToTags(params),
|
|
603
|
-
];
|
|
604
|
-
return this.process.read({
|
|
605
|
-
tags: pruneTags(allTags),
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
async getAllowedDelegates(params) {
|
|
609
|
-
return this.getGatewayDelegateAllowList(params);
|
|
610
|
-
}
|
|
611
|
-
async getGatewayVaults(params) {
|
|
612
|
-
return this.process.read({
|
|
613
|
-
tags: [
|
|
614
|
-
{ name: 'Action', value: 'Paginated-Gateway-Vaults' },
|
|
615
|
-
{ name: 'Address', value: params.address },
|
|
616
|
-
...paginationParamsToTags(params),
|
|
617
|
-
],
|
|
21
|
+
return new SolanaARIOReadable({
|
|
22
|
+
rpc: config.rpc,
|
|
23
|
+
commitment: config.commitment,
|
|
24
|
+
coreProgramId: config.coreProgramId,
|
|
25
|
+
garProgramId: config.garProgramId,
|
|
26
|
+
arnsProgramId: config.arnsProgramId,
|
|
27
|
+
antProgramId: config.antProgramId,
|
|
618
28
|
});
|
|
619
29
|
}
|
|
620
|
-
async getPrimaryNameRequest(params) {
|
|
621
|
-
if (this.hb && (await this.hb.checkHyperBeamCompatibility())) {
|
|
622
|
-
this.logger.debug('Getting primary name request from HyperBEAM', {
|
|
623
|
-
initiator: params.initiator,
|
|
624
|
-
});
|
|
625
|
-
const res = await this.hb
|
|
626
|
-
.compute({
|
|
627
|
-
path: `/primary-names/requests/${params.initiator}`,
|
|
628
|
-
})
|
|
629
|
-
.catch((error) => {
|
|
630
|
-
this.logger.error('Failed to get primary name request from HyperBEAM', {
|
|
631
|
-
cause: error,
|
|
632
|
-
});
|
|
633
|
-
return null;
|
|
634
|
-
});
|
|
635
|
-
if (res !== null) {
|
|
636
|
-
// Ensure initiator is included in the result
|
|
637
|
-
return {
|
|
638
|
-
...res,
|
|
639
|
-
initiator: params.initiator,
|
|
640
|
-
};
|
|
641
|
-
}
|
|
642
|
-
// else fall through to CU read
|
|
643
|
-
this.logger.info('Failed to get primary name request from HyperBEAM, failing over to CU read', { initiator: params.initiator });
|
|
644
|
-
}
|
|
645
|
-
const allTags = [
|
|
646
|
-
{ name: 'Action', value: 'Primary-Name-Request' },
|
|
647
|
-
{
|
|
648
|
-
name: 'Initiator',
|
|
649
|
-
value: params.initiator,
|
|
650
|
-
},
|
|
651
|
-
];
|
|
652
|
-
return this.process.read({
|
|
653
|
-
tags: allTags,
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
async getPrimaryNameRequests(params) {
|
|
657
|
-
return this.process.read({
|
|
658
|
-
tags: [
|
|
659
|
-
{ name: 'Action', value: 'Primary-Name-Requests' },
|
|
660
|
-
...paginationParamsToTags(params),
|
|
661
|
-
],
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
async getPrimaryName(params) {
|
|
665
|
-
if (this.hb && (await this.hb.checkHyperBeamCompatibility())) {
|
|
666
|
-
this.logger.debug('Getting primary name from HyperBEAM', { params });
|
|
667
|
-
try {
|
|
668
|
-
let owner;
|
|
669
|
-
if ('name' in params) {
|
|
670
|
-
// Step 1: Get owner from /primary-names/names/<name>
|
|
671
|
-
owner = await this.hb.compute({
|
|
672
|
-
path: `/primary-names/names/${params.name}`,
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
else {
|
|
676
|
-
// If given address, skip the /names/name query
|
|
677
|
-
owner = params.address;
|
|
678
|
-
}
|
|
679
|
-
// Step 2: Get {name, startTimestamp} from /primary-names/owners/<owner>
|
|
680
|
-
const ownerData = await this.hb.compute({
|
|
681
|
-
path: `/primary-names/owners/${owner}`,
|
|
682
|
-
});
|
|
683
|
-
const name = ownerData.name;
|
|
684
|
-
const startTimestamp = ownerData.startTimestamp;
|
|
685
|
-
// Step 3: Get processId from getArNSRecord
|
|
686
|
-
const record = await this.getArNSRecord({ name });
|
|
687
|
-
const processId = record.processId;
|
|
688
|
-
// Combine all data
|
|
689
|
-
const result = {
|
|
690
|
-
owner,
|
|
691
|
-
name,
|
|
692
|
-
startTimestamp,
|
|
693
|
-
processId,
|
|
694
|
-
};
|
|
695
|
-
return result;
|
|
696
|
-
}
|
|
697
|
-
catch (error) {
|
|
698
|
-
this.logger.error('Failed to get primary name from HyperBEAM', {
|
|
699
|
-
cause: error,
|
|
700
|
-
});
|
|
701
|
-
// Fall through to CU read
|
|
702
|
-
this.logger.info('Failed to get primary name from HyperBEAM, failing over to CU read', { params });
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
const allTags = [
|
|
706
|
-
{ name: 'Action', value: 'Primary-Name' },
|
|
707
|
-
{
|
|
708
|
-
name: 'Address',
|
|
709
|
-
value: params?.address,
|
|
710
|
-
},
|
|
711
|
-
{ name: 'Name', value: params?.name },
|
|
712
|
-
];
|
|
713
|
-
return this.process.read({
|
|
714
|
-
tags: pruneTags(allTags),
|
|
715
|
-
});
|
|
716
|
-
}
|
|
717
|
-
async getPrimaryNames(params) {
|
|
718
|
-
return this.process.read({
|
|
719
|
-
tags: [
|
|
720
|
-
{ name: 'Action', value: 'Primary-Names' },
|
|
721
|
-
...paginationParamsToTags(params),
|
|
722
|
-
],
|
|
723
|
-
});
|
|
724
|
-
}
|
|
725
|
-
/**
|
|
726
|
-
* Get current redelegation fee percentage for address
|
|
727
|
-
*
|
|
728
|
-
* @param {Object} params - The parameters for fetching redelegation fee
|
|
729
|
-
* @param {string} params.address - The address to fetch the fee for
|
|
730
|
-
* @returns {Promise<AoMessageResult>} The redelegation fee result
|
|
731
|
-
*/
|
|
732
|
-
async getRedelegationFee(params) {
|
|
733
|
-
return this.process.read({
|
|
734
|
-
tags: [
|
|
735
|
-
{ name: 'Action', value: 'Redelegation-Fee' },
|
|
736
|
-
{ name: 'Address', value: params.address },
|
|
737
|
-
],
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
async getGatewayRegistrySettings() {
|
|
741
|
-
return this.process.read({
|
|
742
|
-
tags: [{ name: 'Action', value: 'Gateway-Registry-Settings' }],
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
async getAllDelegates(params) {
|
|
746
|
-
return this.process.read({
|
|
747
|
-
tags: [
|
|
748
|
-
{ name: 'Action', value: 'All-Paginated-Delegates' },
|
|
749
|
-
...paginationParamsToTags(params),
|
|
750
|
-
],
|
|
751
|
-
});
|
|
752
|
-
}
|
|
753
|
-
async getAllGatewayVaults(params) {
|
|
754
|
-
return this.process.read({
|
|
755
|
-
tags: [
|
|
756
|
-
{ name: 'Action', value: 'All-Gateway-Vaults' },
|
|
757
|
-
...paginationParamsToTags(params),
|
|
758
|
-
],
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
async resolveArNSName({ name, }) {
|
|
762
|
-
// derive baseName & undername using last underscore
|
|
763
|
-
const lastUnderscore = name.lastIndexOf('_');
|
|
764
|
-
const baseName = lastUnderscore === -1 ? name : name.slice(lastUnderscore + 1);
|
|
765
|
-
const undername = lastUnderscore === -1 ? '@' : name.slice(0, lastUnderscore);
|
|
766
|
-
// guard against missing or unregistered ARNS record
|
|
767
|
-
const nameData = await this.getArNSRecord({ name: baseName });
|
|
768
|
-
if (nameData === undefined || nameData.processId === undefined) {
|
|
769
|
-
throw new Error(`Base ArNS name ${baseName} not found on ARIO contract (${this.process.processId}).`);
|
|
770
|
-
}
|
|
771
|
-
const ant = ANT.init({
|
|
772
|
-
process: new AOProcess({
|
|
773
|
-
ao: this.process.ao,
|
|
774
|
-
processId: nameData.processId,
|
|
775
|
-
}),
|
|
776
|
-
hyperbeamUrl: this.hyperbeamUrl,
|
|
777
|
-
});
|
|
778
|
-
const [owner, antRecord] = await Promise.all([
|
|
779
|
-
ant.getOwner(),
|
|
780
|
-
ant.getRecord({ undername }),
|
|
781
|
-
]);
|
|
782
|
-
if (antRecord === undefined) {
|
|
783
|
-
throw new Error(`Record for ${undername} not found on ANT.`);
|
|
784
|
-
}
|
|
785
|
-
if (antRecord.ttlSeconds === undefined ||
|
|
786
|
-
antRecord.transactionId === undefined) {
|
|
787
|
-
throw new Error(`Invalid record on ANT. Must have ttlSeconds and transactionId. Record: ${JSON.stringify(antRecord)}`);
|
|
788
|
-
}
|
|
789
|
-
return {
|
|
790
|
-
name,
|
|
791
|
-
owner,
|
|
792
|
-
txId: antRecord.transactionId,
|
|
793
|
-
ttlSeconds: antRecord.ttlSeconds,
|
|
794
|
-
priority: antRecord.priority,
|
|
795
|
-
// NOTE: we may want return the actual index of the record based on sorting
|
|
796
|
-
// in case ANT tries to set duplicate priority values to get around undername limits
|
|
797
|
-
processId: nameData.processId,
|
|
798
|
-
undernameLimit: nameData.undernameLimit,
|
|
799
|
-
type: nameData.type,
|
|
800
|
-
};
|
|
801
|
-
}
|
|
802
|
-
/**
|
|
803
|
-
* Get all ARNS names associated with an address using the provided ANT registry address.
|
|
804
|
-
*
|
|
805
|
-
* By default it will use the mainnet ANT registry address.
|
|
806
|
-
*
|
|
807
|
-
* @param {Object} params - The parameters for fetching ARNS names
|
|
808
|
-
* @param {string} params.address - The address to fetch the ARNS names for
|
|
809
|
-
* @returns {Promise<AoArNSNameData[]>} The ARNS names associated with the address
|
|
810
|
-
*/
|
|
811
|
-
async getArNSRecordsForAddress(params) {
|
|
812
|
-
const { antRegistryProcessId = ANT_REGISTRY_ID, address } = params;
|
|
813
|
-
const antRegistry = ANTRegistry.init({
|
|
814
|
-
hyperbeamUrl: this.hyperbeamUrl,
|
|
815
|
-
process: new AOProcess({
|
|
816
|
-
ao: this.process.ao,
|
|
817
|
-
processId: antRegistryProcessId,
|
|
818
|
-
}),
|
|
819
|
-
});
|
|
820
|
-
// Note: there could be a race condition here if the ACL changes during pagination requests, resulting in different results from the `getArNSRecords`.
|
|
821
|
-
// This is an unlikely scenario, so to give the client control, and keep this API consistent with other ArNS APIs, we refetch the ACL for each page, and
|
|
822
|
-
// return paginated results.
|
|
823
|
-
const { Controlled = [], Owned = [] } = await antRegistry.accessControlList({
|
|
824
|
-
address,
|
|
825
|
-
});
|
|
826
|
-
const allProcessIds = new Set([...Controlled, ...Owned]);
|
|
827
|
-
if (allProcessIds.size === 0) {
|
|
828
|
-
return {
|
|
829
|
-
items: [],
|
|
830
|
-
hasMore: false,
|
|
831
|
-
nextCursor: undefined,
|
|
832
|
-
limit: params.limit ?? 1000,
|
|
833
|
-
totalItems: 0,
|
|
834
|
-
sortOrder: params.sortOrder ?? 'asc',
|
|
835
|
-
};
|
|
836
|
-
}
|
|
837
|
-
const currentPage = await this.getArNSRecords({
|
|
838
|
-
...params,
|
|
839
|
-
filters: {
|
|
840
|
-
// NOTE: we confirmed that dry-runs are not limited to the same tag limits as data-items.
|
|
841
|
-
// Should this change, we'll need to batch the requests.
|
|
842
|
-
processId: Array.from(allProcessIds),
|
|
843
|
-
},
|
|
844
|
-
});
|
|
845
|
-
return currentPage;
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
export class ARIOWriteable extends ARIOReadable {
|
|
849
|
-
signer;
|
|
850
|
-
paymentProvider;
|
|
851
|
-
constructor({ signer, paymentUrl, ...config }) {
|
|
852
|
-
if (config === undefined) {
|
|
853
|
-
super({
|
|
854
|
-
process: new AOProcess({
|
|
855
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
856
|
-
}),
|
|
857
|
-
});
|
|
858
|
-
}
|
|
859
|
-
else {
|
|
860
|
-
super(config);
|
|
861
|
-
}
|
|
862
|
-
this.signer = createAoSigner(signer);
|
|
863
|
-
this.paymentProvider = TurboArNSPaymentFactory.init({
|
|
864
|
-
signer: isTurboArNSSigner(signer) ? signer : undefined,
|
|
865
|
-
paymentUrl,
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
|
-
async transfer({ target, qty, }, options) {
|
|
869
|
-
const { tags = [] } = options || {};
|
|
870
|
-
return this.process.send({
|
|
871
|
-
tags: [
|
|
872
|
-
...tags,
|
|
873
|
-
{ name: 'Action', value: 'Transfer' },
|
|
874
|
-
{
|
|
875
|
-
name: 'Recipient',
|
|
876
|
-
value: target,
|
|
877
|
-
},
|
|
878
|
-
{
|
|
879
|
-
name: 'Quantity',
|
|
880
|
-
value: qty.valueOf().toString(),
|
|
881
|
-
},
|
|
882
|
-
],
|
|
883
|
-
signer: this.signer,
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
async vaultedTransfer({ recipient, quantity, lockLengthMs, revokable = false, }, options) {
|
|
887
|
-
const { tags = [] } = options || {};
|
|
888
|
-
return this.process.send({
|
|
889
|
-
tags: [
|
|
890
|
-
...tags,
|
|
891
|
-
{ name: 'Action', value: 'Vaulted-Transfer' },
|
|
892
|
-
{ name: 'Recipient', value: recipient },
|
|
893
|
-
{ name: 'Quantity', value: quantity.toString() },
|
|
894
|
-
{ name: 'Lock-Length', value: lockLengthMs.toString() },
|
|
895
|
-
{ name: 'Revokable', value: `${revokable}` },
|
|
896
|
-
],
|
|
897
|
-
signer: this.signer,
|
|
898
|
-
});
|
|
899
|
-
}
|
|
900
|
-
async revokeVault({ vaultId, recipient }, options) {
|
|
901
|
-
const { tags = [] } = options || {};
|
|
902
|
-
return this.process.send({
|
|
903
|
-
tags: [
|
|
904
|
-
...tags,
|
|
905
|
-
{ name: 'Action', value: 'Revoke-Vault' },
|
|
906
|
-
{ name: 'Vault-Id', value: vaultId },
|
|
907
|
-
{ name: 'Recipient', value: recipient },
|
|
908
|
-
],
|
|
909
|
-
signer: this.signer,
|
|
910
|
-
});
|
|
911
|
-
}
|
|
912
|
-
async createVault({ lockLengthMs, quantity }, options) {
|
|
913
|
-
const { tags = [] } = options || {};
|
|
914
|
-
return this.process.send({
|
|
915
|
-
tags: [
|
|
916
|
-
...tags,
|
|
917
|
-
{ name: 'Action', value: 'Create-Vault' },
|
|
918
|
-
{ name: 'Lock-Length', value: lockLengthMs.toString() },
|
|
919
|
-
{ name: 'Quantity', value: quantity.toString() },
|
|
920
|
-
],
|
|
921
|
-
signer: this.signer,
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
async extendVault({ vaultId, extendLengthMs }, options) {
|
|
925
|
-
const { tags = [] } = options || {};
|
|
926
|
-
return this.process.send({
|
|
927
|
-
tags: [
|
|
928
|
-
...tags,
|
|
929
|
-
{ name: 'Action', value: 'Extend-Vault' },
|
|
930
|
-
{ name: 'Vault-Id', value: vaultId },
|
|
931
|
-
{ name: 'Extend-Length', value: extendLengthMs.toString() },
|
|
932
|
-
],
|
|
933
|
-
signer: this.signer,
|
|
934
|
-
});
|
|
935
|
-
}
|
|
936
|
-
async increaseVault({ vaultId, quantity }, options) {
|
|
937
|
-
const { tags = [] } = options || {};
|
|
938
|
-
return this.process.send({
|
|
939
|
-
tags: [
|
|
940
|
-
...tags,
|
|
941
|
-
{ name: 'Action', value: 'Increase-Vault' },
|
|
942
|
-
{ name: 'Vault-Id', value: vaultId },
|
|
943
|
-
{ name: 'Quantity', value: quantity.toString() },
|
|
944
|
-
],
|
|
945
|
-
signer: this.signer,
|
|
946
|
-
});
|
|
947
|
-
}
|
|
948
|
-
async joinNetwork({ operatorStake, allowDelegatedStaking, allowedDelegates, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, services, }, options) {
|
|
949
|
-
const { tags = [] } = options || {};
|
|
950
|
-
const allTags = [
|
|
951
|
-
...tags,
|
|
952
|
-
{ name: 'Action', value: 'Join-Network' },
|
|
953
|
-
{
|
|
954
|
-
name: 'Operator-Stake',
|
|
955
|
-
value: operatorStake.valueOf().toString(),
|
|
956
|
-
},
|
|
957
|
-
{
|
|
958
|
-
name: 'Allow-Delegated-Staking',
|
|
959
|
-
value: allowDelegatedStaking?.toString(),
|
|
960
|
-
},
|
|
961
|
-
{
|
|
962
|
-
name: 'Allowed-Delegates',
|
|
963
|
-
value: allowedDelegates?.join(','),
|
|
964
|
-
},
|
|
965
|
-
{
|
|
966
|
-
name: 'Delegate-Reward-Share-Ratio',
|
|
967
|
-
value: delegateRewardShareRatio?.toString(),
|
|
968
|
-
},
|
|
969
|
-
{
|
|
970
|
-
name: 'FQDN',
|
|
971
|
-
value: fqdn,
|
|
972
|
-
},
|
|
973
|
-
{
|
|
974
|
-
name: 'Label',
|
|
975
|
-
value: label,
|
|
976
|
-
},
|
|
977
|
-
{
|
|
978
|
-
name: 'Min-Delegated-Stake',
|
|
979
|
-
value: minDelegatedStake?.valueOf().toString(),
|
|
980
|
-
},
|
|
981
|
-
{
|
|
982
|
-
name: 'Note',
|
|
983
|
-
value: note,
|
|
984
|
-
},
|
|
985
|
-
{
|
|
986
|
-
name: 'Port',
|
|
987
|
-
value: port?.toString(),
|
|
988
|
-
},
|
|
989
|
-
{
|
|
990
|
-
name: 'Properties',
|
|
991
|
-
value: properties,
|
|
992
|
-
},
|
|
993
|
-
{
|
|
994
|
-
name: 'Protocol',
|
|
995
|
-
value: protocol,
|
|
996
|
-
},
|
|
997
|
-
{
|
|
998
|
-
name: 'Auto-Stake',
|
|
999
|
-
value: autoStake?.toString(),
|
|
1000
|
-
},
|
|
1001
|
-
{
|
|
1002
|
-
name: 'Observer-Address',
|
|
1003
|
-
value: observerAddress,
|
|
1004
|
-
},
|
|
1005
|
-
{
|
|
1006
|
-
name: 'Services',
|
|
1007
|
-
value: services ? JSON.stringify(services) : undefined,
|
|
1008
|
-
},
|
|
1009
|
-
];
|
|
1010
|
-
return this.process.send({
|
|
1011
|
-
signer: this.signer,
|
|
1012
|
-
tags: pruneTags(allTags),
|
|
1013
|
-
});
|
|
1014
|
-
}
|
|
1015
|
-
async leaveNetwork(options) {
|
|
1016
|
-
const { tags = [] } = options || {};
|
|
1017
|
-
return this.process.send({
|
|
1018
|
-
signer: this.signer,
|
|
1019
|
-
tags: [...tags, { name: 'Action', value: 'Leave-Network' }],
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
|
-
async updateGatewaySettings({ allowDelegatedStaking, allowedDelegates, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, services, }, options) {
|
|
1023
|
-
const { tags = [] } = options || {};
|
|
1024
|
-
const allTags = [
|
|
1025
|
-
...tags,
|
|
1026
|
-
{ name: 'Action', value: 'Update-Gateway-Settings' },
|
|
1027
|
-
{ name: 'Label', value: label },
|
|
1028
|
-
{ name: 'Note', value: note },
|
|
1029
|
-
{ name: 'FQDN', value: fqdn },
|
|
1030
|
-
{ name: 'Port', value: port?.toString() },
|
|
1031
|
-
{ name: 'Properties', value: properties },
|
|
1032
|
-
{ name: 'Protocol', value: protocol },
|
|
1033
|
-
{ name: 'Observer-Address', value: observerAddress },
|
|
1034
|
-
{
|
|
1035
|
-
name: 'Allow-Delegated-Staking',
|
|
1036
|
-
value: allowDelegatedStaking?.toString(),
|
|
1037
|
-
},
|
|
1038
|
-
{
|
|
1039
|
-
name: 'Allowed-Delegates',
|
|
1040
|
-
value: allowedDelegates?.join(','),
|
|
1041
|
-
},
|
|
1042
|
-
{
|
|
1043
|
-
name: 'Delegate-Reward-Share-Ratio',
|
|
1044
|
-
value: delegateRewardShareRatio?.toString(),
|
|
1045
|
-
},
|
|
1046
|
-
{
|
|
1047
|
-
name: 'Min-Delegated-Stake',
|
|
1048
|
-
value: minDelegatedStake?.valueOf().toString(),
|
|
1049
|
-
},
|
|
1050
|
-
{ name: 'Auto-Stake', value: autoStake?.toString() },
|
|
1051
|
-
{
|
|
1052
|
-
name: 'Services',
|
|
1053
|
-
value: services ? JSON.stringify(services) : undefined,
|
|
1054
|
-
},
|
|
1055
|
-
];
|
|
1056
|
-
return this.process.send({
|
|
1057
|
-
signer: this.signer,
|
|
1058
|
-
tags: pruneTags(allTags),
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
async delegateStake(params, options) {
|
|
1062
|
-
const { tags = [] } = options || {};
|
|
1063
|
-
return this.process.send({
|
|
1064
|
-
signer: this.signer,
|
|
1065
|
-
tags: [
|
|
1066
|
-
...tags,
|
|
1067
|
-
{ name: 'Action', value: 'Delegate-Stake' },
|
|
1068
|
-
{ name: 'Target', value: params.target },
|
|
1069
|
-
{ name: 'Quantity', value: params.stakeQty.valueOf().toString() },
|
|
1070
|
-
],
|
|
1071
|
-
});
|
|
1072
|
-
}
|
|
1073
|
-
async decreaseDelegateStake(params, options) {
|
|
1074
|
-
const { tags = [] } = options || {};
|
|
1075
|
-
return this.process.send({
|
|
1076
|
-
signer: this.signer,
|
|
1077
|
-
tags: [
|
|
1078
|
-
...tags,
|
|
1079
|
-
{ name: 'Action', value: 'Decrease-Delegate-Stake' },
|
|
1080
|
-
{ name: 'Target', value: params.target },
|
|
1081
|
-
{ name: 'Quantity', value: params.decreaseQty.valueOf().toString() },
|
|
1082
|
-
{ name: 'Instant', value: `${params.instant || false}` },
|
|
1083
|
-
],
|
|
1084
|
-
});
|
|
1085
|
-
}
|
|
1086
|
-
/**
|
|
1087
|
-
* Initiates an instant withdrawal from a gateway.
|
|
1088
|
-
*
|
|
1089
|
-
* @param {Object} params - The parameters for initiating an instant withdrawal
|
|
1090
|
-
* @param {string} params.address - The gateway address of the withdrawal, if not provided, the signer's address will be used
|
|
1091
|
-
* @param {string} params.vaultId - The vault ID of the withdrawal
|
|
1092
|
-
* @returns {Promise<AoMessageResult>} The result of the withdrawal
|
|
1093
|
-
*/
|
|
1094
|
-
async instantWithdrawal(params, options) {
|
|
1095
|
-
const { tags = [] } = options || {};
|
|
1096
|
-
const allTags = [
|
|
1097
|
-
...tags,
|
|
1098
|
-
{ name: 'Action', value: 'Instant-Withdrawal' },
|
|
1099
|
-
{ name: 'Vault-Id', value: params.vaultId },
|
|
1100
|
-
{ name: 'Address', value: params.gatewayAddress },
|
|
1101
|
-
];
|
|
1102
|
-
return this.process.send({
|
|
1103
|
-
signer: this.signer,
|
|
1104
|
-
tags: pruneTags(allTags),
|
|
1105
|
-
});
|
|
1106
|
-
}
|
|
1107
|
-
async increaseOperatorStake(params, options) {
|
|
1108
|
-
const { tags = [] } = options || {};
|
|
1109
|
-
return this.process.send({
|
|
1110
|
-
signer: this.signer,
|
|
1111
|
-
tags: [
|
|
1112
|
-
...tags,
|
|
1113
|
-
{ name: 'Action', value: 'Increase-Operator-Stake' },
|
|
1114
|
-
{ name: 'Quantity', value: params.increaseQty.valueOf().toString() },
|
|
1115
|
-
],
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
async decreaseOperatorStake(params, options) {
|
|
1119
|
-
const { tags = [] } = options || {};
|
|
1120
|
-
return this.process.send({
|
|
1121
|
-
signer: this.signer,
|
|
1122
|
-
tags: [
|
|
1123
|
-
...tags,
|
|
1124
|
-
{ name: 'Action', value: 'Decrease-Operator-Stake' },
|
|
1125
|
-
{ name: 'Quantity', value: params.decreaseQty.valueOf().toString() },
|
|
1126
|
-
{ name: 'Instant', value: `${params.instant || false}` },
|
|
1127
|
-
],
|
|
1128
|
-
});
|
|
1129
|
-
}
|
|
1130
|
-
async saveObservations(params, options) {
|
|
1131
|
-
const { tags = [] } = options || {};
|
|
1132
|
-
return this.process.send({
|
|
1133
|
-
signer: this.signer,
|
|
1134
|
-
tags: [
|
|
1135
|
-
...tags,
|
|
1136
|
-
{ name: 'Action', value: 'Save-Observations' },
|
|
1137
|
-
{
|
|
1138
|
-
name: 'Report-Tx-Id',
|
|
1139
|
-
value: params.reportTxId,
|
|
1140
|
-
},
|
|
1141
|
-
{
|
|
1142
|
-
name: 'Failed-Gateways',
|
|
1143
|
-
value: params.failedGateways.join(','),
|
|
1144
|
-
},
|
|
1145
|
-
],
|
|
1146
|
-
});
|
|
1147
|
-
}
|
|
1148
|
-
async buyRecord(params, options) {
|
|
1149
|
-
// spawn a new ANT if not provided
|
|
1150
|
-
if (params.processId === undefined) {
|
|
1151
|
-
try {
|
|
1152
|
-
// if a Name tag is provided, use it. Else, default to the arns name being purchased.
|
|
1153
|
-
const { nameTag, otherTags } = (options?.tags || []).reduce((acc, tag) => {
|
|
1154
|
-
if (tag.name === 'Name') {
|
|
1155
|
-
acc.nameTag = tag;
|
|
1156
|
-
}
|
|
1157
|
-
else {
|
|
1158
|
-
acc.otherTags.push(tag);
|
|
1159
|
-
}
|
|
1160
|
-
return acc;
|
|
1161
|
-
}, { nameTag: { name: 'Name', value: params.name }, otherTags: [] });
|
|
1162
|
-
params.processId = await ANT.spawn({
|
|
1163
|
-
signer: this.signer,
|
|
1164
|
-
ao: this.process.ao,
|
|
1165
|
-
logger: this.logger,
|
|
1166
|
-
// This lets AOS set the ArNS name as the Name in lua state
|
|
1167
|
-
tags: [nameTag, ...otherTags],
|
|
1168
|
-
onSigningProgress: options?.onSigningProgress,
|
|
1169
|
-
});
|
|
1170
|
-
}
|
|
1171
|
-
catch (error) {
|
|
1172
|
-
this.logger.error('Failed to spawn ANT for name purchase.', {
|
|
1173
|
-
error,
|
|
1174
|
-
});
|
|
1175
|
-
throw error;
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
options?.onSigningProgress?.('buying-name', {
|
|
1179
|
-
name: params.name,
|
|
1180
|
-
years: params.years,
|
|
1181
|
-
type: params.type,
|
|
1182
|
-
processId: params.processId,
|
|
1183
|
-
fundFrom: params.fundFrom,
|
|
1184
|
-
referrer: params.referrer,
|
|
1185
|
-
});
|
|
1186
|
-
// pay with turbo credits if available
|
|
1187
|
-
if (params.fundFrom === 'turbo') {
|
|
1188
|
-
if (!(this.paymentProvider instanceof TurboArNSPaymentProviderAuthenticated)) {
|
|
1189
|
-
throw new Error('Turbo funding is not supported for this payment provider');
|
|
1190
|
-
}
|
|
1191
|
-
return this.paymentProvider.initiateArNSPurchase({
|
|
1192
|
-
intent: 'Buy-Name',
|
|
1193
|
-
name: params.name,
|
|
1194
|
-
years: params.years,
|
|
1195
|
-
type: params.type,
|
|
1196
|
-
processId: params.processId,
|
|
1197
|
-
paidBy: params.paidBy,
|
|
1198
|
-
});
|
|
1199
|
-
}
|
|
1200
|
-
const { tags = [] } = options || {};
|
|
1201
|
-
const allTags = [
|
|
1202
|
-
...tags,
|
|
1203
|
-
{ name: 'Action', value: 'Buy-Name' },
|
|
1204
|
-
{ name: 'Name', value: params.name },
|
|
1205
|
-
{ name: 'Years', value: params.years?.toString() ?? '1' },
|
|
1206
|
-
{ name: 'Process-Id', value: params.processId },
|
|
1207
|
-
{ name: 'Purchase-Type', value: params.type || 'lease' },
|
|
1208
|
-
{ name: 'Fund-From', value: params.fundFrom },
|
|
1209
|
-
{ name: 'Referrer', value: params.referrer },
|
|
1210
|
-
];
|
|
1211
|
-
return this.process.send({
|
|
1212
|
-
signer: this.signer,
|
|
1213
|
-
tags: pruneTags(allTags),
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1216
|
-
/**
|
|
1217
|
-
* Upgrades an existing leased record to a permabuy.
|
|
1218
|
-
*
|
|
1219
|
-
* @param {Object} params - The parameters for upgrading a record
|
|
1220
|
-
* @param {string} params.name - The name of the record to upgrade
|
|
1221
|
-
* @param {Object} [options] - The options for the upgrade
|
|
1222
|
-
* @returns {Promise<AoMessageResult>} The result of the upgrade
|
|
1223
|
-
*/
|
|
1224
|
-
async upgradeRecord(params, options) {
|
|
1225
|
-
if (params.fundFrom === 'turbo') {
|
|
1226
|
-
if (!(this.paymentProvider instanceof TurboArNSPaymentProviderAuthenticated)) {
|
|
1227
|
-
throw new Error('Turbo funding is not supported for this payment provider');
|
|
1228
|
-
}
|
|
1229
|
-
return this.paymentProvider.initiateArNSPurchase({
|
|
1230
|
-
intent: 'Upgrade-Name',
|
|
1231
|
-
name: params.name,
|
|
1232
|
-
});
|
|
1233
|
-
}
|
|
1234
|
-
const { tags = [] } = options || {};
|
|
1235
|
-
const allTags = [
|
|
1236
|
-
...tags,
|
|
1237
|
-
{ name: 'Action', value: 'Upgrade-Name' },
|
|
1238
|
-
{ name: 'Name', value: params.name },
|
|
1239
|
-
{ name: 'Fund-From', value: params.fundFrom },
|
|
1240
|
-
{ name: 'Referrer', value: params.referrer },
|
|
1241
|
-
];
|
|
1242
|
-
return this.process.send({
|
|
1243
|
-
signer: this.signer,
|
|
1244
|
-
tags: pruneTags(allTags),
|
|
1245
|
-
});
|
|
1246
|
-
}
|
|
1247
|
-
/**
|
|
1248
|
-
* Extends the lease of an existing leased record.
|
|
1249
|
-
*
|
|
1250
|
-
* @param {Object} params - The parameters for extending a lease
|
|
1251
|
-
* @param {string} params.name - The name of the record to extend
|
|
1252
|
-
* @param {number} params.years - The number of years to extend the lease
|
|
1253
|
-
* @param {Object} [options] - The options for the extension
|
|
1254
|
-
* @returns {Promise<AoMessageResult>} The result of the extension
|
|
1255
|
-
*/
|
|
1256
|
-
async extendLease(params, options) {
|
|
1257
|
-
if (params.fundFrom === 'turbo') {
|
|
1258
|
-
if (!(this.paymentProvider instanceof TurboArNSPaymentProviderAuthenticated)) {
|
|
1259
|
-
throw new Error('Turbo funding is not supported for this payment provider');
|
|
1260
|
-
}
|
|
1261
|
-
return this.paymentProvider.initiateArNSPurchase({
|
|
1262
|
-
intent: 'Extend-Lease',
|
|
1263
|
-
name: params.name,
|
|
1264
|
-
years: params.years,
|
|
1265
|
-
});
|
|
1266
|
-
}
|
|
1267
|
-
const { tags = [] } = options || {};
|
|
1268
|
-
const allTags = [
|
|
1269
|
-
...tags,
|
|
1270
|
-
{ name: 'Action', value: 'Extend-Lease' },
|
|
1271
|
-
{ name: 'Name', value: params.name },
|
|
1272
|
-
{ name: 'Years', value: params.years.toString() },
|
|
1273
|
-
{ name: 'Fund-From', value: params.fundFrom },
|
|
1274
|
-
{ name: 'Referrer', value: params.referrer },
|
|
1275
|
-
];
|
|
1276
|
-
return this.process.send({
|
|
1277
|
-
signer: this.signer,
|
|
1278
|
-
tags: pruneTags(allTags),
|
|
1279
|
-
});
|
|
1280
|
-
}
|
|
1281
|
-
async increaseUndernameLimit(params, options) {
|
|
1282
|
-
if (params.fundFrom === 'turbo') {
|
|
1283
|
-
if (!(this.paymentProvider instanceof TurboArNSPaymentProviderAuthenticated)) {
|
|
1284
|
-
throw new Error('Turbo funding is not supported for this payment provider');
|
|
1285
|
-
}
|
|
1286
|
-
return this.paymentProvider.initiateArNSPurchase({
|
|
1287
|
-
intent: 'Increase-Undername-Limit',
|
|
1288
|
-
quantity: params.increaseCount,
|
|
1289
|
-
name: params.name,
|
|
1290
|
-
});
|
|
1291
|
-
}
|
|
1292
|
-
const { tags = [] } = options || {};
|
|
1293
|
-
const allTags = [
|
|
1294
|
-
...tags,
|
|
1295
|
-
{ name: 'Action', value: 'Increase-Undername-Limit' },
|
|
1296
|
-
{ name: 'Name', value: params.name },
|
|
1297
|
-
{ name: 'Quantity', value: params.increaseCount.toString() },
|
|
1298
|
-
{ name: 'Fund-From', value: params.fundFrom },
|
|
1299
|
-
{ name: 'Referrer', value: params.referrer },
|
|
1300
|
-
];
|
|
1301
|
-
return this.process.send({
|
|
1302
|
-
signer: this.signer,
|
|
1303
|
-
tags: pruneTags(allTags),
|
|
1304
|
-
});
|
|
1305
|
-
}
|
|
1306
|
-
/**
|
|
1307
|
-
* Cancel a withdrawal from a gateway.
|
|
1308
|
-
*
|
|
1309
|
-
* @param {Object} params - The parameters for cancelling a withdrawal
|
|
1310
|
-
* @param {string} [params.address] - The address of the withdrawal (optional). If not provided, the signer's address will be used.
|
|
1311
|
-
* @param {string} params.vaultId - The vault ID of the withdrawal.
|
|
1312
|
-
* @param {Object} [options] - The options for the cancellation
|
|
1313
|
-
* @returns {Promise<AoMessageResult>} The result of the cancellation
|
|
1314
|
-
*/
|
|
1315
|
-
async cancelWithdrawal(params, options) {
|
|
1316
|
-
const { tags = [] } = options || {};
|
|
1317
|
-
const allTags = [
|
|
1318
|
-
...tags,
|
|
1319
|
-
{ name: 'Action', value: 'Cancel-Withdrawal' },
|
|
1320
|
-
{ name: 'Vault-Id', value: params.vaultId },
|
|
1321
|
-
{ name: 'Address', value: params.gatewayAddress },
|
|
1322
|
-
];
|
|
1323
|
-
return this.process.send({
|
|
1324
|
-
signer: this.signer,
|
|
1325
|
-
tags: pruneTags(allTags),
|
|
1326
|
-
});
|
|
1327
|
-
}
|
|
1328
|
-
async requestPrimaryName(params, options) {
|
|
1329
|
-
if (params.fundFrom === 'turbo') {
|
|
1330
|
-
throw new Error('Turbo funding is not yet supported for primary name requests');
|
|
1331
|
-
}
|
|
1332
|
-
const { tags = [] } = options || {};
|
|
1333
|
-
const allTags = [
|
|
1334
|
-
...tags,
|
|
1335
|
-
{ name: 'Action', value: 'Request-Primary-Name' },
|
|
1336
|
-
{ name: 'Name', value: params.name },
|
|
1337
|
-
{ name: 'Fund-From', value: params.fundFrom },
|
|
1338
|
-
];
|
|
1339
|
-
return this.process.send({
|
|
1340
|
-
signer: this.signer,
|
|
1341
|
-
tags: pruneTags(allTags),
|
|
1342
|
-
});
|
|
1343
|
-
}
|
|
1344
|
-
async setPrimaryName(params, options) {
|
|
1345
|
-
options?.onSigningProgress?.('requesting-primary-name', {
|
|
1346
|
-
name: params.name,
|
|
1347
|
-
fundFrom: params.fundFrom,
|
|
1348
|
-
referrer: params.referrer,
|
|
1349
|
-
});
|
|
1350
|
-
// create the primary name request, if it already exists, get the request and base name owner
|
|
1351
|
-
const requestResult = await this.requestPrimaryName(params, options).catch(async (error) => {
|
|
1352
|
-
// check for the error message, it may be due to the request already being made
|
|
1353
|
-
if (error.message.includes('already exists')) {
|
|
1354
|
-
// parse out the initiator from the error message ` "Primary name request by '" .. initiator .. "' for '" .. name .. "' already exists"
|
|
1355
|
-
const initiator = error.message.match(/by '([^']+)'/)?.[1];
|
|
1356
|
-
if (initiator === undefined) {
|
|
1357
|
-
throw error;
|
|
1358
|
-
}
|
|
1359
|
-
options?.onSigningProgress?.('request-already-exists', {
|
|
1360
|
-
name: params.name,
|
|
1361
|
-
initiator,
|
|
1362
|
-
});
|
|
1363
|
-
// get the primary name request
|
|
1364
|
-
const primaryNameRequest = await this.getPrimaryNameRequest({
|
|
1365
|
-
initiator,
|
|
1366
|
-
});
|
|
1367
|
-
// check the name exists
|
|
1368
|
-
const arnsRecord = await this.getArNSRecord({ name: params.name });
|
|
1369
|
-
if (arnsRecord === undefined) {
|
|
1370
|
-
throw new Error(`ARNS name '${params.name}' does not exist`);
|
|
1371
|
-
}
|
|
1372
|
-
if (primaryNameRequest.initiator !== initiator) {
|
|
1373
|
-
throw new Error(`Primary name request for name '${params.name}' was not approved`);
|
|
1374
|
-
}
|
|
1375
|
-
return {
|
|
1376
|
-
id: 'stub-id', // stub-id to indicate that the request already exists
|
|
1377
|
-
result: {
|
|
1378
|
-
// this is a partial stub of the AoCreatePrimaryNameRequest result
|
|
1379
|
-
// we only need the request and base name owner for the approval
|
|
1380
|
-
request: primaryNameRequest,
|
|
1381
|
-
baseNameOwner: arnsRecord.processId,
|
|
1382
|
-
fundingPlan: {
|
|
1383
|
-
address: initiator,
|
|
1384
|
-
},
|
|
1385
|
-
},
|
|
1386
|
-
};
|
|
1387
|
-
}
|
|
1388
|
-
// throw any other errors from the contract
|
|
1389
|
-
throw error;
|
|
1390
|
-
});
|
|
1391
|
-
// the result is either a new primary name request or an existing one
|
|
1392
|
-
// for new primary name requests the result includes the request, funding plan, and base name owner
|
|
1393
|
-
// for existing primary name requests the result includes just the request and base name owner (see above)
|
|
1394
|
-
const primaryNameRequest = requestResult.result;
|
|
1395
|
-
const antProcessId = primaryNameRequest?.baseNameOwner;
|
|
1396
|
-
const initiator = primaryNameRequest?.fundingPlan?.address;
|
|
1397
|
-
if (primaryNameRequest === undefined ||
|
|
1398
|
-
initiator === undefined ||
|
|
1399
|
-
antProcessId === undefined) {
|
|
1400
|
-
throw new Error(`Failed to request primary name ${params.name} for ${initiator} owned by ${antProcessId} process`);
|
|
1401
|
-
}
|
|
1402
|
-
options?.onSigningProgress?.('approving-request', {
|
|
1403
|
-
name: params.name,
|
|
1404
|
-
processId: antProcessId,
|
|
1405
|
-
request: primaryNameRequest.request,
|
|
1406
|
-
});
|
|
1407
|
-
const antClient = ANT.init({
|
|
1408
|
-
process: new AOProcess({
|
|
1409
|
-
processId: antProcessId,
|
|
1410
|
-
ao: this.process.ao,
|
|
1411
|
-
}),
|
|
1412
|
-
signer: this.signer,
|
|
1413
|
-
hyperbeamUrl: this.hyperbeamUrl,
|
|
1414
|
-
});
|
|
1415
|
-
// approve the primary name request with the ant
|
|
1416
|
-
const approveResult = await antClient.approvePrimaryNameRequest({
|
|
1417
|
-
name: params.name,
|
|
1418
|
-
address: initiator,
|
|
1419
|
-
arioProcessId: this.process.processId,
|
|
1420
|
-
}, options);
|
|
1421
|
-
return approveResult;
|
|
1422
|
-
}
|
|
1423
|
-
/**
|
|
1424
|
-
* Redelegate stake from one gateway to another gateway.
|
|
1425
|
-
*
|
|
1426
|
-
* @param {Object} params - The parameters for redelegating stake
|
|
1427
|
-
* @param {string} params.target - The target gateway address
|
|
1428
|
-
* @param {string} params.source - The source gateway address
|
|
1429
|
-
* @param {number} params.stakeQty - The quantity of stake to redelegate
|
|
1430
|
-
* @param {string} params.vaultId - An optional vault ID to redelegate from
|
|
1431
|
-
* @param {Object} [options] - The options for the redelegation
|
|
1432
|
-
* @returns {Promise<AoMessageResult>} The result of the redelegation
|
|
1433
|
-
*/
|
|
1434
|
-
async redelegateStake(params, options) {
|
|
1435
|
-
const { tags = [] } = options || {};
|
|
1436
|
-
const allTags = [
|
|
1437
|
-
...tags,
|
|
1438
|
-
{ name: 'Action', value: 'Redelegate-Stake' },
|
|
1439
|
-
{ name: 'Target', value: params.target },
|
|
1440
|
-
{ name: 'Source', value: params.source },
|
|
1441
|
-
{ name: 'Quantity', value: params.stakeQty.valueOf().toString() },
|
|
1442
|
-
{ name: 'Vault-Id', value: params.vaultId },
|
|
1443
|
-
];
|
|
1444
|
-
return this.process.send({
|
|
1445
|
-
signer: this.signer,
|
|
1446
|
-
tags: pruneTags(allTags),
|
|
1447
|
-
});
|
|
1448
|
-
}
|
|
1449
|
-
/**
|
|
1450
|
-
* AO backend stub — `syncAttributes` is a Solana-only on-chain reconciliation
|
|
1451
|
-
* for the ANT NFT's Attributes plugin. AO ANTs have no NFT trait surface, so
|
|
1452
|
-
* there is nothing to sync.
|
|
1453
|
-
*/
|
|
1454
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1455
|
-
async syncAttributes(_params, _options) {
|
|
1456
|
-
throw new Error('syncAttributes is only supported on the Solana backend (use ARIO.init({ backend: "solana", ... })).');
|
|
1457
|
-
}
|
|
1458
30
|
}
|