@ar.io/sdk 4.0.0-solana.9 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +69 -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
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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
|
+
/**
|
|
17
|
+
* Solana implementation of the ARIORead interface.
|
|
3
18
|
*
|
|
4
19
|
* Reads AR.IO protocol state directly from Solana PDAs using RPC,
|
|
5
20
|
* returning the same types that the AO implementation returns.
|
|
@@ -14,10 +29,11 @@ import { Logger } from '../common/logger.js';
|
|
|
14
29
|
import { SolanaANTRegistryReadable } from './ant-registry-readable.js';
|
|
15
30
|
import { getAssociatedTokenAddressKit } from './ata.js';
|
|
16
31
|
import { ARIO_ANT_PROGRAM_ID, ARIO_ARNS_PROGRAM_ID, ARIO_CORE_PROGRAM_ID, ARIO_GAR_PROGRAM_ID, ARNS_RECORD_ANT_OFFSET, RATE_SCALE, } from './constants.js';
|
|
17
|
-
import { computeLiveDelegationBalance } from './delegation-math.js';
|
|
32
|
+
import { computeLiveDelegationBalance, selectCompoundableDelegations, } from './delegation-math.js';
|
|
18
33
|
import { deserializeAllowlist, deserializeArioConfig, deserializeArnsRecord, deserializeDelegation, deserializeDemandFactor, deserializeEpoch, deserializeEpochSettings, deserializeEpochSettingsFull, deserializeGarSettings, deserializeGarSupplyCounters, deserializeGateway, deserializeGatewayWithAccumulator, deserializeObservation, deserializePrimaryName, deserializePrimaryNameRequest, deserializeRedelegationRecord, deserializeReservedName, deserializeReturnedName, deserializeVault, deserializeWithdrawal, } from './deserialize.js';
|
|
19
34
|
import { TOKEN_PROGRAM_ADDRESS } from './instruction.js';
|
|
20
35
|
import { getArioConfigPDA, getArnsRecordPDA, getArnsRecordPDAFromHash, getArnsSettingsPDA, getDemandFactorPDA, getEpochPDA, getEpochSettingsPDA, getGarSettingsPDA, getGatewayPDA, getGatewayRegistryPDA, getObserverLookupPDA, getPrimaryNamePDA, getPrimaryNameRequestPDA, getReservedNamePDA, getReturnedNamePDA, getVaultPDA, } from './pda.js';
|
|
36
|
+
import { withRetry } from './retry.js';
|
|
21
37
|
const addressDecoder = getAddressDecoder();
|
|
22
38
|
/** All-zero address — equivalent of web3.js `PublicKey.default`. */
|
|
23
39
|
const DEFAULT_ADDRESS = address('11111111111111111111111111111111');
|
|
@@ -71,7 +87,7 @@ function toMsTimestamps(obj) {
|
|
|
71
87
|
/**
|
|
72
88
|
* Drop the SDK-internal extras (`name`, `owner`) and the `processId` re-key
|
|
73
89
|
* that `deserializeArnsRecord` adds, projecting back to the cross-backend
|
|
74
|
-
* `
|
|
90
|
+
* `ArNSNameDataWithName` shape consumers expect.
|
|
75
91
|
*
|
|
76
92
|
* Timestamps are converted from on-chain seconds to JS milliseconds here
|
|
77
93
|
* (see `toMsTimestamps` above for rationale).
|
|
@@ -89,6 +105,12 @@ function arnsRecordToWithName(record) {
|
|
|
89
105
|
: {}),
|
|
90
106
|
};
|
|
91
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* TTL for {@link SolanaARIOReadable.getCachedAccount}. DemandFactor / config
|
|
110
|
+
* accounts change on the order of epochs, so a few seconds of staleness is a
|
|
111
|
+
* safe trade for collapsing burst reads (e.g. per-row cost lookups).
|
|
112
|
+
*/
|
|
113
|
+
const CONFIG_CACHE_TTL_MS = 30_000;
|
|
92
114
|
function paginate(items, params) {
|
|
93
115
|
const limit = params?.limit ?? 100;
|
|
94
116
|
const startIdx = params?.cursor ? parseInt(params.cursor, 10) : 0;
|
|
@@ -130,6 +152,11 @@ export class SolanaARIOReadable {
|
|
|
130
152
|
// Memoized ARIO mint address (read once from ArioConfig.mint and reused
|
|
131
153
|
// for every SPL-ATA derivation in getBalance/getBalances).
|
|
132
154
|
_arioMint;
|
|
155
|
+
// Short-TTL cache for slow-changing config-ish accounts (DemandFactor,
|
|
156
|
+
// ArnsConfig, etc.). Collapses the many identical reads a UI fires in a
|
|
157
|
+
// burst — e.g. the returned-names page running `getCostDetails` per row,
|
|
158
|
+
// each re-reading the same DemandFactor PDA — into a single network call.
|
|
159
|
+
_accountCache = new Map();
|
|
133
160
|
constructor(config) {
|
|
134
161
|
this.rpc = config.rpc;
|
|
135
162
|
this.commitment = config.commitment ?? 'confirmed';
|
|
@@ -141,9 +168,27 @@ export class SolanaARIOReadable {
|
|
|
141
168
|
}
|
|
142
169
|
/** Helper to fetch an encoded account (kit's replacement for Connection.getAccountInfo). */
|
|
143
170
|
async getAccount(pda) {
|
|
144
|
-
return fetchEncodedAccount(this.rpc, pda, {
|
|
171
|
+
return withRetry(() => fetchEncodedAccount(this.rpc, pda, {
|
|
145
172
|
commitment: this.commitment,
|
|
146
|
-
});
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Like {@link getAccount} but caches the result per-PDA for `ttlMs`. Use only
|
|
177
|
+
* for accounts that change slowly (DemandFactor, ArnsConfig) where a few
|
|
178
|
+
* seconds of staleness is acceptable in exchange for collapsing repeated
|
|
179
|
+
* reads. A successful fetch is cached; misses (`exists: false`) are not.
|
|
180
|
+
*/
|
|
181
|
+
async getCachedAccount(pda, ttlMs = CONFIG_CACHE_TTL_MS) {
|
|
182
|
+
const key = String(pda);
|
|
183
|
+
const now = Date.now();
|
|
184
|
+
const hit = this._accountCache.get(key);
|
|
185
|
+
if (hit && hit.expiresAt > now)
|
|
186
|
+
return hit.account;
|
|
187
|
+
const account = await this.getAccount(pda);
|
|
188
|
+
if (account.exists) {
|
|
189
|
+
this._accountCache.set(key, { account, expiresAt: now + ttlMs });
|
|
190
|
+
}
|
|
191
|
+
return account;
|
|
147
192
|
}
|
|
148
193
|
/**
|
|
149
194
|
* Helper for `getProgramAccounts` with a discriminator memcmp filter.
|
|
@@ -168,7 +213,7 @@ export class SolanaARIOReadable {
|
|
|
168
213
|
// when called without `withContext: true`. With `encoding: 'base64'`, each
|
|
169
214
|
// account's `data` is a `[base64, 'base64']` tuple. We bypass kit's strict
|
|
170
215
|
// generic overload typing here with a cast — the runtime shape is stable.
|
|
171
|
-
const result =
|
|
216
|
+
const result = await withRetry(() => this.rpc
|
|
172
217
|
.getProgramAccounts(programId, {
|
|
173
218
|
commitment: this.commitment,
|
|
174
219
|
encoding: 'base64',
|
|
@@ -195,9 +240,9 @@ export class SolanaARIOReadable {
|
|
|
195
240
|
if (unique.length === 0)
|
|
196
241
|
return new Map();
|
|
197
242
|
const pdas = await Promise.all(unique.map(async (op) => (await getGatewayPDA(address(op), this.garProgram))[0]));
|
|
198
|
-
const accounts = await fetchEncodedAccounts(this.rpc, pdas, {
|
|
243
|
+
const accounts = await withRetry(() => fetchEncodedAccounts(this.rpc, pdas, {
|
|
199
244
|
commitment: this.commitment,
|
|
200
|
-
});
|
|
245
|
+
}));
|
|
201
246
|
const out = new Map();
|
|
202
247
|
for (let i = 0; i < accounts.length; i++) {
|
|
203
248
|
const acct = accounts[i];
|
|
@@ -289,9 +334,23 @@ export class SolanaARIOReadable {
|
|
|
289
334
|
let staked = 0;
|
|
290
335
|
let delegated = 0;
|
|
291
336
|
let withdrawn = 0;
|
|
337
|
+
// `protocolBalance` is the REWARD RESERVE: the live balance of the protocol
|
|
338
|
+
// token account the epoch cranker emits from (ario-gar `distribute_epoch`
|
|
339
|
+
// reads `protocol_token_account.amount`). This matches AO's `protocolBalance`
|
|
340
|
+
// semantics (the qNvAoz0 reserve) and makes the six buckets sum to `total`:
|
|
341
|
+
// circulating + locked + staked + delegated + withdrawn + protocolBalance == total
|
|
342
|
+
//
|
|
343
|
+
// It is deliberately NOT `ArioConfig.protocol_balance`, which is a *folded*
|
|
344
|
+
// accounting field (= reserve + staked + delegated + withdrawn) and so
|
|
345
|
+
// double-counts the staking buckets — surfacing it as "protocol balance"
|
|
346
|
+
// over-reports the reward reserve by tens of millions of ARIO. We fall back
|
|
347
|
+
// to the folded value only when GatewaySettings or the token account can't
|
|
348
|
+
// be read (e.g. pre-init).
|
|
349
|
+
let protocolBalance = config.protocolBalance;
|
|
292
350
|
if (garSettingsAccount.exists) {
|
|
351
|
+
const garData = Buffer.from(garSettingsAccount.data);
|
|
293
352
|
try {
|
|
294
|
-
const counters = deserializeGarSupplyCounters(
|
|
353
|
+
const counters = deserializeGarSupplyCounters(garData);
|
|
295
354
|
staked = counters.totalStaked;
|
|
296
355
|
delegated = counters.totalDelegated;
|
|
297
356
|
withdrawn = counters.totalWithdrawn;
|
|
@@ -299,6 +358,22 @@ export class SolanaARIOReadable {
|
|
|
299
358
|
catch {
|
|
300
359
|
// Old-layout account without supply counters — fall back to 0
|
|
301
360
|
}
|
|
361
|
+
// The protocol token account is pinned in GatewaySettings at offset 189
|
|
362
|
+
// (see ario-gar state/mod.rs::GatewaySettings: 8 disc + 32 authority +
|
|
363
|
+
// 32 mint + 6×8 economic params + 4 max_delegates + 1 migration_active +
|
|
364
|
+
// 32 migration_authority + 32 stake_token_account = 189; the pubkey runs
|
|
365
|
+
// [189, 221)). Read its live SPL balance as the reward reserve.
|
|
366
|
+
if (garData.length >= 221) {
|
|
367
|
+
try {
|
|
368
|
+
const protocolTokenAccount = addressDecoder.decode(garData.subarray(189, 221));
|
|
369
|
+
const reserve = await this.getTokenAccountAmount(protocolTokenAccount);
|
|
370
|
+
if (reserve !== null)
|
|
371
|
+
protocolBalance = reserve;
|
|
372
|
+
}
|
|
373
|
+
catch {
|
|
374
|
+
// Couldn't read the reserve — keep the folded fallback.
|
|
375
|
+
}
|
|
376
|
+
}
|
|
302
377
|
}
|
|
303
378
|
return {
|
|
304
379
|
total: config.totalSupply,
|
|
@@ -307,9 +382,31 @@ export class SolanaARIOReadable {
|
|
|
307
382
|
staked,
|
|
308
383
|
delegated,
|
|
309
384
|
withdrawn,
|
|
310
|
-
protocolBalance
|
|
385
|
+
protocolBalance,
|
|
311
386
|
};
|
|
312
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* Read the `amount` (in mARIO) of an SPL token account directly by address.
|
|
390
|
+
* Returns `null` if the account doesn't exist or is too small to be a token
|
|
391
|
+
* account, so callers can distinguish "absent" from a real zero balance.
|
|
392
|
+
*
|
|
393
|
+
* Uses a portable little-endian u64 decode — some browser bundlers strip the
|
|
394
|
+
* BigInt readers from the `buffer` shim's prototype (see `getBalance`).
|
|
395
|
+
*/
|
|
396
|
+
async getTokenAccountAmount(tokenAccount) {
|
|
397
|
+
const account = await this.getAccount(tokenAccount);
|
|
398
|
+
if (!account.exists)
|
|
399
|
+
return null;
|
|
400
|
+
const data = account.data;
|
|
401
|
+
if (data.length < 72)
|
|
402
|
+
return null;
|
|
403
|
+
let amount = 0n;
|
|
404
|
+
for (let i = 7; i >= 0; i--) {
|
|
405
|
+
amount = (amount << 8n) | BigInt(data[64 + i]);
|
|
406
|
+
}
|
|
407
|
+
// ARIO supply caps at 1B * 1e6 mARIO ≈ 2^50, well under MAX_SAFE_INTEGER.
|
|
408
|
+
return Number(amount);
|
|
409
|
+
}
|
|
313
410
|
// =========================================
|
|
314
411
|
// Balance read methods
|
|
315
412
|
// =========================================
|
|
@@ -387,7 +484,7 @@ export class SolanaARIOReadable {
|
|
|
387
484
|
},
|
|
388
485
|
},
|
|
389
486
|
];
|
|
390
|
-
const result =
|
|
487
|
+
const result = await withRetry(() => this.rpc
|
|
391
488
|
.getProgramAccounts(TOKEN_PROGRAM_ADDRESS, {
|
|
392
489
|
commitment: this.commitment,
|
|
393
490
|
encoding: 'base64',
|
|
@@ -562,22 +659,43 @@ export class SolanaARIOReadable {
|
|
|
562
659
|
}
|
|
563
660
|
return paginate(items, params);
|
|
564
661
|
}
|
|
662
|
+
/**
|
|
663
|
+
* Returns every delegation a wallet currently has, covering both halves
|
|
664
|
+
* of the `Delegation` union:
|
|
665
|
+
*
|
|
666
|
+
* - `type: 'stake'` — active `Delegation` PDAs (filtered by delegator at
|
|
667
|
+
* memcmp offset 40 = 8 disc + 32 gateway).
|
|
668
|
+
* - `type: 'vault'` — pending delegate-stake withdrawals: `Withdrawal`
|
|
669
|
+
* PDAs filtered by owner at memcmp offset 8 (= 8 disc), then narrowed
|
|
670
|
+
* client-side to `isDelegate: true`. Operator-stake withdrawals are
|
|
671
|
+
* excluded — those are surfaced via `getWithdrawals` /
|
|
672
|
+
* `getGatewayVaults`.
|
|
673
|
+
*
|
|
674
|
+
* Both queries run in parallel; consumers see a single merged result
|
|
675
|
+
* matching the cross-backend interface contract.
|
|
676
|
+
*/
|
|
565
677
|
async getDelegations(params) {
|
|
566
|
-
const
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
bytes:
|
|
573
|
-
encoding: 'base58',
|
|
678
|
+
const owner = address(params.address);
|
|
679
|
+
const [delegationAccounts, withdrawalAccounts] = await Promise.all([
|
|
680
|
+
// Active delegations — `Delegation` PDA layout:
|
|
681
|
+
// disc(8) + gateway(32) + delegator(32) + ... — delegator at offset 40.
|
|
682
|
+
this.getAccountsByDiscriminator(this.garProgram, DELEGATION_DISCRIMINATOR, [
|
|
683
|
+
{
|
|
684
|
+
memcmp: { offset: 40n, bytes: owner, encoding: 'base58' },
|
|
574
685
|
},
|
|
575
|
-
|
|
686
|
+
]),
|
|
687
|
+
// Pending vault delegations — `Withdrawal` PDA layout:
|
|
688
|
+
// disc(8) + owner(32) + withdrawal_id(8) + gateway(32) + ... — owner at offset 8.
|
|
689
|
+
this.getAccountsByDiscriminator(this.garProgram, WITHDRAWAL_DISCRIMINATOR, [
|
|
690
|
+
{
|
|
691
|
+
memcmp: { offset: 8n, bytes: owner, encoding: 'base58' },
|
|
692
|
+
},
|
|
693
|
+
]),
|
|
576
694
|
]);
|
|
577
|
-
const
|
|
578
|
-
for (const { pubkey, data } of
|
|
695
|
+
const decodedDelegations = [];
|
|
696
|
+
for (const { pubkey, data } of delegationAccounts) {
|
|
579
697
|
try {
|
|
580
|
-
|
|
698
|
+
decodedDelegations.push({
|
|
581
699
|
pubkey: pubkey,
|
|
582
700
|
del: deserializeDelegation(data),
|
|
583
701
|
});
|
|
@@ -588,8 +706,8 @@ export class SolanaARIOReadable {
|
|
|
588
706
|
}
|
|
589
707
|
// Batch-fetch each referenced gateway's reward accumulator so we can
|
|
590
708
|
// return live balances. See INVARIANTS.md and `computeLiveDelegationBalance`.
|
|
591
|
-
const accumulators = await this.getGatewayAccumulators(
|
|
592
|
-
const
|
|
709
|
+
const accumulators = await this.getGatewayAccumulators(decodedDelegations.map(({ del }) => del.gateway));
|
|
710
|
+
const stakeItems = decodedDelegations.map(({ pubkey, del }) => ({
|
|
593
711
|
type: 'stake',
|
|
594
712
|
gatewayAddress: del.gateway,
|
|
595
713
|
delegationId: pubkey,
|
|
@@ -600,7 +718,30 @@ export class SolanaARIOReadable {
|
|
|
600
718
|
cumulativeRewardPerToken: accumulators.get(del.gateway) ?? 0n,
|
|
601
719
|
}),
|
|
602
720
|
}));
|
|
603
|
-
|
|
721
|
+
const vaultItems = [];
|
|
722
|
+
for (const { pubkey, data } of withdrawalAccounts) {
|
|
723
|
+
try {
|
|
724
|
+
const w = deserializeWithdrawal(data);
|
|
725
|
+
// Delegate-stake decreases only. Operator-stake withdrawals (the
|
|
726
|
+
// operator's own decreaseOperatorStake calls) belong on
|
|
727
|
+
// `getWithdrawals` / `getGatewayVaults`, not `getDelegations`.
|
|
728
|
+
if (!w.isDelegate)
|
|
729
|
+
continue;
|
|
730
|
+
vaultItems.push({
|
|
731
|
+
type: 'vault',
|
|
732
|
+
gatewayAddress: w.gateway,
|
|
733
|
+
delegationId: pubkey,
|
|
734
|
+
vaultId: w.vaultId,
|
|
735
|
+
balance: w.balance,
|
|
736
|
+
startTimestamp: secToMs(w.startTimestamp),
|
|
737
|
+
endTimestamp: secToMs(w.endTimestamp),
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
catch {
|
|
741
|
+
// Skip malformed
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return paginate([...stakeItems, ...vaultItems], params);
|
|
604
745
|
}
|
|
605
746
|
async getAllowedDelegates(params) {
|
|
606
747
|
return this.getGatewayDelegateAllowList(params);
|
|
@@ -633,6 +774,46 @@ export class SolanaARIOReadable {
|
|
|
633
774
|
}
|
|
634
775
|
return paginate(items, params);
|
|
635
776
|
}
|
|
777
|
+
/**
|
|
778
|
+
* Return every pending stake withdrawal owned by `address` — operator-stake
|
|
779
|
+
* decreases (`isDelegate: false`) and delegate-stake decreases
|
|
780
|
+
* (`isDelegate: true`) in one paginated result. A withdrawal is claimable
|
|
781
|
+
* when `Date.now() >= endTimestamp`; release the funds via
|
|
782
|
+
* `claimWithdrawal({ withdrawalId: item.vaultId })`.
|
|
783
|
+
*
|
|
784
|
+
* Solana-only: AO releases withdrawals automatically at maturity and has no
|
|
785
|
+
* equivalent per-owner read; the AO backend throws.
|
|
786
|
+
*/
|
|
787
|
+
async getWithdrawals(params) {
|
|
788
|
+
const owner = address(params.address);
|
|
789
|
+
// Withdrawal layout: disc(8) + owner(32) + withdrawal_id(8) + gateway(32).
|
|
790
|
+
// Filter by owner at offset 8 — returns both operator-stake (isDelegate=false)
|
|
791
|
+
// and delegate-stake (isDelegate=true) withdrawals for this wallet.
|
|
792
|
+
const accounts = await this.getAccountsByDiscriminator(this.garProgram, WITHDRAWAL_DISCRIMINATOR, [
|
|
793
|
+
{
|
|
794
|
+
memcmp: { offset: 8n, bytes: owner, encoding: 'base58' },
|
|
795
|
+
},
|
|
796
|
+
]);
|
|
797
|
+
const items = [];
|
|
798
|
+
for (const { pubkey, data } of accounts) {
|
|
799
|
+
try {
|
|
800
|
+
const w = deserializeWithdrawal(data);
|
|
801
|
+
items.push({
|
|
802
|
+
cursorId: pubkey,
|
|
803
|
+
vaultId: w.vaultId,
|
|
804
|
+
balance: w.balance,
|
|
805
|
+
startTimestamp: secToMs(w.startTimestamp),
|
|
806
|
+
endTimestamp: secToMs(w.endTimestamp),
|
|
807
|
+
gatewayAddress: w.gateway,
|
|
808
|
+
isDelegate: w.isDelegate,
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
catch {
|
|
812
|
+
// Skip malformed
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
return paginate(items, params);
|
|
816
|
+
}
|
|
636
817
|
// =========================================
|
|
637
818
|
// ArNS read methods
|
|
638
819
|
// =========================================
|
|
@@ -679,7 +860,7 @@ export class SolanaARIOReadable {
|
|
|
679
860
|
* mints against ≈ 4k records, and rises as the registry grows).
|
|
680
861
|
*
|
|
681
862
|
* The shape mirrors `getArNSRecord` / `getArNSRecords` — same
|
|
682
|
-
* `
|
|
863
|
+
* `ArNSNameDataWithName` items, no pagination wrapper. Callers
|
|
683
864
|
* that want pagination should drive it via `getArNSRecords({
|
|
684
865
|
* filters: { processId: mints } })` instead.
|
|
685
866
|
*/
|
|
@@ -807,7 +988,11 @@ export class SolanaARIOReadable {
|
|
|
807
988
|
}
|
|
808
989
|
async getArNSReturnedName({ name, }) {
|
|
809
990
|
const [pda] = await getReturnedNamePDA(name, this.arnsProgram);
|
|
810
|
-
|
|
991
|
+
// A ReturnedName account is immutable once created (its premium is derived
|
|
992
|
+
// client-side from the static start/end timestamps), so cache the read.
|
|
993
|
+
// The returned-names price table reads each name's PDA twice (lease +
|
|
994
|
+
// permabuy) and `getTokenCost` reads it again — all share one fetch.
|
|
995
|
+
const account = await this.getCachedAccount(pda);
|
|
811
996
|
if (!account.exists) {
|
|
812
997
|
throw new Error(`Returned name not found: ${name}`);
|
|
813
998
|
}
|
|
@@ -1027,6 +1212,36 @@ export class SolanaARIOReadable {
|
|
|
1027
1212
|
}
|
|
1028
1213
|
return { failureSummaries, reports };
|
|
1029
1214
|
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Observer pubkeys that have an OPEN Observation PDA for `epochIndex`. Lean —
|
|
1217
|
+
* reads only the Observation accounts (no gateway-registry decode like
|
|
1218
|
+
* {@link getObservations}). Used by the crank to close observations before
|
|
1219
|
+
* `close_epoch`, whose `observations_closed == observations_submitted`
|
|
1220
|
+
* precondition would otherwise wedge epoch progression.
|
|
1221
|
+
*/
|
|
1222
|
+
async getEpochObservers(epochIndex) {
|
|
1223
|
+
const epochIndexBuf = Buffer.alloc(8);
|
|
1224
|
+
epochIndexBuf.writeBigUInt64LE(BigInt(epochIndex));
|
|
1225
|
+
const accounts = await this.getAccountsByDiscriminator(this.garProgram, OBSERVATION_DISCRIMINATOR, [
|
|
1226
|
+
{
|
|
1227
|
+
memcmp: {
|
|
1228
|
+
offset: 8n,
|
|
1229
|
+
bytes: bs58.encode(epochIndexBuf),
|
|
1230
|
+
encoding: 'base58',
|
|
1231
|
+
},
|
|
1232
|
+
},
|
|
1233
|
+
]);
|
|
1234
|
+
const observers = [];
|
|
1235
|
+
for (const { data } of accounts) {
|
|
1236
|
+
try {
|
|
1237
|
+
observers.push(address(deserializeObservation(data).observer));
|
|
1238
|
+
}
|
|
1239
|
+
catch {
|
|
1240
|
+
// skip malformed
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
return observers;
|
|
1244
|
+
}
|
|
1030
1245
|
async getDistributions(epoch) {
|
|
1031
1246
|
const epochIndex = await this.resolveEpochIndex(epoch);
|
|
1032
1247
|
const epochData = await this.fetchEpoch(epochIndex);
|
|
@@ -1087,7 +1302,7 @@ export class SolanaARIOReadable {
|
|
|
1087
1302
|
*/
|
|
1088
1303
|
async getTokenCost(params) {
|
|
1089
1304
|
const [dfPda] = await getDemandFactorPDA(this.arnsProgram);
|
|
1090
|
-
const dfAccount = await this.
|
|
1305
|
+
const dfAccount = await this.getCachedAccount(dfPda);
|
|
1091
1306
|
if (!dfAccount.exists)
|
|
1092
1307
|
throw new Error('DemandFactor account not found');
|
|
1093
1308
|
const df = deserializeDemandFactor(Buffer.from(dfAccount.data));
|
|
@@ -1141,6 +1356,11 @@ export class SolanaARIOReadable {
|
|
|
1141
1356
|
cost = (bf * demandFactorRaw * annualPct * years) / scale / scale;
|
|
1142
1357
|
break;
|
|
1143
1358
|
}
|
|
1359
|
+
// A Primary-Name-Request is priced identically to a single
|
|
1360
|
+
// Increase-Undername-Limit operation against the same name: it uses the
|
|
1361
|
+
// name-length-indexed base fee (`bf`) and a quantity of 1. Fall through
|
|
1362
|
+
// to share that logic rather than duplicating it.
|
|
1363
|
+
case 'Primary-Name-Request':
|
|
1144
1364
|
case 'Increase-Undername-Limit': {
|
|
1145
1365
|
const qty = BigInt(params.quantity ?? 1);
|
|
1146
1366
|
let isPermabuy = false;
|
|
@@ -1160,13 +1380,6 @@ export class SolanaARIOReadable {
|
|
|
1160
1380
|
cost = permabuyCost;
|
|
1161
1381
|
break;
|
|
1162
1382
|
}
|
|
1163
|
-
case 'Primary-Name-Request': {
|
|
1164
|
-
const primaryBaseFee = BigInt(df.fees[50]);
|
|
1165
|
-
const annualPct = 200000n;
|
|
1166
|
-
const yearFactor = scale + annualPct;
|
|
1167
|
-
cost = (primaryBaseFee * demandFactorRaw * yearFactor) / scale / scale;
|
|
1168
|
-
break;
|
|
1169
|
-
}
|
|
1170
1383
|
default:
|
|
1171
1384
|
throw new Error(`Unknown intent: ${params.intent}`);
|
|
1172
1385
|
}
|
|
@@ -1177,14 +1390,35 @@ export class SolanaARIOReadable {
|
|
|
1177
1390
|
const discounts = [];
|
|
1178
1391
|
if (params.fromAddress) {
|
|
1179
1392
|
try {
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1393
|
+
// Operator-discount check. Read the gateway PDA through the short-TTL
|
|
1394
|
+
// cache (NOT public `getGateway`, which stays fresh for gateway pages):
|
|
1395
|
+
// a price table calls `getCostDetails` many times for the SAME
|
|
1396
|
+
// `fromAddress`, so this collapses N redundant gateway reads to one.
|
|
1397
|
+
const [gwPda] = await getGatewayPDA(address(params.fromAddress), this.garProgram);
|
|
1398
|
+
const gwAccount = await this.getCachedAccount(gwPda);
|
|
1399
|
+
if (gwAccount.exists) {
|
|
1400
|
+
const gw = deserializeGateway(Buffer.from(gwAccount.data));
|
|
1401
|
+
if (gw.status === 'joined') {
|
|
1402
|
+
// Match on-chain eligibility from ario-arns pricing.rs
|
|
1403
|
+
// `try_apply_gateway_discount`:
|
|
1404
|
+
// 1. Tenure: gateway running >= 180 days (15_552_000 seconds)
|
|
1405
|
+
const GATEWAY_DISCOUNT_MIN_TENURE_S = 15_552_000;
|
|
1406
|
+
const nowSeconds = Math.floor(Date.now() / 1000);
|
|
1407
|
+
const timeRunning = nowSeconds - gw.startTimestamp;
|
|
1408
|
+
// 2. Performance: >= 90% epoch pass rate
|
|
1409
|
+
const passRate = ((1 + gw.stats.passedEpochCount) /
|
|
1410
|
+
(1 + gw.stats.totalEpochCount)) *
|
|
1411
|
+
1_000_000;
|
|
1412
|
+
if (timeRunning >= GATEWAY_DISCOUNT_MIN_TENURE_S &&
|
|
1413
|
+
passRate >= 900_000) {
|
|
1414
|
+
const discountAmount = Math.floor((tokenCost * 200_000) / RATE_SCALE);
|
|
1415
|
+
discounts.push({
|
|
1416
|
+
name: 'Gateway Operator',
|
|
1417
|
+
discountTotal: discountAmount,
|
|
1418
|
+
multiplier: 0.8,
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1188
1422
|
}
|
|
1189
1423
|
}
|
|
1190
1424
|
catch {
|
|
@@ -1192,14 +1426,106 @@ export class SolanaARIOReadable {
|
|
|
1192
1426
|
}
|
|
1193
1427
|
}
|
|
1194
1428
|
const totalDiscount = discounts.reduce((sum, d) => sum + d.discountTotal, 0);
|
|
1429
|
+
const finalCost = tokenCost - totalDiscount;
|
|
1430
|
+
// Project Solana state into the public-facing `FundingPlan` shape when
|
|
1431
|
+
// the caller asks about a specific funding source for a specific wallet.
|
|
1432
|
+
// (`fromAddress` is required — we can't enumerate funding sources for
|
|
1433
|
+
// an unknown wallet; without `fundFrom` we don't know what to budget
|
|
1434
|
+
// against.) The internal `funding-plan.ts` `FundingPlan` is a
|
|
1435
|
+
// separate, instruction-building plan — keep them distinct.
|
|
1436
|
+
let fundingPlan;
|
|
1437
|
+
if (params.fromAddress && params.fundFrom !== undefined) {
|
|
1438
|
+
fundingPlan = await this.buildPublicFundingPlan({
|
|
1439
|
+
fromAddress: params.fromAddress,
|
|
1440
|
+
fundFrom: params.fundFrom,
|
|
1441
|
+
cost: finalCost,
|
|
1442
|
+
});
|
|
1443
|
+
}
|
|
1195
1444
|
return {
|
|
1196
|
-
tokenCost:
|
|
1445
|
+
tokenCost: finalCost,
|
|
1197
1446
|
discounts,
|
|
1447
|
+
...(fundingPlan ? { fundingPlan } : {}),
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Project Solana on-chain state into the cross-backend `FundingPlan`
|
|
1452
|
+
* shape consumed by UI flows like "how short are you on this purchase,
|
|
1453
|
+
* and from which sources?". Always returns the wallet's `balance` and
|
|
1454
|
+
* full per-gateway `stakes` breakdown (active delegations + pending
|
|
1455
|
+
* delegate-stake withdrawals); `shortfall` is computed against the
|
|
1456
|
+
* specific `fundFrom` semantics.
|
|
1457
|
+
*
|
|
1458
|
+
* Note: the internal `src/solana/funding-plan.ts` `FundingPlan` is a
|
|
1459
|
+
* different type — that's the multi-source instruction-building plan
|
|
1460
|
+
* used by `buyRecord({ fundFrom: 'any' })`. The two share a concept but
|
|
1461
|
+
* not a shape; the public type here is what consumer UIs see.
|
|
1462
|
+
*/
|
|
1463
|
+
async buildPublicFundingPlan({ fromAddress, fundFrom, cost, }) {
|
|
1464
|
+
// Pull balance + full delegation list (stake + vault) in parallel.
|
|
1465
|
+
// Limit is intentionally large — the public FundingPlan reports the
|
|
1466
|
+
// *entire* per-gateway breakdown, not a pagination window.
|
|
1467
|
+
const [balance, delegations] = await Promise.all([
|
|
1468
|
+
this.getBalance({ address: fromAddress }),
|
|
1469
|
+
this.getDelegations({ address: fromAddress, limit: 10_000 }),
|
|
1470
|
+
]);
|
|
1471
|
+
const stakes = {};
|
|
1472
|
+
for (const d of delegations.items) {
|
|
1473
|
+
const gateway = d.gatewayAddress;
|
|
1474
|
+
if (!stakes[gateway]) {
|
|
1475
|
+
stakes[gateway] = { vaults: [], delegatedStake: 0 };
|
|
1476
|
+
}
|
|
1477
|
+
if (d.type === 'stake') {
|
|
1478
|
+
stakes[gateway].delegatedStake = d.balance;
|
|
1479
|
+
}
|
|
1480
|
+
else {
|
|
1481
|
+
// `Record<string, number>[]` per-vault entries — AO-era shape we
|
|
1482
|
+
// keep for cross-backend compatibility.
|
|
1483
|
+
stakes[gateway].vaults.push({ [d.vaultId]: d.balance });
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
const sumDelegated = Object.values(stakes).reduce((sum, g) => sum + g.delegatedStake, 0);
|
|
1487
|
+
const sumVaulted = Object.values(stakes).reduce((sum, g) => sum +
|
|
1488
|
+
g.vaults.reduce((vsum, v) => vsum + Object.values(v).reduce((a, b) => a + b, 0), 0), 0);
|
|
1489
|
+
// Compute shortfall against the *eligible* pool for the chosen
|
|
1490
|
+
// `fundFrom`. `turbo` and `plan` are special: turbo is paid in
|
|
1491
|
+
// off-chain credits (no mARIO shortfall meaningful here), and plan
|
|
1492
|
+
// is caller-supplied (caller did their own arithmetic).
|
|
1493
|
+
let eligible;
|
|
1494
|
+
switch (fundFrom) {
|
|
1495
|
+
case 'balance':
|
|
1496
|
+
eligible = balance;
|
|
1497
|
+
break;
|
|
1498
|
+
case 'stakes':
|
|
1499
|
+
eligible = sumDelegated;
|
|
1500
|
+
break;
|
|
1501
|
+
case 'withdrawal':
|
|
1502
|
+
eligible = sumVaulted;
|
|
1503
|
+
break;
|
|
1504
|
+
case 'any':
|
|
1505
|
+
eligible = balance + sumDelegated + sumVaulted;
|
|
1506
|
+
break;
|
|
1507
|
+
case 'turbo':
|
|
1508
|
+
case 'plan':
|
|
1509
|
+
eligible = Number.MAX_SAFE_INTEGER;
|
|
1510
|
+
break;
|
|
1511
|
+
default: {
|
|
1512
|
+
// Exhaustiveness check — surface a missed FundFrom variant at
|
|
1513
|
+
// type-check time, not at runtime.
|
|
1514
|
+
const _exhaustive = fundFrom;
|
|
1515
|
+
eligible = 0;
|
|
1516
|
+
void _exhaustive;
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
return {
|
|
1520
|
+
address: fromAddress,
|
|
1521
|
+
balance,
|
|
1522
|
+
stakes,
|
|
1523
|
+
shortfall: Math.max(0, cost - eligible),
|
|
1198
1524
|
};
|
|
1199
1525
|
}
|
|
1200
1526
|
async getRegistrationFees() {
|
|
1201
1527
|
const [dfPda] = await getDemandFactorPDA(this.arnsProgram);
|
|
1202
|
-
const account = await this.
|
|
1528
|
+
const account = await this.getCachedAccount(dfPda);
|
|
1203
1529
|
if (!account.exists) {
|
|
1204
1530
|
throw new Error('DemandFactor account not found');
|
|
1205
1531
|
}
|
|
@@ -1222,7 +1548,7 @@ export class SolanaARIOReadable {
|
|
|
1222
1548
|
}
|
|
1223
1549
|
async getDemandFactor() {
|
|
1224
1550
|
const [pda] = await getDemandFactorPDA(this.arnsProgram);
|
|
1225
|
-
const account = await this.
|
|
1551
|
+
const account = await this.getCachedAccount(pda);
|
|
1226
1552
|
if (!account.exists) {
|
|
1227
1553
|
throw new Error('DemandFactor account not found');
|
|
1228
1554
|
}
|
|
@@ -1231,7 +1557,7 @@ export class SolanaARIOReadable {
|
|
|
1231
1557
|
}
|
|
1232
1558
|
async getDemandFactorSettings() {
|
|
1233
1559
|
const [pda] = await getDemandFactorPDA(this.arnsProgram);
|
|
1234
|
-
const account = await this.
|
|
1560
|
+
const account = await this.getCachedAccount(pda);
|
|
1235
1561
|
if (!account.exists) {
|
|
1236
1562
|
throw new Error('DemandFactor account not found');
|
|
1237
1563
|
}
|
|
@@ -1252,13 +1578,25 @@ export class SolanaARIOReadable {
|
|
|
1252
1578
|
// Primary name read methods
|
|
1253
1579
|
// =========================================
|
|
1254
1580
|
async getPrimaryName(params) {
|
|
1581
|
+
// On-chain `PrimaryName` stores only {owner, name, set_at}. The ANT mint
|
|
1582
|
+
// that PrimaryName.processId expects lives on the matching ArnsRecord
|
|
1583
|
+
// (looked up by the base name). Both lookup paths below deserialize the
|
|
1584
|
+
// on-chain account and then enrich with the ArnsRecord lookup.
|
|
1585
|
+
const baseNameOf = (n) => {
|
|
1586
|
+
const parts = n.toLowerCase().split('_');
|
|
1587
|
+
return parts.length === 2 ? parts[1] : parts[0];
|
|
1588
|
+
};
|
|
1589
|
+
const enrich = async (pn) => {
|
|
1590
|
+
const rec = await this.getArNSRecord({ name: baseNameOf(pn.name) });
|
|
1591
|
+
return { ...pn, processId: rec.processId };
|
|
1592
|
+
};
|
|
1255
1593
|
if ('address' in params) {
|
|
1256
1594
|
const [pda] = await getPrimaryNamePDA(address(params.address), this.coreProgram);
|
|
1257
1595
|
const account = await this.getAccount(pda);
|
|
1258
1596
|
if (!account.exists) {
|
|
1259
1597
|
throw new Error(`Primary name not found for address ${params.address}`);
|
|
1260
1598
|
}
|
|
1261
|
-
return deserializePrimaryName(Buffer.from(account.data));
|
|
1599
|
+
return enrich(deserializePrimaryName(Buffer.from(account.data)));
|
|
1262
1600
|
}
|
|
1263
1601
|
// Lookup by name — scan all primary name accounts
|
|
1264
1602
|
const accounts = await this.getAccountsByDiscriminator(this.coreProgram, PRIMARY_NAME_DISCRIMINATOR);
|
|
@@ -1266,7 +1604,7 @@ export class SolanaARIOReadable {
|
|
|
1266
1604
|
try {
|
|
1267
1605
|
const pn = deserializePrimaryName(data);
|
|
1268
1606
|
if (pn.name === params.name) {
|
|
1269
|
-
return pn;
|
|
1607
|
+
return enrich(pn);
|
|
1270
1608
|
}
|
|
1271
1609
|
}
|
|
1272
1610
|
catch {
|
|
@@ -1298,13 +1636,23 @@ export class SolanaARIOReadable {
|
|
|
1298
1636
|
}
|
|
1299
1637
|
async getPrimaryNames(params) {
|
|
1300
1638
|
const accounts = await this.getAccountsByDiscriminator(this.coreProgram, PRIMARY_NAME_DISCRIMINATOR);
|
|
1639
|
+
// Enrich each on-chain PrimaryName with its ArnsRecord.processId (the
|
|
1640
|
+
// on-chain account doesn't store it; see deserializePrimaryName).
|
|
1641
|
+
// Records that no longer have a matching ArnsRecord are silently
|
|
1642
|
+
// skipped — same forgiveness the per-name lookup already applies.
|
|
1643
|
+
const baseNameOf = (n) => {
|
|
1644
|
+
const parts = n.toLowerCase().split('_');
|
|
1645
|
+
return parts.length === 2 ? parts[1] : parts[0];
|
|
1646
|
+
};
|
|
1301
1647
|
const items = [];
|
|
1302
1648
|
for (const { data } of accounts) {
|
|
1303
1649
|
try {
|
|
1304
|
-
|
|
1650
|
+
const pn = deserializePrimaryName(data);
|
|
1651
|
+
const rec = await this.getArNSRecord({ name: baseNameOf(pn.name) });
|
|
1652
|
+
items.push({ ...pn, processId: rec.processId });
|
|
1305
1653
|
}
|
|
1306
1654
|
catch {
|
|
1307
|
-
// Skip malformed
|
|
1655
|
+
// Skip malformed or orphaned (ArnsRecord missing).
|
|
1308
1656
|
}
|
|
1309
1657
|
}
|
|
1310
1658
|
return paginate(items, params);
|
|
@@ -1375,6 +1723,56 @@ export class SolanaARIOReadable {
|
|
|
1375
1723
|
}));
|
|
1376
1724
|
return paginate(items, params);
|
|
1377
1725
|
}
|
|
1726
|
+
/**
|
|
1727
|
+
* Enumerate every delegation that has pending (unsettled) rewards — the work
|
|
1728
|
+
* list for the permissionless `compound_delegation_rewards` crank. Pending is
|
|
1729
|
+
* computed from the gateway's reward-per-share accumulator (mirrors
|
|
1730
|
+
* {@link computeLiveDelegationBalance}); the crank only changes balances, so
|
|
1731
|
+
* rewards already accrue correctly without it.
|
|
1732
|
+
*
|
|
1733
|
+
* Skips delegations whose gateway is `Leaving` (those settle through
|
|
1734
|
+
* `claim_delegate_from_leaving_gateway`, not compounding) and any below
|
|
1735
|
+
* `minPendingRewards` — compounding sub-threshold dust just advances
|
|
1736
|
+
* `reward_debt` for no balance gain. Feed the result, chunked, to
|
|
1737
|
+
* `SolanaARIOWriteable.compoundDelegationRewardsBatch`.
|
|
1738
|
+
*/
|
|
1739
|
+
async getDelegationsToCompound(params) {
|
|
1740
|
+
const minPending = params?.minPendingRewards ?? 0;
|
|
1741
|
+
// One scan for gateways → accumulator + status.
|
|
1742
|
+
const gatewayAccounts = await this.getAccountsByDiscriminator(this.garProgram, GATEWAY_DISCRIMINATOR);
|
|
1743
|
+
const gateways = new Map();
|
|
1744
|
+
for (const { data } of gatewayAccounts) {
|
|
1745
|
+
try {
|
|
1746
|
+
const gw = deserializeGatewayWithAccumulator(data);
|
|
1747
|
+
gateways.set(gw.operator, {
|
|
1748
|
+
cumulativeRewardPerToken: gw.cumulativeRewardPerToken,
|
|
1749
|
+
status: gw.status,
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1752
|
+
catch {
|
|
1753
|
+
// Skip malformed.
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
// One scan for delegations; decode then delegate the selection logic to the
|
|
1757
|
+
// pure `selectCompoundableDelegations` (unit-tested in delegation-math).
|
|
1758
|
+
const delegationAccounts = await this.getAccountsByDiscriminator(this.garProgram, DELEGATION_DISCRIMINATOR);
|
|
1759
|
+
const delegations = [];
|
|
1760
|
+
for (const { data } of delegationAccounts) {
|
|
1761
|
+
try {
|
|
1762
|
+
const del = deserializeDelegation(data);
|
|
1763
|
+
delegations.push({
|
|
1764
|
+
gateway: del.gateway,
|
|
1765
|
+
delegator: del.delegator,
|
|
1766
|
+
delegatedStake: del.delegatedStake,
|
|
1767
|
+
rewardDebt: del.rewardDebt,
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
catch {
|
|
1771
|
+
// Skip malformed.
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
return selectCompoundableDelegations(delegations, gateways, minPending);
|
|
1775
|
+
}
|
|
1378
1776
|
async getAllGatewayVaults(params) {
|
|
1379
1777
|
const accounts = await this.getAccountsByDiscriminator(this.garProgram, WITHDRAWAL_DISCRIMINATOR);
|
|
1380
1778
|
const items = [];
|
|
@@ -1416,7 +1814,7 @@ export class SolanaARIOReadable {
|
|
|
1416
1814
|
*/
|
|
1417
1815
|
async getExpiredArnsRecords(now) {
|
|
1418
1816
|
const [arnsConfigPda] = await getArnsSettingsPDA(this.arnsProgram);
|
|
1419
|
-
const cfgAccount = await this.
|
|
1817
|
+
const cfgAccount = await this.getCachedAccount(arnsConfigPda);
|
|
1420
1818
|
if (!cfgAccount.exists)
|
|
1421
1819
|
return [];
|
|
1422
1820
|
const cfg = getArnsConfigDecoder().decode(cfgAccount.data);
|
|
@@ -1451,7 +1849,7 @@ export class SolanaARIOReadable {
|
|
|
1451
1849
|
*/
|
|
1452
1850
|
async getExpiredReturnedNames(now) {
|
|
1453
1851
|
const [arnsConfigPda] = await getArnsSettingsPDA(this.arnsProgram);
|
|
1454
|
-
const cfgAccount = await this.
|
|
1852
|
+
const cfgAccount = await this.getCachedAccount(arnsConfigPda);
|
|
1455
1853
|
if (!cfgAccount.exists)
|
|
1456
1854
|
return [];
|
|
1457
1855
|
const cfg = getArnsConfigDecoder().decode(cfgAccount.data);
|
|
@@ -1524,8 +1922,21 @@ export class SolanaARIOReadable {
|
|
|
1524
1922
|
return out;
|
|
1525
1923
|
}
|
|
1526
1924
|
/**
|
|
1527
|
-
* Enumerate Gateway PDAs
|
|
1528
|
-
*
|
|
1925
|
+
* Enumerate Gateway PDAs that are candidates for `finalizeGone` GC — i.e.
|
|
1926
|
+
* those whose `status == Leaving`.
|
|
1927
|
+
*
|
|
1928
|
+
* NOTE: despite the historical name, this returns `Leaving` (not `Gone`)
|
|
1929
|
+
* gateways. `Gone` is NOT a persistent discovery state: the on-chain
|
|
1930
|
+
* `finalize_gone` instruction accepts a `Leaving` gateway, flips it to
|
|
1931
|
+
* `Gone`, and closes the Gateway PDA in the *same* instruction
|
|
1932
|
+
* (programs/ario-gar/src/instructions/gateway.rs::finalize_gone), so a
|
|
1933
|
+
* gateway is never observably parked at `Gone`. Filtering on `Gone` matched
|
|
1934
|
+
* nothing and left Leaving gateways un-GC'd. Time/delegation eligibility is
|
|
1935
|
+
* still enforced on-chain (`finalize_gone` reverts early if the leave window
|
|
1936
|
+
* hasn't elapsed or delegations remain), so over-returning not-yet-eligible
|
|
1937
|
+
* Leaving gateways is safe — the tx just no-ops/reverts.
|
|
1938
|
+
*
|
|
1939
|
+
* @deprecated Prefer {@link getLeavingGateways} — same result, accurate name.
|
|
1529
1940
|
*/
|
|
1530
1941
|
async getGoneGateways() {
|
|
1531
1942
|
const accounts = await this.getAccountsByDiscriminator(this.garProgram, GATEWAY_DISCRIMINATOR);
|
|
@@ -1534,7 +1945,7 @@ export class SolanaARIOReadable {
|
|
|
1534
1945
|
for (const { pubkey, data } of accounts) {
|
|
1535
1946
|
try {
|
|
1536
1947
|
const g = decoder.decode(data);
|
|
1537
|
-
if (g.status === GatewayStatus.
|
|
1948
|
+
if (g.status === GatewayStatus.Leaving) {
|
|
1538
1949
|
out.push({ pubkey, operator: g.operator });
|
|
1539
1950
|
}
|
|
1540
1951
|
}
|
|
@@ -1544,6 +1955,47 @@ export class SolanaARIOReadable {
|
|
|
1544
1955
|
}
|
|
1545
1956
|
return out;
|
|
1546
1957
|
}
|
|
1958
|
+
/**
|
|
1959
|
+
* Enumerate Gateway PDAs whose `status == Leaving` — the persistent
|
|
1960
|
+
* pre-finalization state that `finalizeGone` GC's. Alias for
|
|
1961
|
+
* {@link getGoneGateways} with a name that matches the on-chain state.
|
|
1962
|
+
*/
|
|
1963
|
+
async getLeavingGateways() {
|
|
1964
|
+
return this.getGoneGateways();
|
|
1965
|
+
}
|
|
1966
|
+
/**
|
|
1967
|
+
* Enumerate Joined Gateway PDAs whose delegation has been DISABLED
|
|
1968
|
+
* (`allow_delegated_staking == false`) yet still hold delegated stake
|
|
1969
|
+
* (`total_delegated_stake > 0`) — i.e. delegates that an operator's disable
|
|
1970
|
+
* left stranded (WP §6.3 / Fix #6). Each such gateway's delegates must be
|
|
1971
|
+
* cranked out via
|
|
1972
|
+
* {@link SolanaARIOWriteable.claimDelegateFromDisabledGateway} (enumerate
|
|
1973
|
+
* them with {@link getGatewayDelegates}) before the operator can re-enable
|
|
1974
|
+
* delegation. This is the discovery primitive a cranker uses to sweep them.
|
|
1975
|
+
*/
|
|
1976
|
+
async getDisabledGatewaysWithDelegatedStake() {
|
|
1977
|
+
const accounts = await this.getAccountsByDiscriminator(this.garProgram, GATEWAY_DISCRIMINATOR);
|
|
1978
|
+
const decoder = getGatewayDecoder();
|
|
1979
|
+
const out = [];
|
|
1980
|
+
for (const { pubkey, data } of accounts) {
|
|
1981
|
+
try {
|
|
1982
|
+
const g = decoder.decode(data);
|
|
1983
|
+
if (g.status !== GatewayStatus.Joined)
|
|
1984
|
+
continue;
|
|
1985
|
+
if (!g.settings.allowDelegatedStaking && g.totalDelegatedStake > 0n) {
|
|
1986
|
+
out.push({
|
|
1987
|
+
pubkey,
|
|
1988
|
+
operator: g.operator,
|
|
1989
|
+
totalDelegatedStake: g.totalDelegatedStake,
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
catch {
|
|
1994
|
+
// skip malformed
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
return out;
|
|
1998
|
+
}
|
|
1547
1999
|
/**
|
|
1548
2000
|
* Enumerate Delegation PDAs with `amount == 0`. Eligible for
|
|
1549
2001
|
* `closeEmptyDelegation` (rent refund to the original delegator).
|
|
@@ -1643,7 +2095,7 @@ export class SolanaARIOReadable {
|
|
|
1643
2095
|
*/
|
|
1644
2096
|
async getArnsConfigRaw() {
|
|
1645
2097
|
const [pda] = await getArnsSettingsPDA(this.arnsProgram);
|
|
1646
|
-
const account = await this.
|
|
2098
|
+
const account = await this.getCachedAccount(pda);
|
|
1647
2099
|
if (!account.exists)
|
|
1648
2100
|
return null;
|
|
1649
2101
|
const cfg = getArnsConfigDecoder().decode(account.data);
|