@oobe-protocol-labs/synapse-sap-sdk 0.13.0 → 0.15.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/dist/cjs/accounts/index.js +286 -0
- package/dist/cjs/accounts/index.js.map +1 -0
- package/dist/cjs/client.js +125 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/constants/seeds.js +9 -9
- package/dist/cjs/constants/seeds.js.map +1 -1
- package/dist/cjs/constants.js +66 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/errors.js +260 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/events/index.js +37 -123
- package/dist/cjs/events/index.js.map +1 -1
- package/dist/cjs/idlTypes.js +4 -0
- package/dist/cjs/idlTypes.js.map +1 -0
- package/dist/cjs/index.js +75 -241
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/instructions/agent.js +90 -0
- package/dist/cjs/instructions/agent.js.map +1 -0
- package/dist/cjs/instructions/attestation.js +113 -0
- package/dist/cjs/instructions/attestation.js.map +1 -0
- package/dist/cjs/instructions/digest.js +29 -0
- package/dist/cjs/instructions/digest.js.map +1 -0
- package/dist/cjs/instructions/dispute.js +117 -0
- package/dist/cjs/instructions/dispute.js.map +1 -0
- package/dist/cjs/instructions/escrow.js +102 -0
- package/dist/cjs/instructions/escrow.js.map +1 -0
- package/dist/cjs/instructions/global.js +29 -0
- package/dist/cjs/instructions/global.js.map +1 -0
- package/dist/cjs/instructions/index.js +31 -0
- package/dist/cjs/instructions/index.js.map +1 -0
- package/dist/cjs/instructions/indexing.js +222 -0
- package/dist/cjs/instructions/indexing.js.map +1 -0
- package/dist/cjs/instructions/misc.js +74 -0
- package/dist/cjs/instructions/misc.js.map +1 -0
- package/dist/cjs/instructions/session.js +90 -0
- package/dist/cjs/instructions/session.js.map +1 -0
- package/dist/cjs/instructions/staking.js +133 -0
- package/dist/cjs/instructions/staking.js.map +1 -0
- package/dist/cjs/instructions/subscription.js +81 -0
- package/dist/cjs/instructions/subscription.js.map +1 -0
- package/dist/cjs/instructions/tools.js +110 -0
- package/dist/cjs/instructions/tools.js.map +1 -0
- package/dist/cjs/instructions/vault.js +107 -0
- package/dist/cjs/instructions/vault.js.map +1 -0
- package/dist/cjs/pdas/index.js +120 -0
- package/dist/cjs/pdas/index.js.map +1 -0
- package/dist/cjs/registries/fairscale.js +1 -1
- package/dist/cjs/registries/fairscale.js.map +1 -1
- package/dist/cjs/registries/metaplex-bridge.js +1 -1
- package/dist/cjs/registries/metaplex-bridge.js.map +1 -1
- package/dist/cjs/types.js +45 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils/escrow-validation.js +1 -1
- package/dist/cjs/utils/escrow-validation.js.map +1 -1
- package/dist/cjs/utils/index.js +32 -83
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/merchant-validator.js +5 -5
- package/dist/cjs/utils/merchant-validator.js.map +1 -1
- package/dist/cjs/utils/validate.js +236 -0
- package/dist/cjs/utils/validate.js.map +1 -0
- package/dist/cjs/utils/volume-curve.js +1 -1
- package/dist/cjs/utils/volume-curve.js.map +1 -1
- package/dist/esm/accounts/index.d.ts +11 -0
- package/dist/esm/accounts/index.d.ts.map +1 -0
- package/dist/esm/accounts/index.js +273 -0
- package/dist/esm/accounts/index.js.map +1 -0
- package/dist/esm/client.d.ts +55 -0
- package/dist/esm/client.d.ts.map +1 -0
- package/dist/esm/client.js +87 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/constants/addresses.d.ts +117 -0
- package/dist/esm/constants/addresses.d.ts.map +1 -0
- package/dist/esm/constants/index.d.ts +31 -0
- package/dist/esm/constants/index.d.ts.map +1 -0
- package/dist/esm/constants/limits.d.ts +149 -0
- package/dist/esm/constants/limits.d.ts.map +1 -0
- package/{src/constants/network.ts → dist/esm/constants/network.d.ts} +23 -31
- package/dist/esm/constants/network.d.ts.map +1 -0
- package/{src/constants/payments.ts → dist/esm/constants/payments.d.ts} +11 -35
- package/dist/esm/constants/payments.d.ts.map +1 -0
- package/{src/constants/programs.ts → dist/esm/constants/programs.d.ts} +6 -20
- package/dist/esm/constants/programs.d.ts.map +1 -0
- package/dist/esm/constants/seeds.d.ts +80 -0
- package/dist/esm/constants/seeds.d.ts.map +1 -0
- package/dist/esm/constants/seeds.js +9 -9
- package/dist/esm/constants/seeds.js.map +1 -1
- package/dist/esm/constants.d.ts +39 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +41 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/core/client.d.ts +452 -0
- package/dist/esm/core/client.d.ts.map +1 -0
- package/dist/esm/core/connection.d.ts +305 -0
- package/dist/esm/core/connection.d.ts.map +1 -0
- package/{src/core/index.ts → dist/esm/core/index.d.ts} +1 -1
- package/dist/esm/core/index.d.ts.map +1 -0
- package/dist/esm/errors/index.d.ts +276 -0
- package/dist/esm/errors/index.d.ts.map +1 -0
- package/dist/esm/errors.d.ts +119 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +252 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/events/geyser.d.ts +150 -0
- package/dist/esm/events/geyser.d.ts.map +1 -0
- package/dist/esm/events/index.d.ts +17 -0
- package/dist/esm/events/index.d.ts.map +1 -0
- package/dist/esm/events/index.js +34 -122
- package/dist/esm/events/index.js.map +1 -1
- package/{src/idl/index.ts → dist/esm/idl/index.d.ts} +9 -15
- package/dist/esm/idl/index.d.ts.map +1 -0
- package/dist/esm/idlTypes.d.ts +925 -0
- package/dist/esm/idlTypes.d.ts.map +1 -0
- package/dist/esm/idlTypes.js +3 -0
- package/dist/esm/idlTypes.js.map +1 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +15 -88
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/instructions/agent.d.ts +71 -0
- package/dist/esm/instructions/agent.d.ts.map +1 -0
- package/dist/esm/instructions/agent.js +86 -0
- package/dist/esm/instructions/agent.js.map +1 -0
- package/dist/esm/instructions/attestation.d.ts +76 -0
- package/dist/esm/instructions/attestation.d.ts.map +1 -0
- package/dist/esm/instructions/attestation.js +109 -0
- package/dist/esm/instructions/attestation.js.map +1 -0
- package/dist/esm/instructions/digest.d.ts +20 -0
- package/dist/esm/instructions/digest.d.ts.map +1 -0
- package/dist/esm/instructions/digest.js +25 -0
- package/dist/esm/instructions/digest.js.map +1 -0
- package/dist/esm/instructions/dispute.d.ts +81 -0
- package/dist/esm/instructions/dispute.d.ts.map +1 -0
- package/dist/esm/instructions/dispute.js +113 -0
- package/dist/esm/instructions/dispute.js.map +1 -0
- package/dist/esm/instructions/escrow.d.ts +79 -0
- package/dist/esm/instructions/escrow.d.ts.map +1 -0
- package/dist/esm/instructions/escrow.js +98 -0
- package/dist/esm/instructions/escrow.js.map +1 -0
- package/dist/esm/instructions/global.d.ts +14 -0
- package/dist/esm/instructions/global.d.ts.map +1 -0
- package/dist/esm/instructions/global.js +25 -0
- package/dist/esm/instructions/global.js.map +1 -0
- package/dist/esm/instructions/index.d.ts +14 -0
- package/dist/esm/instructions/index.d.ts.map +1 -0
- package/dist/esm/instructions/index.js +15 -0
- package/dist/esm/instructions/index.js.map +1 -0
- package/dist/esm/instructions/indexing.d.ts +150 -0
- package/dist/esm/instructions/indexing.d.ts.map +1 -0
- package/dist/esm/instructions/indexing.js +218 -0
- package/dist/esm/instructions/indexing.js.map +1 -0
- package/dist/esm/instructions/memory.d.ts +8 -0
- package/dist/esm/instructions/memory.d.ts.map +1 -0
- package/dist/esm/instructions/memory.js +234 -0
- package/dist/esm/instructions/memory.js.map +1 -0
- package/dist/esm/instructions/misc.d.ts +50 -0
- package/dist/esm/instructions/misc.d.ts.map +1 -0
- package/dist/esm/instructions/misc.js +70 -0
- package/dist/esm/instructions/misc.js.map +1 -0
- package/dist/esm/instructions/session.d.ts +57 -0
- package/dist/esm/instructions/session.d.ts.map +1 -0
- package/dist/esm/instructions/session.js +86 -0
- package/dist/esm/instructions/session.js.map +1 -0
- package/dist/esm/instructions/staking.d.ts +85 -0
- package/dist/esm/instructions/staking.d.ts.map +1 -0
- package/dist/esm/instructions/staking.js +129 -0
- package/dist/esm/instructions/staking.js.map +1 -0
- package/dist/esm/instructions/subscription.d.ts +50 -0
- package/dist/esm/instructions/subscription.d.ts.map +1 -0
- package/dist/esm/instructions/subscription.js +77 -0
- package/dist/esm/instructions/subscription.js.map +1 -0
- package/dist/esm/instructions/tools.d.ts +88 -0
- package/dist/esm/instructions/tools.d.ts.map +1 -0
- package/dist/esm/instructions/tools.js +106 -0
- package/dist/esm/instructions/tools.js.map +1 -0
- package/dist/esm/instructions/vault.d.ts +84 -0
- package/dist/esm/instructions/vault.d.ts.map +1 -0
- package/dist/esm/instructions/vault.js +103 -0
- package/dist/esm/instructions/vault.js.map +1 -0
- package/dist/esm/modules/agent.d.ts +166 -0
- package/dist/esm/modules/agent.d.ts.map +1 -0
- package/dist/esm/modules/attestation.d.ts +96 -0
- package/dist/esm/modules/attestation.d.ts.map +1 -0
- package/dist/esm/modules/base.d.ts +161 -0
- package/dist/esm/modules/base.d.ts.map +1 -0
- package/dist/esm/modules/escrow-v2.d.ts +169 -0
- package/dist/esm/modules/escrow-v2.d.ts.map +1 -0
- package/dist/esm/modules/feedback.d.ts +105 -0
- package/dist/esm/modules/feedback.d.ts.map +1 -0
- package/{src/modules/index.ts → dist/esm/modules/index.d.ts} +1 -1
- package/dist/esm/modules/index.d.ts.map +1 -0
- package/dist/esm/modules/indexing.d.ts +200 -0
- package/dist/esm/modules/indexing.d.ts.map +1 -0
- package/dist/esm/modules/ledger.d.ts +150 -0
- package/dist/esm/modules/ledger.d.ts.map +1 -0
- package/dist/esm/modules/receipt.d.ts +77 -0
- package/dist/esm/modules/receipt.d.ts.map +1 -0
- package/dist/esm/modules/staking.d.ts +51 -0
- package/dist/esm/modules/staking.d.ts.map +1 -0
- package/dist/esm/modules/subscription.d.ts +33 -0
- package/dist/esm/modules/subscription.d.ts.map +1 -0
- package/dist/esm/modules/tools.d.ts +182 -0
- package/dist/esm/modules/tools.d.ts.map +1 -0
- package/dist/esm/modules/vault.d.ts +240 -0
- package/dist/esm/modules/vault.d.ts.map +1 -0
- package/dist/esm/parser/client.d.ts +123 -0
- package/dist/esm/parser/client.d.ts.map +1 -0
- package/dist/esm/parser/complete.d.ts +90 -0
- package/dist/esm/parser/complete.d.ts.map +1 -0
- package/{src/parser/index.ts → dist/esm/parser/index.d.ts} +6 -37
- package/dist/esm/parser/index.d.ts.map +1 -0
- package/dist/esm/parser/inner.d.ts +114 -0
- package/dist/esm/parser/inner.d.ts.map +1 -0
- package/{src/parser/instructions.ts → dist/esm/parser/instructions.d.ts} +4 -63
- package/dist/esm/parser/instructions.d.ts.map +1 -0
- package/dist/esm/parser/transaction.d.ts +77 -0
- package/dist/esm/parser/transaction.d.ts.map +1 -0
- package/dist/esm/parser/types.d.ts +154 -0
- package/dist/esm/parser/types.d.ts.map +1 -0
- package/{src/pda/index.ts → dist/esm/pda/index.d.ts} +33 -442
- package/dist/esm/pda/index.d.ts.map +1 -0
- package/dist/esm/pdas/index.d.ts +37 -0
- package/dist/esm/pdas/index.d.ts.map +1 -0
- package/dist/esm/pdas/index.js +101 -0
- package/dist/esm/pdas/index.js.map +1 -0
- package/dist/esm/plugin/index.d.ts +171 -0
- package/dist/esm/plugin/index.d.ts.map +1 -0
- package/dist/esm/plugin/protocols.d.ts +152 -0
- package/dist/esm/plugin/protocols.d.ts.map +1 -0
- package/dist/esm/plugin/schemas.d.ts +829 -0
- package/dist/esm/plugin/schemas.d.ts.map +1 -0
- package/dist/esm/postgres/adapter.d.ts +355 -0
- package/dist/esm/postgres/adapter.d.ts.map +1 -0
- package/dist/esm/postgres/index.d.ts +24 -0
- package/dist/esm/postgres/index.d.ts.map +1 -0
- package/dist/esm/postgres/serializers.d.ts +30 -0
- package/dist/esm/postgres/serializers.d.ts.map +1 -0
- package/dist/esm/postgres/sync.d.ts +156 -0
- package/dist/esm/postgres/sync.d.ts.map +1 -0
- package/dist/esm/postgres/types.d.ts +167 -0
- package/dist/esm/postgres/types.d.ts.map +1 -0
- package/dist/esm/registries/builder.d.ts +340 -0
- package/dist/esm/registries/builder.d.ts.map +1 -0
- package/dist/esm/registries/discovery.d.ts +333 -0
- package/dist/esm/registries/discovery.d.ts.map +1 -0
- package/dist/esm/registries/fairscale.d.ts +680 -0
- package/dist/esm/registries/fairscale.d.ts.map +1 -0
- package/dist/esm/registries/fairscale.js +1 -1
- package/dist/esm/registries/fairscale.js.map +1 -1
- package/dist/esm/registries/index.d.ts +52 -0
- package/dist/esm/registries/index.d.ts.map +1 -0
- package/dist/esm/registries/metaplex-bridge.d.ts +489 -0
- package/dist/esm/registries/metaplex-bridge.d.ts.map +1 -0
- package/dist/esm/registries/metaplex-bridge.js +1 -1
- package/dist/esm/registries/metaplex-bridge.js.map +1 -1
- package/dist/esm/registries/session.d.ts +323 -0
- package/dist/esm/registries/session.d.ts.map +1 -0
- package/dist/esm/registries/x402.d.ts +530 -0
- package/dist/esm/registries/x402.d.ts.map +1 -0
- package/dist/esm/types/accounts.d.ts +765 -0
- package/dist/esm/types/accounts.d.ts.map +1 -0
- package/dist/esm/types/common.d.ts +166 -0
- package/dist/esm/types/common.d.ts.map +1 -0
- package/dist/esm/types/endpoint.d.ts +161 -0
- package/dist/esm/types/endpoint.d.ts.map +1 -0
- package/dist/esm/types/enums.d.ts +353 -0
- package/dist/esm/types/enums.d.ts.map +1 -0
- package/dist/esm/types/index.d.ts +29 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/dist/esm/types/instructions.d.ts +400 -0
- package/dist/esm/types/instructions.d.ts.map +1 -0
- package/dist/esm/types.d.ts +236 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +40 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/anchor-errors.d.ts +61 -0
- package/dist/esm/utils/anchor-errors.d.ts.map +1 -0
- package/dist/esm/utils/endpoint-validator.d.ts +110 -0
- package/dist/esm/utils/endpoint-validator.d.ts.map +1 -0
- package/dist/esm/utils/escrow-validation.d.ts +145 -0
- package/dist/esm/utils/escrow-validation.d.ts.map +1 -0
- package/dist/esm/utils/escrow-validation.js +1 -1
- package/dist/esm/utils/escrow-validation.js.map +1 -1
- package/{src/utils/hash.ts → dist/esm/utils/hash.d.ts} +4 -42
- package/dist/esm/utils/hash.d.ts.map +1 -0
- package/dist/esm/utils/index.d.ts +6 -0
- package/dist/esm/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/index.js +16 -33
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/merchant-validator.d.ts +176 -0
- package/dist/esm/utils/merchant-validator.d.ts.map +1 -0
- package/dist/esm/utils/merchant-validator.js +1 -1
- package/dist/esm/utils/merchant-validator.js.map +1 -1
- package/dist/esm/utils/network-normalizer.d.ts +120 -0
- package/dist/esm/utils/network-normalizer.d.ts.map +1 -0
- package/dist/esm/utils/priority-fee.d.ts +205 -0
- package/dist/esm/utils/priority-fee.d.ts.map +1 -0
- package/dist/esm/utils/rpc-strategy.d.ts +172 -0
- package/dist/esm/utils/rpc-strategy.d.ts.map +1 -0
- package/dist/esm/utils/schemas.d.ts +351 -0
- package/dist/esm/utils/schemas.d.ts.map +1 -0
- package/{src/utils/serialization.ts → dist/esm/utils/serialization.d.ts} +3 -32
- package/dist/esm/utils/serialization.d.ts.map +1 -0
- package/dist/esm/utils/validate.d.ts +66 -0
- package/dist/esm/utils/validate.d.ts.map +1 -0
- package/dist/esm/utils/validate.js +221 -0
- package/dist/esm/utils/validate.js.map +1 -0
- package/{src/utils/validation.ts → dist/esm/utils/validation.d.ts} +2 -9
- package/dist/esm/utils/validation.d.ts.map +1 -0
- package/{src/utils/volume-curve.ts → dist/esm/utils/volume-curve.d.ts} +2 -73
- package/dist/esm/utils/volume-curve.d.ts.map +1 -0
- package/dist/esm/utils/volume-curve.js +1 -1
- package/dist/esm/utils/volume-curve.js.map +1 -1
- package/dist/esm/utils/x402-direct.d.ts +114 -0
- package/dist/esm/utils/x402-direct.d.ts.map +1 -0
- package/dist/types/constants/seeds.d.ts +2 -0
- package/dist/types/constants/seeds.d.ts.map +1 -1
- package/dist/types/core/client.d.ts +21 -6
- package/dist/types/core/client.d.ts.map +1 -1
- package/dist/types/errors/index.d.ts +59 -0
- package/dist/types/errors/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/agent.d.ts +9 -19
- package/dist/types/modules/agent.d.ts.map +1 -1
- package/dist/types/modules/attestation.d.ts.map +1 -1
- package/dist/types/modules/base.d.ts +54 -0
- package/dist/types/modules/base.d.ts.map +1 -1
- package/dist/types/modules/escrow-v2.d.ts +117 -1
- package/dist/types/modules/escrow-v2.d.ts.map +1 -1
- package/dist/types/modules/index.d.ts +1 -2
- package/dist/types/modules/index.d.ts.map +1 -1
- package/dist/types/modules/receipt.d.ts +14 -0
- package/dist/types/modules/receipt.d.ts.map +1 -1
- package/dist/types/modules/subscription.d.ts.map +1 -1
- package/dist/types/modules/tools.d.ts +0 -10
- package/dist/types/modules/tools.d.ts.map +1 -1
- package/dist/types/modules/vault.d.ts.map +1 -1
- package/dist/types/pda/index.d.ts +17 -0
- package/dist/types/pda/index.d.ts.map +1 -1
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/registries/builder.d.ts +2 -9
- package/dist/types/registries/builder.d.ts.map +1 -1
- package/dist/types/registries/metaplex-bridge.d.ts.map +1 -1
- package/dist/types/registries/session.d.ts +3 -9
- package/dist/types/registries/session.d.ts.map +1 -1
- package/dist/types/registries/x402.d.ts +2 -9
- package/dist/types/registries/x402.d.ts.map +1 -1
- package/dist/types/types/accounts.d.ts +52 -0
- package/dist/types/types/accounts.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utils/rpc-strategy.d.ts +7 -0
- package/dist/types/utils/rpc-strategy.d.ts.map +1 -1
- package/package.json +59 -183
- package/src/constants/addresses.ts +0 -162
- package/src/constants/index.ts +0 -69
- package/src/constants/limits.ts +0 -165
- package/src/constants/seeds.ts +0 -85
- package/src/core/client.ts +0 -583
- package/src/core/connection.ts +0 -461
- package/src/errors/index.ts +0 -346
- package/src/events/geyser.ts +0 -384
- package/src/events/index.ts +0 -335
- package/src/events/yellowstone.d.ts +0 -7
- package/src/idl/synapse_agent_sap.json +0 -14595
- package/src/index.ts +0 -421
- package/src/modules/agent.ts +0 -319
- package/src/modules/attestation.ts +0 -168
- package/src/modules/base.ts +0 -247
- package/src/modules/escrow-v2.ts +0 -871
- package/src/modules/escrow.ts +0 -439
- package/src/modules/feedback.ts +0 -186
- package/src/modules/indexing.ts +0 -444
- package/src/modules/ledger.ts +0 -262
- package/src/modules/receipt.ts +0 -212
- package/src/modules/staking.ts +0 -223
- package/src/modules/subscription.ts +0 -147
- package/src/modules/tools.ts +0 -454
- package/src/modules/vault.ts +0 -558
- package/src/parser/client.ts +0 -211
- package/src/parser/complete.ts +0 -232
- package/src/parser/inner.ts +0 -255
- package/src/parser/transaction.ts +0 -200
- package/src/parser/types.ts +0 -182
- package/src/plugin/index.ts +0 -1224
- package/src/plugin/protocols.ts +0 -404
- package/src/plugin/schemas.ts +0 -941
- package/src/postgres/adapter.ts +0 -904
- package/src/postgres/index.ts +0 -59
- package/src/postgres/schema.sql +0 -683
- package/src/postgres/serializers.ts +0 -485
- package/src/postgres/sync.ts +0 -340
- package/src/postgres/types.ts +0 -245
- package/src/registries/builder.ts +0 -607
- package/src/registries/discovery.ts +0 -572
- package/src/registries/fairscale.ts +0 -1278
- package/src/registries/index.ts +0 -143
- package/src/registries/metaplex-bridge.ts +0 -1199
- package/src/registries/session.ts +0 -613
- package/src/registries/x402.ts +0 -1048
- package/src/types/accounts.ts +0 -858
- package/src/types/common.ts +0 -187
- package/src/types/endpoint.ts +0 -181
- package/src/types/enums.ts +0 -333
- package/src/types/index.ts +0 -121
- package/src/types/instructions.ts +0 -453
- package/src/utils/anchor-errors.ts +0 -461
- package/src/utils/endpoint-validator.ts +0 -300
- package/src/utils/escrow-validation.ts +0 -301
- package/src/utils/index.ts +0 -118
- package/src/utils/merchant-validator.ts +0 -359
- package/src/utils/network-normalizer.ts +0 -240
- package/src/utils/priority-fee.ts +0 -325
- package/src/utils/rpc-strategy.ts +0 -322
- package/src/utils/schemas.ts +0 -359
- package/src/utils/x402-direct.ts +0 -370
- /package/dist/{types → esm}/modules/escrow.d.ts +0 -0
- /package/dist/{types → esm}/modules/escrow.d.ts.map +0 -0
|
@@ -30,42 +30,11 @@
|
|
|
30
30
|
* } from "@synapse-sap/sdk/parser";
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
ParsedSapTransaction,
|
|
39
|
-
ParseFilterOptions,
|
|
40
|
-
SapInstructionCoder,
|
|
41
|
-
} from "./types";
|
|
42
|
-
|
|
43
|
-
// ── Case 2A: from TransactionResponse ────────────────
|
|
44
|
-
export {
|
|
45
|
-
parseSapInstructionsFromTransaction,
|
|
46
|
-
parseSapInstructionNamesFromTransaction,
|
|
47
|
-
} from "./transaction";
|
|
48
|
-
|
|
49
|
-
// ── Case 2B: from TransactionInstruction[] ───────────
|
|
50
|
-
export {
|
|
51
|
-
parseSapInstructionsFromList,
|
|
52
|
-
parseSapInstructionNamesFromList,
|
|
53
|
-
containsSapInstruction,
|
|
54
|
-
} from "./instructions";
|
|
55
|
-
|
|
56
|
-
// ── Case 2 Complete: instructions + events + inner ───
|
|
57
|
-
export {
|
|
58
|
-
parseSapTransactionComplete,
|
|
59
|
-
parseSapTransactionBatch,
|
|
60
|
-
} from "./complete";
|
|
61
|
-
|
|
62
|
-
// ── Inner instruction utilities ──────────────────────
|
|
63
|
-
export {
|
|
64
|
-
decodeInnerInstructions,
|
|
65
|
-
filterSapInnerInstructions,
|
|
66
|
-
extractAccountKeys,
|
|
67
|
-
} from "./inner";
|
|
33
|
+
export type { DecodedSapInstruction, DecodedInnerInstruction, ParsedSapTransaction, ParseFilterOptions, SapInstructionCoder, } from "./types";
|
|
34
|
+
export { parseSapInstructionsFromTransaction, parseSapInstructionNamesFromTransaction, } from "./transaction";
|
|
35
|
+
export { parseSapInstructionsFromList, parseSapInstructionNamesFromList, containsSapInstruction, } from "./instructions";
|
|
36
|
+
export { parseSapTransactionComplete, parseSapTransactionBatch, } from "./complete";
|
|
37
|
+
export { decodeInnerInstructions, filterSapInnerInstructions, extractAccountKeys, } from "./inner";
|
|
68
38
|
export type { CompiledInner, InnerInstructionGroup } from "./inner";
|
|
69
|
-
|
|
70
|
-
// ── OOP wrapper (for SapClient integration) ──────────
|
|
71
39
|
export { TransactionParser } from "./client";
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,YAAY,EACV,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,mCAAmC,EACnC,uCAAuC,GACxC,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module parser/inner
|
|
3
|
+
* @description Decode inner (CPI) instructions from transaction metadata.
|
|
4
|
+
*
|
|
5
|
+
* When a SAP instruction triggers cross-program invocations, the
|
|
6
|
+
* resulting inner instructions appear in `tx.meta.innerInstructions`.
|
|
7
|
+
* These are stored in a "compiled" format that references account
|
|
8
|
+
* indices rather than full public keys.
|
|
9
|
+
*
|
|
10
|
+
* This module reconstructs the full account keys from the transaction
|
|
11
|
+
* message's account list and decodes any inner calls that target the
|
|
12
|
+
* SAP program.
|
|
13
|
+
*
|
|
14
|
+
* @category Parser
|
|
15
|
+
* @since v0.5.0
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { decodeInnerInstructions } from "@synapse-sap/sdk/parser";
|
|
20
|
+
*
|
|
21
|
+
* const inner = decodeInnerInstructions(
|
|
22
|
+
* tx.meta?.innerInstructions ?? [],
|
|
23
|
+
* accountKeys,
|
|
24
|
+
* program.coder.instruction,
|
|
25
|
+
* SAP_PROGRAM_ID,
|
|
26
|
+
* );
|
|
27
|
+
* for (const cpi of inner) {
|
|
28
|
+
* if (cpi.name) console.log("SAP CPI:", cpi.name);
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import { PublicKey } from "@solana/web3.js";
|
|
33
|
+
import type { DecodedInnerInstruction, SapInstructionCoder } from "./types";
|
|
34
|
+
/**
|
|
35
|
+
* Shape of a single compiled inner instruction from `tx.meta.innerInstructions`.
|
|
36
|
+
* Mirrors the Solana RPC `CompiledInnerInstruction` format.
|
|
37
|
+
*
|
|
38
|
+
* @interface CompiledInner
|
|
39
|
+
* @category Parser
|
|
40
|
+
* @since v0.5.0
|
|
41
|
+
*/
|
|
42
|
+
export interface CompiledInner {
|
|
43
|
+
readonly programIdIndex: number;
|
|
44
|
+
readonly accounts: number[];
|
|
45
|
+
readonly data: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Top-level inner instruction group from the transaction metadata.
|
|
49
|
+
* Each group corresponds to one outer instruction by `index`.
|
|
50
|
+
*
|
|
51
|
+
* @interface InnerInstructionGroup
|
|
52
|
+
* @category Parser
|
|
53
|
+
* @since v0.5.0
|
|
54
|
+
*/
|
|
55
|
+
export interface InnerInstructionGroup {
|
|
56
|
+
readonly index: number;
|
|
57
|
+
readonly instructions: CompiledInner[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Decode inner (CPI) instructions from transaction metadata.
|
|
61
|
+
*
|
|
62
|
+
* Reconstructs full public keys from the compiled account indices
|
|
63
|
+
* and attempts to decode each inner instruction that targets the
|
|
64
|
+
* SAP program. Non-SAP inner instructions are included in the
|
|
65
|
+
* result with `name: null` and `args: null`.
|
|
66
|
+
*
|
|
67
|
+
* @param innerInstructionGroups - The `tx.meta.innerInstructions` array.
|
|
68
|
+
* @param accountKeys - Ordered list of all account public keys from the
|
|
69
|
+
* transaction message (`staticAccountKeys` for versioned, or
|
|
70
|
+
* `accountKeys` for legacy).
|
|
71
|
+
* @param coder - An Anchor instruction coder built from the SAP IDL.
|
|
72
|
+
* @param sapProgramId - The SAP program public key.
|
|
73
|
+
* @returns An array of decoded inner instructions.
|
|
74
|
+
*
|
|
75
|
+
* @category Parser
|
|
76
|
+
* @since v0.5.0
|
|
77
|
+
*/
|
|
78
|
+
export declare function decodeInnerInstructions(innerInstructionGroups: InnerInstructionGroup[], accountKeys: PublicKey[], coder: SapInstructionCoder, sapProgramId: PublicKey): DecodedInnerInstruction[];
|
|
79
|
+
/**
|
|
80
|
+
* Filter decoded inner instructions to only those targeting the SAP program.
|
|
81
|
+
*
|
|
82
|
+
* @param inner - The full inner instruction list from {@link decodeInnerInstructions}.
|
|
83
|
+
* @returns Only inner instructions where `name` is not `null`.
|
|
84
|
+
*
|
|
85
|
+
* @category Parser
|
|
86
|
+
* @since v0.5.0
|
|
87
|
+
*/
|
|
88
|
+
export declare function filterSapInnerInstructions(inner: DecodedInnerInstruction[]): DecodedInnerInstruction[];
|
|
89
|
+
/**
|
|
90
|
+
* Extract the full ordered list of account keys from a transaction
|
|
91
|
+
* response, handling both legacy and versioned formats.
|
|
92
|
+
*
|
|
93
|
+
* For versioned transactions that include loaded addresses (from
|
|
94
|
+
* address lookup tables), these are appended after the static keys
|
|
95
|
+
* in the order: static, writable loaded, readonly loaded.
|
|
96
|
+
*
|
|
97
|
+
* @param tx - The raw transaction response from RPC.
|
|
98
|
+
* @returns An ordered array of all account public keys.
|
|
99
|
+
*
|
|
100
|
+
* @category Parser
|
|
101
|
+
* @since v0.5.0
|
|
102
|
+
*/
|
|
103
|
+
export declare function extractAccountKeys(tx: {
|
|
104
|
+
transaction: {
|
|
105
|
+
message: any;
|
|
106
|
+
};
|
|
107
|
+
meta?: {
|
|
108
|
+
loadedAddresses?: {
|
|
109
|
+
writable: PublicKey[];
|
|
110
|
+
readonly: PublicKey[];
|
|
111
|
+
} | null;
|
|
112
|
+
} | null;
|
|
113
|
+
}): PublicKey[];
|
|
114
|
+
//# sourceMappingURL=inner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inner.d.ts","sourceRoot":"","sources":["../../../src/parser/inner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAM5E;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,aAAa,EAAE,CAAC;CACxC;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CACrC,sBAAsB,EAAE,qBAAqB,EAAE,EAC/C,WAAW,EAAE,SAAS,EAAE,EACxB,KAAK,EAAE,mBAAmB,EAC1B,YAAY,EAAE,SAAS,GACtB,uBAAuB,EAAE,CAwC3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,uBAAuB,EAAE,GAC/B,uBAAuB,EAAE,CAE3B;AAMD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,EAAE;IACF,WAAW,EAAE;QAEX,OAAO,EAAE,GAAG,CAAC;KACd,CAAC;IACF,IAAI,CAAC,EAAE;QACL,eAAe,CAAC,EAAE;YAChB,QAAQ,EAAE,SAAS,EAAE,CAAC;YACtB,QAAQ,EAAE,SAAS,EAAE,CAAC;SACvB,GAAG,IAAI,CAAC;KACV,GAAG,IAAI,CAAC;CACV,GACA,SAAS,EAAE,CAuBb"}
|
|
@@ -24,14 +24,8 @@
|
|
|
24
24
|
* }
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
|
|
28
27
|
import type { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
29
28
|
import type { DecodedSapInstruction, SapInstructionCoder } from "./types";
|
|
30
|
-
|
|
31
|
-
// ================================================================
|
|
32
|
-
// Public API
|
|
33
|
-
// ================================================================
|
|
34
|
-
|
|
35
29
|
/**
|
|
36
30
|
* Decode an array of `TransactionInstruction` and return only the
|
|
37
31
|
* SAP instructions with their decoded names and arguments.
|
|
@@ -50,28 +44,7 @@ import type { DecodedSapInstruction, SapInstructionCoder } from "./types";
|
|
|
50
44
|
* @category Parser
|
|
51
45
|
* @since v0.5.0
|
|
52
46
|
*/
|
|
53
|
-
export function parseSapInstructionsFromList(
|
|
54
|
-
instructions: TransactionInstruction[],
|
|
55
|
-
coder: SapInstructionCoder,
|
|
56
|
-
sapProgramId: PublicKey,
|
|
57
|
-
): DecodedSapInstruction[] {
|
|
58
|
-
const results: DecodedSapInstruction[] = [];
|
|
59
|
-
|
|
60
|
-
for (const ix of instructions) {
|
|
61
|
-
if (!ix.programId.equals(sapProgramId)) continue;
|
|
62
|
-
|
|
63
|
-
const decoded = safeDecodeInstruction(coder, ix.data);
|
|
64
|
-
results.push({
|
|
65
|
-
name: decoded?.name ?? "unknown",
|
|
66
|
-
args: decoded?.data ?? null,
|
|
67
|
-
accounts: ix.keys.map((k) => k.pubkey),
|
|
68
|
-
raw: ix,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return results;
|
|
73
|
-
}
|
|
74
|
-
|
|
47
|
+
export declare function parseSapInstructionsFromList(instructions: TransactionInstruction[], coder: SapInstructionCoder, sapProgramId: PublicKey): DecodedSapInstruction[];
|
|
75
48
|
/**
|
|
76
49
|
* Return only the instruction names for SAP instructions in the list.
|
|
77
50
|
*
|
|
@@ -86,16 +59,7 @@ export function parseSapInstructionsFromList(
|
|
|
86
59
|
* @category Parser
|
|
87
60
|
* @since v0.5.0
|
|
88
61
|
*/
|
|
89
|
-
export function parseSapInstructionNamesFromList(
|
|
90
|
-
instructions: TransactionInstruction[],
|
|
91
|
-
coder: SapInstructionCoder,
|
|
92
|
-
sapProgramId: PublicKey,
|
|
93
|
-
): string[] {
|
|
94
|
-
return parseSapInstructionsFromList(instructions, coder, sapProgramId).map(
|
|
95
|
-
(ix) => ix.name,
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
62
|
+
export declare function parseSapInstructionNamesFromList(instructions: TransactionInstruction[], coder: SapInstructionCoder, sapProgramId: PublicKey): string[];
|
|
99
63
|
/**
|
|
100
64
|
* Check whether any instruction in the list targets the SAP program.
|
|
101
65
|
*
|
|
@@ -108,28 +72,5 @@ export function parseSapInstructionNamesFromList(
|
|
|
108
72
|
* @category Parser
|
|
109
73
|
* @since v0.5.0
|
|
110
74
|
*/
|
|
111
|
-
export function containsSapInstruction(
|
|
112
|
-
|
|
113
|
-
sapProgramId: PublicKey,
|
|
114
|
-
): boolean {
|
|
115
|
-
return instructions.some((ix) => ix.programId.equals(sapProgramId));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// ================================================================
|
|
119
|
-
// Internal
|
|
120
|
-
// ================================================================
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* @internal
|
|
124
|
-
*/
|
|
125
|
-
function safeDecodeInstruction(
|
|
126
|
-
coder: SapInstructionCoder,
|
|
127
|
-
data: Buffer | Uint8Array,
|
|
128
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
129
|
-
): { name: string; data: Record<string, any> } | null {
|
|
130
|
-
try {
|
|
131
|
-
return coder.decode(Buffer.from(data));
|
|
132
|
-
} catch {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
75
|
+
export declare function containsSapInstruction(instructions: TransactionInstruction[], sapProgramId: PublicKey): boolean;
|
|
76
|
+
//# sourceMappingURL=instructions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../../src/parser/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAM1E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,sBAAsB,EAAE,EACtC,KAAK,EAAE,mBAAmB,EAC1B,YAAY,EAAE,SAAS,GACtB,qBAAqB,EAAE,CAgBzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gCAAgC,CAC9C,YAAY,EAAE,sBAAsB,EAAE,EACtC,KAAK,EAAE,mBAAmB,EAC1B,YAAY,EAAE,SAAS,GACtB,MAAM,EAAE,CAIV;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,sBAAsB,EAAE,EACtC,YAAY,EAAE,SAAS,GACtB,OAAO,CAET"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module parser/transaction
|
|
3
|
+
* @description Decode SAP instruction names from a raw `TransactionResponse`.
|
|
4
|
+
*
|
|
5
|
+
* This is "Case 2A": you have a transaction response object obtained
|
|
6
|
+
* from `connection.getTransaction(signature, ...)` and need to extract
|
|
7
|
+
* the SAP instruction names, arguments, and account keys.
|
|
8
|
+
*
|
|
9
|
+
* The function handles both legacy and versioned (v0) transactions
|
|
10
|
+
* by decompiling the message into `TransactionInstruction[]` and then
|
|
11
|
+
* filtering for instructions whose `programId` matches the SAP program.
|
|
12
|
+
*
|
|
13
|
+
* @category Parser
|
|
14
|
+
* @since v0.5.0
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { parseSapInstructionsFromTransaction } from "@synapse-sap/sdk/parser";
|
|
19
|
+
* import { SAP_PROGRAM_ID } from "@synapse-sap/sdk";
|
|
20
|
+
*
|
|
21
|
+
* const tx = await connection.getTransaction(sig, {
|
|
22
|
+
* commitment: "confirmed",
|
|
23
|
+
* maxSupportedTransactionVersion: 0,
|
|
24
|
+
* });
|
|
25
|
+
* if (!tx) throw new Error("Transaction not found");
|
|
26
|
+
*
|
|
27
|
+
* const decoded = parseSapInstructionsFromTransaction(
|
|
28
|
+
* tx,
|
|
29
|
+
* program.coder.instruction,
|
|
30
|
+
* SAP_PROGRAM_ID,
|
|
31
|
+
* );
|
|
32
|
+
* for (const ix of decoded) {
|
|
33
|
+
* console.log(ix.name, ix.args);
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
import { AddressLookupTableAccount, type PublicKey, type VersionedTransactionResponse, type TransactionResponse } from "@solana/web3.js";
|
|
38
|
+
import type { DecodedSapInstruction, SapInstructionCoder } from "./types";
|
|
39
|
+
/**
|
|
40
|
+
* Extract and decode SAP instructions from a transaction response.
|
|
41
|
+
*
|
|
42
|
+
* Supports both legacy (`TransactionResponse`) and versioned
|
|
43
|
+
* (`VersionedTransactionResponse`) formats. For versioned
|
|
44
|
+
* transactions that use address lookup tables, pass the resolved
|
|
45
|
+
* lookup table accounts so that `TransactionMessage.decompile`
|
|
46
|
+
* can reconstruct the full account list.
|
|
47
|
+
*
|
|
48
|
+
* @param tx - The transaction response from `connection.getTransaction`.
|
|
49
|
+
* @param coder - An Anchor instruction coder built from the SAP IDL.
|
|
50
|
+
* @param sapProgramId - The SAP program public key to filter by.
|
|
51
|
+
* @param addressLookupTables - Resolved lookup table accounts for v0 transactions.
|
|
52
|
+
* Required when the transaction uses address lookup tables; omit for legacy txs.
|
|
53
|
+
* @returns An array of decoded SAP instructions found in the transaction.
|
|
54
|
+
*
|
|
55
|
+
* @throws {Error} When the transaction message cannot be decompiled.
|
|
56
|
+
*
|
|
57
|
+
* @category Parser
|
|
58
|
+
* @since v0.5.0
|
|
59
|
+
*/
|
|
60
|
+
export declare function parseSapInstructionsFromTransaction(tx: TransactionResponse | VersionedTransactionResponse, coder: SapInstructionCoder, sapProgramId: PublicKey, addressLookupTables?: AddressLookupTableAccount[]): DecodedSapInstruction[];
|
|
61
|
+
/**
|
|
62
|
+
* Extract only the SAP instruction names from a transaction response.
|
|
63
|
+
*
|
|
64
|
+
* Lighter-weight alternative to {@link parseSapInstructionsFromTransaction}
|
|
65
|
+
* when you only need the instruction names without decoded arguments.
|
|
66
|
+
*
|
|
67
|
+
* @param tx - The transaction response.
|
|
68
|
+
* @param coder - An Anchor instruction coder built from the SAP IDL.
|
|
69
|
+
* @param sapProgramId - The SAP program public key.
|
|
70
|
+
* @param addressLookupTables - Resolved lookup table accounts for v0 transactions.
|
|
71
|
+
* @returns An array of instruction name strings.
|
|
72
|
+
*
|
|
73
|
+
* @category Parser
|
|
74
|
+
* @since v0.5.0
|
|
75
|
+
*/
|
|
76
|
+
export declare function parseSapInstructionNamesFromTransaction(tx: TransactionResponse | VersionedTransactionResponse, coder: SapInstructionCoder, sapProgramId: PublicKey, addressLookupTables?: AddressLookupTableAccount[]): string[];
|
|
77
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/parser/transaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAEL,yBAAyB,EACzB,KAAK,SAAS,EAEd,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,EACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAM1E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mCAAmC,CACjD,EAAE,EAAE,mBAAmB,GAAG,4BAA4B,EACtD,KAAK,EAAE,mBAAmB,EAC1B,YAAY,EAAE,SAAS,EACvB,mBAAmB,CAAC,EAAE,yBAAyB,EAAE,GAChD,qBAAqB,EAAE,CAGzB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uCAAuC,CACrD,EAAE,EAAE,mBAAmB,GAAG,4BAA4B,EACtD,KAAK,EAAE,mBAAmB,EAC1B,YAAY,EAAE,SAAS,EACvB,mBAAmB,CAAC,EAAE,yBAAyB,EAAE,GAChD,MAAM,EAAE,CAOV"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module parser/types
|
|
3
|
+
* @description Type definitions for SAP v2 transaction parsing.
|
|
4
|
+
*
|
|
5
|
+
* Provides strongly-typed interfaces for decoded instruction data,
|
|
6
|
+
* account metadata, inner (CPI) instructions, and the full parsed
|
|
7
|
+
* transaction result used by indexers and explorers.
|
|
8
|
+
*
|
|
9
|
+
* @category Parser
|
|
10
|
+
* @since v0.5.0
|
|
11
|
+
*/
|
|
12
|
+
import type { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
13
|
+
import type { ParsedEvent, SapEventName } from "../events";
|
|
14
|
+
/**
|
|
15
|
+
* A single SAP instruction decoded from on-chain transaction data.
|
|
16
|
+
*
|
|
17
|
+
* Contains the human-readable instruction name (as declared in the
|
|
18
|
+
* Anchor IDL), the decoded argument object, the ordered list of
|
|
19
|
+
* account keys, and the raw instruction for advanced consumers.
|
|
20
|
+
*
|
|
21
|
+
* @interface DecodedSapInstruction
|
|
22
|
+
* @category Parser
|
|
23
|
+
* @since v0.5.0
|
|
24
|
+
*/
|
|
25
|
+
export interface DecodedSapInstruction {
|
|
26
|
+
/** Instruction name matching the Anchor IDL method (e.g. `"registerAgent"`). */
|
|
27
|
+
readonly name: string;
|
|
28
|
+
/**
|
|
29
|
+
* Decoded arguments object. Keys match the Anchor IDL argument names.
|
|
30
|
+
* Returns `null` when decoding fails (e.g. IDL mismatch).
|
|
31
|
+
*/
|
|
32
|
+
readonly args: Record<string, any> | null;
|
|
33
|
+
/** Ordered list of account public keys passed to the instruction. */
|
|
34
|
+
readonly accounts: PublicKey[];
|
|
35
|
+
/** The original `TransactionInstruction`, useful for re-simulation or forwarding. */
|
|
36
|
+
readonly raw: TransactionInstruction;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* An inner instruction produced by cross-program invocation (CPI)
|
|
40
|
+
* within a SAP transaction.
|
|
41
|
+
*
|
|
42
|
+
* Inner instructions are indexed by the outer instruction position
|
|
43
|
+
* that triggered them. Each entry includes the decoded SAP name
|
|
44
|
+
* when the inner call targets the SAP program, or `null` otherwise.
|
|
45
|
+
*
|
|
46
|
+
* @interface DecodedInnerInstruction
|
|
47
|
+
* @category Parser
|
|
48
|
+
* @since v0.5.0
|
|
49
|
+
*/
|
|
50
|
+
export interface DecodedInnerInstruction {
|
|
51
|
+
/** Zero-based index of the outer instruction that triggered this CPI call. */
|
|
52
|
+
readonly outerIndex: number;
|
|
53
|
+
/** Zero-based position within the inner instruction set of the parent. */
|
|
54
|
+
readonly innerIndex: number;
|
|
55
|
+
/** SAP instruction name if the CPI targets the SAP program, `null` otherwise. */
|
|
56
|
+
readonly name: string | null;
|
|
57
|
+
/** Decoded arguments when the CPI targets SAP and decoding succeeds. */
|
|
58
|
+
readonly args: Record<string, any> | null;
|
|
59
|
+
/** Ordered account keys for this inner instruction. */
|
|
60
|
+
readonly accounts: PublicKey[];
|
|
61
|
+
/** The program that was invoked by this inner call. */
|
|
62
|
+
readonly programId: PublicKey;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Full parse result for a single SAP transaction.
|
|
66
|
+
*
|
|
67
|
+
* Combines top-level instruction decoding, inner instruction
|
|
68
|
+
* analysis, and event extraction into one unified structure
|
|
69
|
+
* suitable for indexing, analytics dashboards, and protocol
|
|
70
|
+
* explorers.
|
|
71
|
+
*
|
|
72
|
+
* @interface ParsedSapTransaction
|
|
73
|
+
* @category Parser
|
|
74
|
+
* @since v0.5.0
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const result = parseSapTransactionComplete(tx, program, SAP_PROGRAM_ID);
|
|
79
|
+
* for (const ix of result.instructions) {
|
|
80
|
+
* console.log(ix.name, ix.args);
|
|
81
|
+
* }
|
|
82
|
+
* for (const event of result.events) {
|
|
83
|
+
* console.log(event.name, event.data);
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export interface ParsedSapTransaction {
|
|
88
|
+
/** Transaction signature (base-58), extracted from the response when available. */
|
|
89
|
+
readonly signature: string | null;
|
|
90
|
+
/** Slot at which the transaction was confirmed. */
|
|
91
|
+
readonly slot: number | null;
|
|
92
|
+
/** Block timestamp (unix seconds) or `null` if unavailable. */
|
|
93
|
+
readonly blockTime: number | null;
|
|
94
|
+
/** Whether the transaction succeeded (`true`) or failed. */
|
|
95
|
+
readonly success: boolean;
|
|
96
|
+
/** Top-level SAP instructions found in the transaction. */
|
|
97
|
+
readonly instructions: DecodedSapInstruction[];
|
|
98
|
+
/** All inner (CPI) instructions, including non-SAP programs. */
|
|
99
|
+
readonly innerInstructions: DecodedInnerInstruction[];
|
|
100
|
+
/** Decoded SAP events extracted from the transaction logs. */
|
|
101
|
+
readonly events: ParsedEvent[];
|
|
102
|
+
/** Raw log lines from the transaction, for additional debugging. */
|
|
103
|
+
readonly logs: string[];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Options for filtering parsed instruction results.
|
|
107
|
+
*
|
|
108
|
+
* @interface ParseFilterOptions
|
|
109
|
+
* @category Parser
|
|
110
|
+
* @since v0.5.0
|
|
111
|
+
*/
|
|
112
|
+
export interface ParseFilterOptions {
|
|
113
|
+
/**
|
|
114
|
+
* When `true`, include inner (CPI) instructions in the parse
|
|
115
|
+
* result. Defaults to `false` because inner instruction
|
|
116
|
+
* reconstruction requires additional account-table lookups.
|
|
117
|
+
*/
|
|
118
|
+
readonly includeInner?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* When `true`, decode and attach SAP events from the
|
|
121
|
+
* transaction logs. Defaults to `true`.
|
|
122
|
+
*/
|
|
123
|
+
readonly includeEvents?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Restrict the result to instructions matching one of these
|
|
126
|
+
* names. When `undefined` or empty, all SAP instructions are
|
|
127
|
+
* returned.
|
|
128
|
+
*/
|
|
129
|
+
readonly instructionFilter?: string[];
|
|
130
|
+
/**
|
|
131
|
+
* Restrict events to those matching one of these names.
|
|
132
|
+
* When `undefined` or empty, all events are returned.
|
|
133
|
+
*/
|
|
134
|
+
readonly eventFilter?: SapEventName[];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Minimal interface for the Anchor instruction coder.
|
|
138
|
+
*
|
|
139
|
+
* Extracted so that parser functions can accept either a full
|
|
140
|
+
* `Program` instance or a standalone coder/IDL pair without
|
|
141
|
+
* requiring a live RPC connection.
|
|
142
|
+
*
|
|
143
|
+
* @interface SapInstructionCoder
|
|
144
|
+
* @category Parser
|
|
145
|
+
* @since v0.5.0
|
|
146
|
+
*/
|
|
147
|
+
export interface SapInstructionCoder {
|
|
148
|
+
/** Decode raw instruction data into a name and typed argument object. */
|
|
149
|
+
decode(data: Buffer | Uint8Array, encoding?: string): {
|
|
150
|
+
name: string;
|
|
151
|
+
data: Record<string, any>;
|
|
152
|
+
} | null;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/parser/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAM3D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,qBAAqB;IACpC,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;OAGG;IAEH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAC1C,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC/B,qFAAqF;IACrF,QAAQ,CAAC,GAAG,EAAE,sBAAsB,CAAC;CACtC;AAMD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,uBAAuB;IACtC,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,wEAAwE;IAExE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAC1C,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC/B;AAMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,oBAAoB;IACnC,mFAAmF;IACnF,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,YAAY,EAAE,qBAAqB,EAAE,CAAC;IAC/C,gEAAgE;IAChE,QAAQ,CAAC,iBAAiB,EAAE,uBAAuB,EAAE,CAAC;IACtD,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC;IAC/B,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;CACzB;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC;CACvC;AAMD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAClC,yEAAyE;IACzE,MAAM,CACJ,IAAI,EAAE,MAAM,GAAG,UAAU,EACzB,QAAQ,CAAC,EAAE,MAAM,GAEhB;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,IAAI,CAAC;CACvD"}
|