@oobe-protocol-labs/synapse-sap-sdk 0.12.9 → 0.14.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 +108 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/constants.js +59 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/errors.js +250 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/events/index.js +38 -130
- 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 +89 -0
- package/dist/cjs/instructions/agent.js.map +1 -0
- package/dist/cjs/instructions/attestation.js +112 -0
- package/dist/cjs/instructions/attestation.js.map +1 -0
- package/dist/cjs/instructions/digest.js +28 -0
- package/dist/cjs/instructions/digest.js.map +1 -0
- package/dist/cjs/instructions/dispute.js +116 -0
- package/dist/cjs/instructions/dispute.js.map +1 -0
- package/dist/cjs/instructions/escrow.js +101 -0
- package/dist/cjs/instructions/escrow.js.map +1 -0
- package/dist/cjs/instructions/global.js +28 -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 +221 -0
- package/dist/cjs/instructions/indexing.js.map +1 -0
- package/dist/cjs/instructions/misc.js +73 -0
- package/dist/cjs/instructions/misc.js.map +1 -0
- package/dist/cjs/instructions/session.js +89 -0
- package/dist/cjs/instructions/session.js.map +1 -0
- package/dist/cjs/instructions/staking.js +132 -0
- package/dist/cjs/instructions/staking.js.map +1 -0
- package/dist/cjs/instructions/subscription.js +80 -0
- package/dist/cjs/instructions/subscription.js.map +1 -0
- package/dist/cjs/instructions/tools.js +109 -0
- package/dist/cjs/instructions/tools.js.map +1 -0
- package/dist/cjs/instructions/vault.js +106 -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/types.js +42 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils/index.js +29 -75
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/validate.js +236 -0
- package/dist/cjs/utils/validate.js.map +1 -0
- 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 +70 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/constants.d.ts +52 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +56 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/errors.d.ts +111 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +244 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/events/index.d.ts +13 -0
- package/dist/esm/events/index.d.ts.map +1 -0
- package/dist/esm/events/index.js +36 -128
- package/dist/esm/events/index.js.map +1 -1
- 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 +85 -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 +108 -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 +24 -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 +112 -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 +97 -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 +24 -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 +217 -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 +69 -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 +85 -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 +128 -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 +76 -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 +105 -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 +102 -0
- package/dist/esm/instructions/vault.js.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/types.d.ts +208 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +39 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/index.d.ts +4 -0
- package/dist/esm/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/index.js +13 -29
- package/dist/esm/utils/index.js.map +1 -1
- 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/package.json +59 -183
- package/LICENSE +0 -21
- package/README.md +0 -986
- package/dist/cjs/constants/addresses.js +0 -143
- package/dist/cjs/constants/addresses.js.map +0 -1
- package/dist/cjs/constants/index.js +0 -64
- package/dist/cjs/constants/index.js.map +0 -1
- package/dist/cjs/constants/limits.js +0 -161
- package/dist/cjs/constants/limits.js.map +0 -1
- package/dist/cjs/constants/network.js +0 -81
- package/dist/cjs/constants/network.js.map +0 -1
- package/dist/cjs/constants/payments.js +0 -137
- package/dist/cjs/constants/payments.js.map +0 -1
- package/dist/cjs/constants/programs.js +0 -78
- package/dist/cjs/constants/programs.js.map +0 -1
- package/dist/cjs/constants/seeds.js +0 -76
- package/dist/cjs/constants/seeds.js.map +0 -1
- package/dist/cjs/core/client.js +0 -546
- package/dist/cjs/core/client.js.map +0 -1
- package/dist/cjs/core/connection.js +0 -350
- package/dist/cjs/core/connection.js.map +0 -1
- package/dist/cjs/core/index.js +0 -25
- package/dist/cjs/core/index.js.map +0 -1
- package/dist/cjs/errors/index.js +0 -334
- package/dist/cjs/errors/index.js.map +0 -1
- package/dist/cjs/events/geyser.js +0 -295
- package/dist/cjs/events/geyser.js.map +0 -1
- package/dist/cjs/idl/index.js +0 -63
- package/dist/cjs/idl/index.js.map +0 -1
- package/dist/cjs/idl/synapse_agent_sap.json +0 -14595
- package/dist/cjs/modules/agent.js +0 -272
- package/dist/cjs/modules/agent.js.map +0 -1
- package/dist/cjs/modules/attestation.js +0 -147
- package/dist/cjs/modules/attestation.js.map +0 -1
- package/dist/cjs/modules/base.js +0 -128
- package/dist/cjs/modules/base.js.map +0 -1
- package/dist/cjs/modules/escrow-v2.js +0 -454
- package/dist/cjs/modules/escrow-v2.js.map +0 -1
- package/dist/cjs/modules/escrow.js +0 -300
- package/dist/cjs/modules/escrow.js.map +0 -1
- package/dist/cjs/modules/feedback.js +0 -166
- package/dist/cjs/modules/feedback.js.map +0 -1
- package/dist/cjs/modules/index.js +0 -43
- package/dist/cjs/modules/index.js.map +0 -1
- package/dist/cjs/modules/indexing.js +0 -375
- package/dist/cjs/modules/indexing.js.map +0 -1
- package/dist/cjs/modules/ledger.js +0 -234
- package/dist/cjs/modules/ledger.js.map +0 -1
- package/dist/cjs/modules/receipt.js +0 -148
- package/dist/cjs/modules/receipt.js.map +0 -1
- package/dist/cjs/modules/staking.js +0 -124
- package/dist/cjs/modules/staking.js.map +0 -1
- package/dist/cjs/modules/subscription.js +0 -96
- package/dist/cjs/modules/subscription.js.map +0 -1
- package/dist/cjs/modules/tools.js +0 -319
- package/dist/cjs/modules/tools.js.map +0 -1
- package/dist/cjs/modules/vault.js +0 -410
- package/dist/cjs/modules/vault.js.map +0 -1
- package/dist/cjs/parser/client.js +0 -146
- package/dist/cjs/parser/client.js.map +0 -1
- package/dist/cjs/parser/complete.js +0 -177
- package/dist/cjs/parser/complete.js.map +0 -1
- package/dist/cjs/parser/index.js +0 -57
- package/dist/cjs/parser/index.js.map +0 -1
- package/dist/cjs/parser/inner.js +0 -185
- package/dist/cjs/parser/inner.js.map +0 -1
- package/dist/cjs/parser/instructions.js +0 -114
- package/dist/cjs/parser/instructions.js.map +0 -1
- package/dist/cjs/parser/transaction.js +0 -153
- package/dist/cjs/parser/transaction.js.map +0 -1
- package/dist/cjs/parser/types.js +0 -14
- package/dist/cjs/parser/types.js.map +0 -1
- package/dist/cjs/pda/index.js +0 -672
- package/dist/cjs/pda/index.js.map +0 -1
- package/dist/cjs/plugin/index.js +0 -952
- package/dist/cjs/plugin/index.js.map +0 -1
- package/dist/cjs/plugin/protocols.js +0 -282
- package/dist/cjs/plugin/protocols.js.map +0 -1
- package/dist/cjs/plugin/schemas.js +0 -863
- package/dist/cjs/plugin/schemas.js.map +0 -1
- package/dist/cjs/postgres/adapter.js +0 -715
- package/dist/cjs/postgres/adapter.js.map +0 -1
- package/dist/cjs/postgres/index.js +0 -50
- package/dist/cjs/postgres/index.js.map +0 -1
- package/dist/cjs/postgres/serializers.js +0 -381
- package/dist/cjs/postgres/serializers.js.map +0 -1
- package/dist/cjs/postgres/sync.js +0 -289
- package/dist/cjs/postgres/sync.js.map +0 -1
- package/dist/cjs/postgres/types.js +0 -44
- package/dist/cjs/postgres/types.js.map +0 -1
- package/dist/cjs/registries/builder.js +0 -414
- package/dist/cjs/registries/builder.js.map +0 -1
- package/dist/cjs/registries/discovery.js +0 -362
- package/dist/cjs/registries/discovery.js.map +0 -1
- package/dist/cjs/registries/fairscale.js +0 -639
- package/dist/cjs/registries/fairscale.js.map +0 -1
- package/dist/cjs/registries/index.js +0 -58
- package/dist/cjs/registries/index.js.map +0 -1
- package/dist/cjs/registries/metaplex-bridge.js +0 -743
- package/dist/cjs/registries/metaplex-bridge.js.map +0 -1
- package/dist/cjs/registries/session.js +0 -433
- package/dist/cjs/registries/session.js.map +0 -1
- package/dist/cjs/registries/x402.js +0 -668
- package/dist/cjs/registries/x402.js.map +0 -1
- package/dist/cjs/types/accounts.js +0 -13
- package/dist/cjs/types/accounts.js.map +0 -1
- package/dist/cjs/types/common.js +0 -13
- package/dist/cjs/types/common.js.map +0 -1
- package/dist/cjs/types/endpoint.js +0 -15
- package/dist/cjs/types/endpoint.js.map +0 -1
- package/dist/cjs/types/enums.js +0 -269
- package/dist/cjs/types/enums.js.map +0 -1
- package/dist/cjs/types/index.js +0 -41
- package/dist/cjs/types/index.js.map +0 -1
- package/dist/cjs/types/instructions.js +0 -92
- package/dist/cjs/types/instructions.js.map +0 -1
- package/dist/cjs/utils/endpoint-validator.js +0 -232
- package/dist/cjs/utils/endpoint-validator.js.map +0 -1
- package/dist/cjs/utils/escrow-validation.js +0 -219
- package/dist/cjs/utils/escrow-validation.js.map +0 -1
- package/dist/cjs/utils/hash.js +0 -109
- package/dist/cjs/utils/hash.js.map +0 -1
- package/dist/cjs/utils/merchant-validator.js +0 -246
- package/dist/cjs/utils/merchant-validator.js.map +0 -1
- package/dist/cjs/utils/network-normalizer.js +0 -236
- package/dist/cjs/utils/network-normalizer.js.map +0 -1
- package/dist/cjs/utils/priority-fee.js +0 -215
- package/dist/cjs/utils/priority-fee.js.map +0 -1
- package/dist/cjs/utils/rpc-strategy.js +0 -239
- package/dist/cjs/utils/rpc-strategy.js.map +0 -1
- package/dist/cjs/utils/schemas.js +0 -331
- package/dist/cjs/utils/schemas.js.map +0 -1
- package/dist/cjs/utils/serialization.js +0 -105
- package/dist/cjs/utils/serialization.js.map +0 -1
- package/dist/cjs/utils/validation.js +0 -36
- package/dist/cjs/utils/validation.js.map +0 -1
- package/dist/cjs/utils/x402-direct.js +0 -231
- package/dist/cjs/utils/x402-direct.js.map +0 -1
- package/dist/esm/constants/addresses.js +0 -140
- package/dist/esm/constants/addresses.js.map +0 -1
- package/dist/esm/constants/index.js +0 -35
- package/dist/esm/constants/index.js.map +0 -1
- package/dist/esm/constants/limits.js +0 -158
- package/dist/esm/constants/limits.js.map +0 -1
- package/dist/esm/constants/network.js +0 -78
- package/dist/esm/constants/network.js.map +0 -1
- package/dist/esm/constants/payments.js +0 -131
- package/dist/esm/constants/payments.js.map +0 -1
- package/dist/esm/constants/programs.js +0 -75
- package/dist/esm/constants/programs.js.map +0 -1
- package/dist/esm/constants/seeds.js +0 -73
- package/dist/esm/constants/seeds.js.map +0 -1
- package/dist/esm/core/client.js +0 -539
- package/dist/esm/core/client.js.map +0 -1
- package/dist/esm/core/connection.js +0 -345
- package/dist/esm/core/connection.js.map +0 -1
- package/dist/esm/core/index.js +0 -19
- package/dist/esm/core/index.js.map +0 -1
- package/dist/esm/errors/index.js +0 -325
- package/dist/esm/errors/index.js.map +0 -1
- package/dist/esm/events/geyser.js +0 -258
- package/dist/esm/events/geyser.js.map +0 -1
- package/dist/esm/idl/index.js +0 -57
- package/dist/esm/idl/index.js.map +0 -1
- package/dist/esm/idl/synapse_agent_sap.json +0 -14595
- package/dist/esm/modules/agent.js +0 -268
- package/dist/esm/modules/agent.js.map +0 -1
- package/dist/esm/modules/attestation.js +0 -143
- package/dist/esm/modules/attestation.js.map +0 -1
- package/dist/esm/modules/base.js +0 -124
- package/dist/esm/modules/base.js.map +0 -1
- package/dist/esm/modules/escrow-v2.js +0 -450
- package/dist/esm/modules/escrow-v2.js.map +0 -1
- package/dist/esm/modules/escrow.js +0 -296
- package/dist/esm/modules/escrow.js.map +0 -1
- package/dist/esm/modules/feedback.js +0 -162
- package/dist/esm/modules/feedback.js.map +0 -1
- package/dist/esm/modules/index.js +0 -27
- package/dist/esm/modules/index.js.map +0 -1
- package/dist/esm/modules/indexing.js +0 -371
- package/dist/esm/modules/indexing.js.map +0 -1
- package/dist/esm/modules/ledger.js +0 -230
- package/dist/esm/modules/ledger.js.map +0 -1
- package/dist/esm/modules/receipt.js +0 -144
- package/dist/esm/modules/receipt.js.map +0 -1
- package/dist/esm/modules/staking.js +0 -120
- package/dist/esm/modules/staking.js.map +0 -1
- package/dist/esm/modules/subscription.js +0 -92
- package/dist/esm/modules/subscription.js.map +0 -1
- package/dist/esm/modules/tools.js +0 -315
- package/dist/esm/modules/tools.js.map +0 -1
- package/dist/esm/modules/vault.js +0 -406
- package/dist/esm/modules/vault.js.map +0 -1
- package/dist/esm/parser/client.js +0 -142
- package/dist/esm/parser/client.js.map +0 -1
- package/dist/esm/parser/complete.js +0 -173
- package/dist/esm/parser/complete.js.map +0 -1
- package/dist/esm/parser/index.js +0 -43
- package/dist/esm/parser/index.js.map +0 -1
- package/dist/esm/parser/inner.js +0 -180
- package/dist/esm/parser/inner.js.map +0 -1
- package/dist/esm/parser/instructions.js +0 -109
- package/dist/esm/parser/instructions.js.map +0 -1
- package/dist/esm/parser/transaction.js +0 -149
- package/dist/esm/parser/transaction.js.map +0 -1
- package/dist/esm/parser/types.js +0 -13
- package/dist/esm/parser/types.js.map +0 -1
- package/dist/esm/pda/index.js +0 -638
- package/dist/esm/pda/index.js.map +0 -1
- package/dist/esm/plugin/index.js +0 -945
- package/dist/esm/plugin/index.js.map +0 -1
- package/dist/esm/plugin/protocols.js +0 -279
- package/dist/esm/plugin/protocols.js.map +0 -1
- package/dist/esm/plugin/schemas.js +0 -860
- package/dist/esm/plugin/schemas.js.map +0 -1
- package/dist/esm/postgres/adapter.js +0 -678
- package/dist/esm/postgres/adapter.js.map +0 -1
- package/dist/esm/postgres/index.js +0 -27
- package/dist/esm/postgres/index.js.map +0 -1
- package/dist/esm/postgres/serializers.js +0 -362
- package/dist/esm/postgres/serializers.js.map +0 -1
- package/dist/esm/postgres/sync.js +0 -285
- package/dist/esm/postgres/sync.js.map +0 -1
- package/dist/esm/postgres/types.js +0 -41
- package/dist/esm/postgres/types.js.map +0 -1
- package/dist/esm/registries/builder.js +0 -410
- package/dist/esm/registries/builder.js.map +0 -1
- package/dist/esm/registries/discovery.js +0 -358
- package/dist/esm/registries/discovery.js.map +0 -1
- package/dist/esm/registries/fairscale.js +0 -633
- package/dist/esm/registries/fairscale.js.map +0 -1
- package/dist/esm/registries/index.js +0 -46
- package/dist/esm/registries/index.js.map +0 -1
- package/dist/esm/registries/metaplex-bridge.js +0 -706
- package/dist/esm/registries/metaplex-bridge.js.map +0 -1
- package/dist/esm/registries/session.js +0 -429
- package/dist/esm/registries/session.js.map +0 -1
- package/dist/esm/registries/x402.js +0 -664
- package/dist/esm/registries/x402.js.map +0 -1
- package/dist/esm/types/accounts.js +0 -12
- package/dist/esm/types/accounts.js.map +0 -1
- package/dist/esm/types/common.js +0 -12
- package/dist/esm/types/common.js.map +0 -1
- package/dist/esm/types/endpoint.js +0 -14
- package/dist/esm/types/endpoint.js.map +0 -1
- package/dist/esm/types/enums.js +0 -266
- package/dist/esm/types/enums.js.map +0 -1
- package/dist/esm/types/index.js +0 -25
- package/dist/esm/types/index.js.map +0 -1
- package/dist/esm/types/instructions.js +0 -89
- package/dist/esm/types/instructions.js.map +0 -1
- package/dist/esm/utils/endpoint-validator.js +0 -226
- package/dist/esm/utils/endpoint-validator.js.map +0 -1
- package/dist/esm/utils/escrow-validation.js +0 -212
- package/dist/esm/utils/escrow-validation.js.map +0 -1
- package/dist/esm/utils/hash.js +0 -103
- package/dist/esm/utils/hash.js.map +0 -1
- package/dist/esm/utils/merchant-validator.js +0 -241
- package/dist/esm/utils/merchant-validator.js.map +0 -1
- package/dist/esm/utils/network-normalizer.js +0 -229
- package/dist/esm/utils/network-normalizer.js.map +0 -1
- package/dist/esm/utils/priority-fee.js +0 -209
- package/dist/esm/utils/priority-fee.js.map +0 -1
- package/dist/esm/utils/rpc-strategy.js +0 -231
- package/dist/esm/utils/rpc-strategy.js.map +0 -1
- package/dist/esm/utils/schemas.js +0 -320
- package/dist/esm/utils/schemas.js.map +0 -1
- package/dist/esm/utils/serialization.js +0 -98
- package/dist/esm/utils/serialization.js.map +0 -1
- package/dist/esm/utils/validation.js +0 -33
- package/dist/esm/utils/validation.js.map +0 -1
- package/dist/esm/utils/x402-direct.js +0 -228
- package/dist/esm/utils/x402-direct.js.map +0 -1
- package/dist/types/constants/addresses.d.ts +0 -117
- package/dist/types/constants/addresses.d.ts.map +0 -1
- package/dist/types/constants/index.d.ts +0 -31
- package/dist/types/constants/index.d.ts.map +0 -1
- package/dist/types/constants/limits.d.ts +0 -149
- package/dist/types/constants/limits.d.ts.map +0 -1
- package/dist/types/constants/network.d.ts +0 -81
- package/dist/types/constants/network.d.ts.map +0 -1
- package/dist/types/constants/payments.d.ts +0 -121
- package/dist/types/constants/payments.d.ts.map +0 -1
- package/dist/types/constants/programs.d.ts +0 -69
- package/dist/types/constants/programs.d.ts.map +0 -1
- package/dist/types/constants/seeds.d.ts +0 -80
- package/dist/types/constants/seeds.d.ts.map +0 -1
- package/dist/types/core/client.d.ts +0 -452
- package/dist/types/core/client.d.ts.map +0 -1
- package/dist/types/core/connection.d.ts +0 -305
- package/dist/types/core/connection.d.ts.map +0 -1
- package/dist/types/core/index.d.ts +0 -20
- package/dist/types/core/index.d.ts.map +0 -1
- package/dist/types/errors/index.d.ts +0 -276
- package/dist/types/errors/index.d.ts.map +0 -1
- package/dist/types/events/geyser.d.ts +0 -150
- package/dist/types/events/geyser.d.ts.map +0 -1
- package/dist/types/events/index.d.ts +0 -248
- package/dist/types/events/index.d.ts.map +0 -1
- package/dist/types/idl/index.d.ts +0 -70
- package/dist/types/idl/index.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -85
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/modules/agent.d.ts +0 -166
- package/dist/types/modules/agent.d.ts.map +0 -1
- package/dist/types/modules/attestation.d.ts +0 -96
- package/dist/types/modules/attestation.d.ts.map +0 -1
- package/dist/types/modules/base.d.ts +0 -126
- package/dist/types/modules/base.d.ts.map +0 -1
- package/dist/types/modules/escrow-v2.d.ts +0 -100
- package/dist/types/modules/escrow-v2.d.ts.map +0 -1
- package/dist/types/modules/escrow.d.ts +0 -168
- package/dist/types/modules/escrow.d.ts.map +0 -1
- package/dist/types/modules/feedback.d.ts +0 -105
- package/dist/types/modules/feedback.d.ts.map +0 -1
- package/dist/types/modules/index.d.ts +0 -28
- package/dist/types/modules/index.d.ts.map +0 -1
- package/dist/types/modules/indexing.d.ts +0 -200
- package/dist/types/modules/indexing.d.ts.map +0 -1
- package/dist/types/modules/ledger.d.ts +0 -150
- package/dist/types/modules/ledger.d.ts.map +0 -1
- package/dist/types/modules/receipt.d.ts +0 -77
- package/dist/types/modules/receipt.d.ts.map +0 -1
- package/dist/types/modules/staking.d.ts +0 -51
- package/dist/types/modules/staking.d.ts.map +0 -1
- package/dist/types/modules/subscription.d.ts +0 -33
- package/dist/types/modules/subscription.d.ts.map +0 -1
- package/dist/types/modules/tools.d.ts +0 -182
- package/dist/types/modules/tools.d.ts.map +0 -1
- package/dist/types/modules/vault.d.ts +0 -240
- package/dist/types/modules/vault.d.ts.map +0 -1
- package/dist/types/parser/client.d.ts +0 -123
- package/dist/types/parser/client.d.ts.map +0 -1
- package/dist/types/parser/complete.d.ts +0 -90
- package/dist/types/parser/complete.d.ts.map +0 -1
- package/dist/types/parser/index.d.ts +0 -40
- package/dist/types/parser/index.d.ts.map +0 -1
- package/dist/types/parser/inner.d.ts +0 -114
- package/dist/types/parser/inner.d.ts.map +0 -1
- package/dist/types/parser/instructions.d.ts +0 -76
- package/dist/types/parser/instructions.d.ts.map +0 -1
- package/dist/types/parser/transaction.d.ts +0 -77
- package/dist/types/parser/transaction.d.ts.map +0 -1
- package/dist/types/parser/types.d.ts +0 -154
- package/dist/types/parser/types.d.ts.map +0 -1
- package/dist/types/pda/index.d.ts +0 -510
- package/dist/types/pda/index.d.ts.map +0 -1
- package/dist/types/plugin/index.d.ts +0 -171
- package/dist/types/plugin/index.d.ts.map +0 -1
- package/dist/types/plugin/protocols.d.ts +0 -152
- package/dist/types/plugin/protocols.d.ts.map +0 -1
- package/dist/types/plugin/schemas.d.ts +0 -829
- package/dist/types/plugin/schemas.d.ts.map +0 -1
- package/dist/types/postgres/adapter.d.ts +0 -355
- package/dist/types/postgres/adapter.d.ts.map +0 -1
- package/dist/types/postgres/index.d.ts +0 -24
- package/dist/types/postgres/index.d.ts.map +0 -1
- package/dist/types/postgres/serializers.d.ts +0 -30
- package/dist/types/postgres/serializers.d.ts.map +0 -1
- package/dist/types/postgres/sync.d.ts +0 -156
- package/dist/types/postgres/sync.d.ts.map +0 -1
- package/dist/types/postgres/types.d.ts +0 -167
- package/dist/types/postgres/types.d.ts.map +0 -1
- package/dist/types/registries/builder.d.ts +0 -340
- package/dist/types/registries/builder.d.ts.map +0 -1
- package/dist/types/registries/discovery.d.ts +0 -333
- package/dist/types/registries/discovery.d.ts.map +0 -1
- package/dist/types/registries/fairscale.d.ts +0 -680
- package/dist/types/registries/fairscale.d.ts.map +0 -1
- package/dist/types/registries/index.d.ts +0 -52
- package/dist/types/registries/index.d.ts.map +0 -1
- package/dist/types/registries/metaplex-bridge.d.ts +0 -488
- package/dist/types/registries/metaplex-bridge.d.ts.map +0 -1
- package/dist/types/registries/session.d.ts +0 -323
- package/dist/types/registries/session.d.ts.map +0 -1
- package/dist/types/registries/x402.d.ts +0 -530
- package/dist/types/registries/x402.d.ts.map +0 -1
- package/dist/types/types/accounts.d.ts +0 -765
- package/dist/types/types/accounts.d.ts.map +0 -1
- package/dist/types/types/common.d.ts +0 -166
- package/dist/types/types/common.d.ts.map +0 -1
- package/dist/types/types/endpoint.d.ts +0 -161
- package/dist/types/types/endpoint.d.ts.map +0 -1
- package/dist/types/types/enums.d.ts +0 -353
- package/dist/types/types/enums.d.ts.map +0 -1
- package/dist/types/types/index.d.ts +0 -29
- package/dist/types/types/index.d.ts.map +0 -1
- package/dist/types/types/instructions.d.ts +0 -400
- package/dist/types/types/instructions.d.ts.map +0 -1
- package/dist/types/utils/endpoint-validator.d.ts +0 -110
- package/dist/types/utils/endpoint-validator.d.ts.map +0 -1
- package/dist/types/utils/escrow-validation.d.ts +0 -145
- package/dist/types/utils/escrow-validation.d.ts.map +0 -1
- package/dist/types/utils/hash.d.ts +0 -75
- package/dist/types/utils/hash.d.ts.map +0 -1
- package/dist/types/utils/index.d.ts +0 -33
- package/dist/types/utils/index.d.ts.map +0 -1
- package/dist/types/utils/merchant-validator.d.ts +0 -176
- package/dist/types/utils/merchant-validator.d.ts.map +0 -1
- package/dist/types/utils/network-normalizer.d.ts +0 -120
- package/dist/types/utils/network-normalizer.d.ts.map +0 -1
- package/dist/types/utils/priority-fee.d.ts +0 -205
- package/dist/types/utils/priority-fee.d.ts.map +0 -1
- package/dist/types/utils/rpc-strategy.d.ts +0 -172
- package/dist/types/utils/rpc-strategy.d.ts.map +0 -1
- package/dist/types/utils/schemas.d.ts +0 -351
- package/dist/types/utils/schemas.d.ts.map +0 -1
- package/dist/types/utils/serialization.d.ts +0 -69
- package/dist/types/utils/serialization.d.ts.map +0 -1
- package/dist/types/utils/validation.d.ts +0 -29
- package/dist/types/utils/validation.d.ts.map +0 -1
- package/dist/types/utils/x402-direct.d.ts +0 -114
- package/dist/types/utils/x402-direct.d.ts.map +0 -1
- package/src/constants/addresses.ts +0 -162
- package/src/constants/index.ts +0 -69
- package/src/constants/limits.ts +0 -165
- package/src/constants/network.ts +0 -89
- package/src/constants/payments.ts +0 -145
- package/src/constants/programs.ts +0 -83
- package/src/constants/seeds.ts +0 -85
- package/src/core/client.ts +0 -583
- package/src/core/connection.ts +0 -461
- package/src/core/index.ts +0 -20
- 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/index.ts +0 -76
- 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 -158
- package/src/modules/escrow-v2.ts +0 -658
- package/src/modules/escrow.ts +0 -383
- package/src/modules/feedback.ts +0 -186
- package/src/modules/index.ts +0 -28
- 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 -157
- package/src/modules/subscription.ts +0 -147
- package/src/modules/tools.ts +0 -411
- package/src/modules/vault.ts +0 -533
- package/src/parser/client.ts +0 -211
- package/src/parser/complete.ts +0 -232
- package/src/parser/index.ts +0 -71
- package/src/parser/inner.ts +0 -255
- package/src/parser/instructions.ts +0 -135
- package/src/parser/transaction.ts +0 -200
- package/src/parser/types.ts +0 -182
- package/src/pda/index.ts +0 -919
- 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/endpoint-validator.ts +0 -300
- package/src/utils/escrow-validation.ts +0 -301
- package/src/utils/hash.ts +0 -113
- package/src/utils/index.ts +0 -102
- 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/serialization.ts +0 -98
- package/src/utils/validation.ts +0 -36
- package/src/utils/x402-direct.ts +0 -370
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAOA,sDAAsD;AACtD,oBAAY,YAAY;IAEtB,WAAW,OAAO;IAClB,YAAY,OAAO;IACnB,eAAe,OAAO;IACtB,eAAe,OAAO;IACtB,cAAc,OAAO;IACrB,mBAAmB,OAAO;IAC1B,uBAAuB,OAAO;IAC9B,WAAW,OAAO;IAGlB,SAAS,OAAO;IAChB,cAAc,OAAO;IACrB,kBAAkB,OAAO;IACzB,kBAAkB,OAAO;IACzB,cAAc,OAAO;IACrB,YAAY,OAAO;IACnB,mBAAmB,OAAO;IAC1B,kBAAkB,OAAO;IACzB,oBAAoB,OAAO;IAG3B,iBAAiB,OAAO;IACxB,SAAS,OAAO;IAChB,cAAc,OAAO;IACrB,mBAAmB,OAAO;IAC1B,aAAa,OAAO;IACpB,oBAAoB,OAAO;IAC3B,qBAAqB,OAAO;IAC5B,iCAAiC,OAAO;IACxC,aAAa,OAAO;IACpB,kBAAkB,OAAO;IACzB,iBAAiB,OAAO;IAGxB,yBAAyB,OAAO;IAChC,cAAc,OAAO;IACrB,iBAAiB,OAAO;IACxB,qBAAqB,OAAO;IAC5B,oBAAoB,OAAO;IAC3B,0BAA0B,OAAO;IACjC,kBAAkB,OAAO;IACzB,kBAAkB,OAAO;IACzB,wBAAwB,OAAO;IAC/B,wBAAwB,OAAO;IAC/B,oBAAoB,OAAO;IAC3B,0BAA0B,OAAO;IACjC,uBAAuB,OAAO;IAC9B,oBAAoB,OAAO;IAC3B,YAAY,OAAO;IACnB,mBAAmB,OAAO;IAC1B,gBAAgB,OAAO;IACvB,UAAU,OAAO;IACjB,cAAc,OAAO;IACrB,eAAe,OAAO;IACtB,gBAAgB,OAAO;IACvB,eAAe,OAAO;IACtB,qBAAqB,OAAO;IAC5B,WAAW,OAAO;IAClB,oBAAoB,O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,244 @@
|
|
|
1
|
+
// ================================================================
|
|
2
|
+
// synapse-sap-sdk / src/errors.ts
|
|
3
|
+
// On-chain error codes ↔ human-readable messages + recovery actions
|
|
4
|
+
// ================================================================
|
|
5
|
+
/** All v0.13 SapError variants with recovery hints */
|
|
6
|
+
export var SapErrorCode;
|
|
7
|
+
(function (SapErrorCode) {
|
|
8
|
+
// ── Agent ──
|
|
9
|
+
SapErrorCode[SapErrorCode["NameTooLong"] = 6000] = "NameTooLong";
|
|
10
|
+
SapErrorCode[SapErrorCode["NameTooShort"] = 6001] = "NameTooShort";
|
|
11
|
+
SapErrorCode[SapErrorCode["InvalidEndpoint"] = 6002] = "InvalidEndpoint";
|
|
12
|
+
SapErrorCode[SapErrorCode["EndpointTooLong"] = 6003] = "EndpointTooLong";
|
|
13
|
+
SapErrorCode[SapErrorCode["InvalidDIDHash"] = 6004] = "InvalidDIDHash";
|
|
14
|
+
SapErrorCode[SapErrorCode["AgentNotInitialized"] = 6005] = "AgentNotInitialized";
|
|
15
|
+
SapErrorCode[SapErrorCode["AgentAlreadyInitialized"] = 6006] = "AgentAlreadyInitialized";
|
|
16
|
+
SapErrorCode[SapErrorCode["AgentClosed"] = 6007] = "AgentClosed";
|
|
17
|
+
// ── Tool / Registry ──
|
|
18
|
+
SapErrorCode[SapErrorCode["NameEmpty"] = 6010] = "NameEmpty";
|
|
19
|
+
SapErrorCode[SapErrorCode["NameWhitespace"] = 6011] = "NameWhitespace";
|
|
20
|
+
SapErrorCode[SapErrorCode["DescriptionTooLong"] = 6012] = "DescriptionTooLong";
|
|
21
|
+
SapErrorCode[SapErrorCode["CategoryOutOfRange"] = 6013] = "CategoryOutOfRange";
|
|
22
|
+
SapErrorCode[SapErrorCode["ToolNameExists"] = 6014] = "ToolNameExists";
|
|
23
|
+
SapErrorCode[SapErrorCode["ToolNotFound"] = 6015] = "ToolNotFound";
|
|
24
|
+
SapErrorCode[SapErrorCode["CallerNotAgentOwner"] = 6016] = "CallerNotAgentOwner";
|
|
25
|
+
SapErrorCode[SapErrorCode["CallerNotToolOwner"] = 6017] = "CallerNotToolOwner";
|
|
26
|
+
SapErrorCode[SapErrorCode["ToolCategoryMismatch"] = 6018] = "ToolCategoryMismatch";
|
|
27
|
+
// ── Stake ──
|
|
28
|
+
SapErrorCode[SapErrorCode["StakeBelowMinimum"] = 6020] = "StakeBelowMinimum";
|
|
29
|
+
SapErrorCode[SapErrorCode["NotStaked"] = 6021] = "NotStaked";
|
|
30
|
+
SapErrorCode[SapErrorCode["UnstakeTooSoon"] = 6022] = "UnstakeTooSoon";
|
|
31
|
+
SapErrorCode[SapErrorCode["UnstakeExceedsStake"] = 6023] = "UnstakeExceedsStake";
|
|
32
|
+
SapErrorCode[SapErrorCode["AlreadyStaked"] = 6024] = "AlreadyStaked";
|
|
33
|
+
SapErrorCode[SapErrorCode["UnstakeWindowNotOpen"] = 6025] = "UnstakeWindowNotOpen";
|
|
34
|
+
SapErrorCode[SapErrorCode["UnstakeAlreadyPending"] = 6026] = "UnstakeAlreadyPending";
|
|
35
|
+
SapErrorCode[SapErrorCode["CannotCloseAgentWithActiveEscrows"] = 6027] = "CannotCloseAgentWithActiveEscrows";
|
|
36
|
+
SapErrorCode[SapErrorCode["StakeNotFound"] = 6028] = "StakeNotFound";
|
|
37
|
+
SapErrorCode[SapErrorCode["AgentStatsNotFound"] = 6029] = "AgentStatsNotFound";
|
|
38
|
+
SapErrorCode[SapErrorCode["InsufficientStake"] = 6030] = "InsufficientStake";
|
|
39
|
+
// ── Escrow ──
|
|
40
|
+
SapErrorCode[SapErrorCode["InsufficientEscrowBalance"] = 6032] = "InsufficientEscrowBalance";
|
|
41
|
+
SapErrorCode[SapErrorCode["EscrowNotFound"] = 6033] = "EscrowNotFound";
|
|
42
|
+
SapErrorCode[SapErrorCode["EscrowNotForAgent"] = 6034] = "EscrowNotForAgent";
|
|
43
|
+
SapErrorCode[SapErrorCode["EscrowNotForDepositor"] = 6035] = "EscrowNotForDepositor";
|
|
44
|
+
SapErrorCode[SapErrorCode["AmountMustBePositive"] = 6036] = "AmountMustBePositive";
|
|
45
|
+
SapErrorCode[SapErrorCode["PricePerCallMustBePositive"] = 6037] = "PricePerCallMustBePositive";
|
|
46
|
+
SapErrorCode[SapErrorCode["InvalidEscrowNonce"] = 6038] = "InvalidEscrowNonce";
|
|
47
|
+
SapErrorCode[SapErrorCode["InvalidVolumeCurve"] = 6039] = "InvalidVolumeCurve";
|
|
48
|
+
SapErrorCode[SapErrorCode["VolumeCurveNotDescending"] = 6040] = "VolumeCurveNotDescending";
|
|
49
|
+
SapErrorCode[SapErrorCode["TooManyVolumeCurvePoints"] = 6041] = "TooManyVolumeCurvePoints";
|
|
50
|
+
SapErrorCode[SapErrorCode["SettlementNotPending"] = 6042] = "SettlementNotPending";
|
|
51
|
+
SapErrorCode[SapErrorCode["SettlementAlreadyFinalized"] = 6043] = "SettlementAlreadyFinalized";
|
|
52
|
+
SapErrorCode[SapErrorCode["DisputeWindowNotExpired"] = 6044] = "DisputeWindowNotExpired";
|
|
53
|
+
SapErrorCode[SapErrorCode["DisputeWindowExpired"] = 6045] = "DisputeWindowExpired";
|
|
54
|
+
SapErrorCode[SapErrorCode["NotDepositor"] = 6046] = "NotDepositor";
|
|
55
|
+
SapErrorCode[SapErrorCode["DisputeAlreadyFiled"] = 6047] = "DisputeAlreadyFiled";
|
|
56
|
+
SapErrorCode[SapErrorCode["DisputeStillOpen"] = 6048] = "DisputeStillOpen";
|
|
57
|
+
SapErrorCode[SapErrorCode["NotArbiter"] = 6049] = "NotArbiter";
|
|
58
|
+
SapErrorCode[SapErrorCode["InvalidArbiter"] = 6050] = "InvalidArbiter";
|
|
59
|
+
SapErrorCode[SapErrorCode["ArbiterRequired"] = 6051] = "ArbiterRequired";
|
|
60
|
+
SapErrorCode[SapErrorCode["CoSignerRequired"] = 6052] = "CoSignerRequired";
|
|
61
|
+
SapErrorCode[SapErrorCode["InvalidCoSigner"] = 6053] = "InvalidCoSigner";
|
|
62
|
+
SapErrorCode[SapErrorCode["InvalidDisputeOutcome"] = 6054] = "InvalidDisputeOutcome";
|
|
63
|
+
SapErrorCode[SapErrorCode["EscrowEmpty"] = 6055] = "EscrowEmpty";
|
|
64
|
+
SapErrorCode[SapErrorCode["EscrowAlreadyExpired"] = 6056] = "EscrowAlreadyExpired";
|
|
65
|
+
SapErrorCode[SapErrorCode["EscrowExpired"] = 6057] = "EscrowExpired";
|
|
66
|
+
SapErrorCode[SapErrorCode["EscrowNonceReused"] = 6058] = "EscrowNonceReused";
|
|
67
|
+
// ── Receipt ──
|
|
68
|
+
SapErrorCode[SapErrorCode["ReceiptBatchNotFound"] = 6060] = "ReceiptBatchNotFound";
|
|
69
|
+
SapErrorCode[SapErrorCode["ReceiptTreeEmpty"] = 6061] = "ReceiptTreeEmpty";
|
|
70
|
+
SapErrorCode[SapErrorCode["ReceiptNotFound"] = 6062] = "ReceiptNotFound";
|
|
71
|
+
SapErrorCode[SapErrorCode["ReceiptAlreadyDisputed"] = 6063] = "ReceiptAlreadyDisputed";
|
|
72
|
+
SapErrorCode[SapErrorCode["ReceiptNotInWindow"] = 6064] = "ReceiptNotInWindow";
|
|
73
|
+
SapErrorCode[SapErrorCode["InvalidReceiptProof"] = 6065] = "InvalidReceiptProof";
|
|
74
|
+
SapErrorCode[SapErrorCode["InvalidMerkleProof"] = 6066] = "InvalidMerkleProof";
|
|
75
|
+
SapErrorCode[SapErrorCode["NotAgentOwner"] = 6067] = "NotAgentOwner";
|
|
76
|
+
// ── Subscription ──
|
|
77
|
+
SapErrorCode[SapErrorCode["SubscriptionNotFound"] = 6070] = "SubscriptionNotFound";
|
|
78
|
+
SapErrorCode[SapErrorCode["NotSubscriber"] = 6071] = "NotSubscriber";
|
|
79
|
+
SapErrorCode[SapErrorCode["SubscriptionInsufficientBalance"] = 6072] = "SubscriptionInsufficientBalance";
|
|
80
|
+
SapErrorCode[SapErrorCode["SubscriptionIntervalOverflow"] = 6073] = "SubscriptionIntervalOverflow";
|
|
81
|
+
SapErrorCode[SapErrorCode["SubscriptionDurationTooLong"] = 6074] = "SubscriptionDurationTooLong";
|
|
82
|
+
// ── Dispute / Security (v0.13) ──
|
|
83
|
+
SapErrorCode[SapErrorCode["PendingAmountMismatch"] = 6080] = "PendingAmountMismatch";
|
|
84
|
+
SapErrorCode[SapErrorCode["MaxCallsPerSettlementExceeded"] = 6081] = "MaxCallsPerSettlementExceeded";
|
|
85
|
+
SapErrorCode[SapErrorCode["InvalidVolumeCurvePrice"] = 6082] = "InvalidVolumeCurvePrice";
|
|
86
|
+
SapErrorCode[SapErrorCode["EscrowCoverageExceeded"] = 6083] = "EscrowCoverageExceeded";
|
|
87
|
+
SapErrorCode[SapErrorCode["CoSignerIsAgentWallet"] = 6084] = "CoSignerIsAgentWallet";
|
|
88
|
+
SapErrorCode[SapErrorCode["PendingSettlementExists"] = 6085] = "PendingSettlementExists";
|
|
89
|
+
SapErrorCode[SapErrorCode["TokenAccountOwnerMismatch"] = 6086] = "TokenAccountOwnerMismatch";
|
|
90
|
+
SapErrorCode[SapErrorCode["MaxReceiptProofExceeded"] = 6087] = "MaxReceiptProofExceeded";
|
|
91
|
+
SapErrorCode[SapErrorCode["MaxMerkleDepthExceeded"] = 6088] = "MaxMerkleDepthExceeded";
|
|
92
|
+
SapErrorCode[SapErrorCode["StakeSlashLocksUnstake"] = 6089] = "StakeSlashLocksUnstake";
|
|
93
|
+
// ── Math ──
|
|
94
|
+
SapErrorCode[SapErrorCode["ArithmeticOverflow"] = 6300] = "ArithmeticOverflow";
|
|
95
|
+
// ── Vault ──
|
|
96
|
+
SapErrorCode[SapErrorCode["VaultNotFound"] = 6350] = "VaultNotFound";
|
|
97
|
+
SapErrorCode[SapErrorCode["VaultAlreadyInitialized"] = 6351] = "VaultAlreadyInitialized";
|
|
98
|
+
SapErrorCode[SapErrorCode["VaultNotInitialized"] = 6352] = "VaultNotInitialized";
|
|
99
|
+
SapErrorCode[SapErrorCode["NotVaultOwner"] = 6353] = "NotVaultOwner";
|
|
100
|
+
SapErrorCode[SapErrorCode["NotDelegate"] = 6354] = "NotDelegate";
|
|
101
|
+
SapErrorCode[SapErrorCode["DelegateExpired"] = 6355] = "DelegateExpired";
|
|
102
|
+
SapErrorCode[SapErrorCode["InvalidPermissions"] = 6356] = "InvalidPermissions";
|
|
103
|
+
SapErrorCode[SapErrorCode["SessionNotFound"] = 6357] = "SessionNotFound";
|
|
104
|
+
SapErrorCode[SapErrorCode["EpochNotFound"] = 6358] = "EpochNotFound";
|
|
105
|
+
SapErrorCode[SapErrorCode["VaultAlreadyOpen"] = 6359] = "VaultAlreadyOpen";
|
|
106
|
+
SapErrorCode[SapErrorCode["InvalidSequence"] = 6360] = "InvalidSequence";
|
|
107
|
+
SapErrorCode[SapErrorCode["FragmentTooLarge"] = 6361] = "FragmentTooLarge";
|
|
108
|
+
SapErrorCode[SapErrorCode["VaultClosed"] = 6362] = "VaultClosed";
|
|
109
|
+
SapErrorCode[SapErrorCode["InsufficientVaultBalance"] = 6363] = "InsufficientVaultBalance";
|
|
110
|
+
})(SapErrorCode || (SapErrorCode = {}));
|
|
111
|
+
const ERROR_MAP = {
|
|
112
|
+
[SapErrorCode.NameTooLong]: { code: SapErrorCode.NameTooLong, name: "NameTooLong", message: "Agent name exceeds 64 characters.", recovery: "Shorten the agent name to ≤64 chars." },
|
|
113
|
+
[SapErrorCode.NameTooShort]: { code: SapErrorCode.NameTooShort, name: "NameTooShort", message: "Agent name is too short.", recovery: "Use at least 3 characters for the agent name." },
|
|
114
|
+
[SapErrorCode.InvalidEndpoint]: { code: SapErrorCode.InvalidEndpoint, name: "InvalidEndpoint", message: "Endpoint URI must start with http:// or https://.", recovery: "Provide a valid HTTP or HTTPS URL." },
|
|
115
|
+
[SapErrorCode.EndpointTooLong]: { code: SapErrorCode.EndpointTooLong, name: "EndpointTooLong", message: "Endpoint URI exceeds 256 characters.", recovery: "Shorten the endpoint URL." },
|
|
116
|
+
[SapErrorCode.AgentClosed]: { code: SapErrorCode.AgentClosed, name: "AgentClosed", message: "Agent has been closed.", recovery: "Re-register the agent or use a different wallet." },
|
|
117
|
+
[SapErrorCode.CallerNotAgentOwner]: { code: SapErrorCode.CallerNotAgentOwner, name: "CallerNotAgentOwner", message: "Signer is not the agent owner.", recovery: "Sign with the wallet that owns the agent." },
|
|
118
|
+
[SapErrorCode.StakeBelowMinimum]: { code: SapErrorCode.StakeBelowMinimum, name: "StakeBelowMinimum", message: `Stake is below minimum (${1} SOL).`, recovery: "Increase the stake amount to at least 1 SOL." },
|
|
119
|
+
[SapErrorCode.NotStaked]: { code: SapErrorCode.NotStaked, name: "NotStaked", message: "Wallet has no stake account.", recovery: "Call stake() first to create a stake account." },
|
|
120
|
+
[SapErrorCode.UnstakeTooSoon]: { code: SapErrorCode.UnstakeTooSoon, name: "UnstakeTooSoon", message: "Cannot unstake yet — wait for the cooldown period.", recovery: "Wait 14 days after requesting unstake before completing." },
|
|
121
|
+
[SapErrorCode.UnstakeExceedsStake]: { code: SapErrorCode.UnstakeExceedsStake, name: "UnstakeExceedsStake", message: "Unstake amount exceeds staked amount.", recovery: "Reduce unstake amount to ≤ staked amount." },
|
|
122
|
+
[SapErrorCode.CannotCloseAgentWithActiveEscrows]: { code: SapErrorCode.CannotCloseAgentWithActiveEscrows, name: "CannotCloseAgentWithActiveEscrows", message: "Agent has active escrows.", recovery: "Close all escrows or wait for expiry before closing agent." },
|
|
123
|
+
[SapErrorCode.InsufficientEscrowBalance]: { code: SapErrorCode.InsufficientEscrowBalance, name: "InsufficientEscrowBalance", message: "Escrow has insufficient balance for the operation.", recovery: "Deposit more funds or reduce the settlement/withdraw amount." },
|
|
124
|
+
[SapErrorCode.EscrowNotFound]: { code: SapErrorCode.EscrowNotFound, name: "EscrowNotFound", message: "Escrow account does not exist.", recovery: "Verify the PDA seeds or create the escrow first." },
|
|
125
|
+
[SapErrorCode.AmountMustBePositive]: { code: SapErrorCode.AmountMustBePositive, name: "AmountMustBePositive", message: "Amount must be > 0.", recovery: "Provide a positive amount." },
|
|
126
|
+
[SapErrorCode.PricePerCallMustBePositive]: { code: SapErrorCode.PricePerCallMustBePositive, name: "PricePerCallMustBePositive", message: "price_per_call must be > 0.", recovery: "Set price_per_call to a positive value." },
|
|
127
|
+
[SapErrorCode.InvalidVolumeCurve]: { code: SapErrorCode.InvalidVolumeCurve, name: "InvalidVolumeCurve", message: "Volume curve breakpoints are not strictly increasing.", recovery: "Ensure each breakpoint's after_calls > the previous." },
|
|
128
|
+
[SapErrorCode.VolumeCurveNotDescending]: { code: SapErrorCode.VolumeCurveNotDescending, name: "VolumeCurveNotDescending", message: "Volume curve prices are not non-increasing.", recovery: "Ensure each breakpoint's price ≤ previous." },
|
|
129
|
+
[SapErrorCode.TooManyVolumeCurvePoints]: { code: SapErrorCode.TooManyVolumeCurvePoints, name: "TooManyVolumeCurvePoints", message: "Volume curve exceeds max 10 points.", recovery: "Reduce volume curve to ≤10 breakpoints." },
|
|
130
|
+
[SapErrorCode.SettlementNotPending]: { code: SapErrorCode.SettlementNotPending, name: "SettlementNotPending", message: "Settlement is not in pending state.", recovery: "Verify the settlement index or file a dispute." },
|
|
131
|
+
[SapErrorCode.SettlementAlreadyFinalized]: { code: SapErrorCode.SettlementAlreadyFinalized, name: "SettlementAlreadyFinalized", message: "Settlement already finalized.", recovery: "Nothing to do — settlement is complete." },
|
|
132
|
+
[SapErrorCode.DisputeWindowNotExpired]: { code: SapErrorCode.DisputeWindowNotExpired, name: "DisputeWindowNotExpired", message: "Dispute window has not expired yet.", recovery: "Wait for the dispute window to close." },
|
|
133
|
+
[SapErrorCode.DisputeWindowExpired]: { code: SapErrorCode.DisputeWindowExpired, name: "DisputeWindowExpired", message: "Dispute window has expired.", recovery: "The deadline for filing a dispute has passed." },
|
|
134
|
+
[SapErrorCode.NotDepositor]: { code: SapErrorCode.NotDepositor, name: "NotDepositor", message: "Signer is not the depositor.", recovery: "Sign with the wallet that deposited into the escrow." },
|
|
135
|
+
[SapErrorCode.DisputeAlreadyFiled]: { code: SapErrorCode.DisputeAlreadyFiled, name: "DisputeAlreadyFiled", message: "A dispute has already been filed for this settlement.", recovery: "Wait for the dispute to resolve or file on a different settlement." },
|
|
136
|
+
[SapErrorCode.DisputeStillOpen]: { code: SapErrorCode.DisputeStillOpen, name: "DisputeStillOpen", message: "Dispute is still open.", recovery: "Wait for the dispute to reach a final outcome." },
|
|
137
|
+
[SapErrorCode.NotArbiter]: { code: SapErrorCode.NotArbiter, name: "NotArbiter", message: "Signer is not the designated arbiter.", recovery: "Sign with the arbiter wallet or wait for auto-resolution." },
|
|
138
|
+
[SapErrorCode.ArbiterRequired]: { code: SapErrorCode.ArbiterRequired, name: "ArbiterRequired", message: "Arbiter must be set for DisputeWindow mode.", recovery: "Provide a valid arbiter public key when creating the escrow." },
|
|
139
|
+
[SapErrorCode.CoSignerRequired]: { code: SapErrorCode.CoSignerRequired, name: "CoSignerRequired", message: "CoSigner must be set for CoSigned mode.", recovery: "Provide a valid co-signer public key when creating the escrow." },
|
|
140
|
+
[SapErrorCode.InvalidCoSigner]: { code: SapErrorCode.InvalidCoSigner, name: "InvalidCoSigner", message: "Invalid co-signer public key.", recovery: "Provide a valid public key for the co-signer." },
|
|
141
|
+
[SapErrorCode.InvalidDisputeOutcome]: { code: SapErrorCode.InvalidDisputeOutcome, name: "InvalidDisputeOutcome", message: "Invalid dispute outcome.", recovery: "Outcome must be DepositorWins (1), AgentWins (2), or Refunded (3)." },
|
|
142
|
+
[SapErrorCode.EscrowEmpty]: { code: SapErrorCode.EscrowEmpty, name: "EscrowEmpty", message: "Escrow balance is zero.", recovery: "Deposit funds before withdrawing or settling." },
|
|
143
|
+
[SapErrorCode.EscrowAlreadyExpired]: { code: SapErrorCode.EscrowAlreadyExpired, name: "EscrowAlreadyExpired", message: "Escrow has already expired at the time of creation.", recovery: "Set expires_at to a future timestamp or 0 (never)." },
|
|
144
|
+
[SapErrorCode.EscrowExpired]: { code: SapErrorCode.EscrowExpired, name: "EscrowExpired", message: "Escrow has expired.", recovery: "Create a new escrow or withdraw remaining balance." },
|
|
145
|
+
[SapErrorCode.ReceiptBatchNotFound]: { code: SapErrorCode.ReceiptBatchNotFound, name: "ReceiptBatchNotFound", message: "Receipt batch not found.", recovery: "Create a receipt batch first." },
|
|
146
|
+
[SapErrorCode.InvalidReceiptProof]: { code: SapErrorCode.InvalidReceiptProof, name: "InvalidReceiptProof", message: "Receipt proof does not verify.", recovery: "Verify the receipt hash and merkle proof are correct." },
|
|
147
|
+
[SapErrorCode.InvalidMerkleProof]: { code: SapErrorCode.InvalidMerkleProof, name: "InvalidMerkleProof", message: "Merkle proof structure is invalid.", recovery: "Check merkle proof depth (≤16) and sibling hashes." },
|
|
148
|
+
[SapErrorCode.SubscriptionNotFound]: { code: SapErrorCode.SubscriptionNotFound, name: "SubscriptionNotFound", message: "Subscription account does not exist.", recovery: "Create a subscription first." },
|
|
149
|
+
[SapErrorCode.NotSubscriber]: { code: SapErrorCode.NotSubscriber, name: "NotSubscriber", message: "Signer is not the subscriber.", recovery: "Sign with the wallet that created the subscription." },
|
|
150
|
+
[SapErrorCode.SubscriptionInsufficientBalance]: { code: SapErrorCode.SubscriptionInsufficientBalance, name: "SubscriptionInsufficientBalance", message: "Subscription has insufficient balance.", recovery: "Fund the subscription before claiming." },
|
|
151
|
+
[SapErrorCode.SubscriptionIntervalOverflow]: { code: SapErrorCode.SubscriptionIntervalOverflow, name: "SubscriptionIntervalOverflow", message: "Claimable intervals exceed u32 range.", recovery: "Claim in smaller batches." },
|
|
152
|
+
[SapErrorCode.SubscriptionDurationTooLong]: { code: SapErrorCode.SubscriptionDurationTooLong, name: "SubscriptionDurationTooLong", message: "Subscription duration exceeds 10 years.", recovery: "Reduce the subscription duration." },
|
|
153
|
+
[SapErrorCode.ArithmeticOverflow]: { code: SapErrorCode.ArithmeticOverflow, name: "ArithmeticOverflow", message: "Arithmetic operation overflow.", recovery: "Reduce amounts to stay within u64 range." },
|
|
154
|
+
[SapErrorCode.VaultNotFound]: { code: SapErrorCode.VaultNotFound, name: "VaultNotFound", message: "Vault account does not exist.", recovery: "Create a vault first." },
|
|
155
|
+
[SapErrorCode.VaultAlreadyInitialized]: { code: SapErrorCode.VaultAlreadyInitialized, name: "VaultAlreadyInitialized", message: "Vault is already initialized.", recovery: "Use the existing vault or close it first." },
|
|
156
|
+
[SapErrorCode.NotVaultOwner]: { code: SapErrorCode.NotVaultOwner, name: "NotVaultOwner", message: "Signer is not the vault owner.", recovery: "Sign with the agent wallet that owns the vault." },
|
|
157
|
+
[SapErrorCode.NotDelegate]: { code: SapErrorCode.NotDelegate, name: "NotDelegate", message: "Signer is not a vault delegate.", recovery: "Add the signer as a vault delegate first." },
|
|
158
|
+
[SapErrorCode.DelegateExpired]: { code: SapErrorCode.DelegateExpired, name: "DelegateExpired", message: "Vault delegate has expired.", recovery: "Renew the delegate or use the owner wallet." },
|
|
159
|
+
[SapErrorCode.InvalidPermissions]: { code: SapErrorCode.InvalidPermissions, name: "InvalidPermissions", message: "Invalid vault delegate permissions.", recovery: "Use a valid permission bitmask (1=inscribe, 2=close, 4=open)." },
|
|
160
|
+
[SapErrorCode.SessionNotFound]: { code: SapErrorCode.SessionNotFound, name: "SessionNotFound", message: "Session ledger does not exist.", recovery: "Create a session first." },
|
|
161
|
+
[SapErrorCode.EpochNotFound]: { code: SapErrorCode.EpochNotFound, name: "EpochNotFound", message: "Epoch page does not exist.", recovery: "Create an epoch first." },
|
|
162
|
+
[SapErrorCode.VaultAlreadyOpen]: { code: SapErrorCode.VaultAlreadyOpen, name: "VaultAlreadyOpen", message: "Vault is already open.", recovery: "Vault is already initialized — proceed with inscription." },
|
|
163
|
+
[SapErrorCode.InvalidSequence]: { code: SapErrorCode.InvalidSequence, name: "InvalidSequence", message: "Inscription sequence is invalid.", recovery: "Use the next expected sequence number." },
|
|
164
|
+
[SapErrorCode.FragmentTooLarge]: { code: SapErrorCode.FragmentTooLarge, name: "FragmentTooLarge", message: "Inscription fragment exceeds max size.", recovery: "Split the inscription into smaller fragments." },
|
|
165
|
+
[SapErrorCode.VaultClosed]: { code: SapErrorCode.VaultClosed, name: "VaultClosed", message: "Vault has been closed.", recovery: "Re-open the vault or create a new one." },
|
|
166
|
+
[SapErrorCode.InsufficientVaultBalance]: { code: SapErrorCode.InsufficientVaultBalance, name: "InsufficientVaultBalance", message: "Vault has insufficient balance.", recovery: "Deposit more funds into the vault." },
|
|
167
|
+
// ── v0.13 Hardening Errors ──
|
|
168
|
+
[SapErrorCode.PendingAmountMismatch]: { code: SapErrorCode.PendingAmountMismatch, name: "PendingAmountMismatch", message: "Pending settlement amount does not match escrow.", recovery: "This is a protocol bug — escalate immediately." },
|
|
169
|
+
[SapErrorCode.MaxCallsPerSettlementExceeded]: { code: SapErrorCode.MaxCallsPerSettlementExceeded, name: "MaxCallsPerSettlementExceeded", message: "Calls per settlement exceeds 10,000.", recovery: "Split settlement into multiple batches of ≤10,000 calls." },
|
|
170
|
+
[SapErrorCode.InvalidVolumeCurvePrice]: { code: SapErrorCode.InvalidVolumeCurvePrice, name: "InvalidVolumeCurvePrice", message: "Volume curve breakpoint price must be > 0.", recovery: "Set price_per_call > 0 for all breakpoints." },
|
|
171
|
+
[SapErrorCode.EscrowCoverageExceeded]: { code: SapErrorCode.EscrowCoverageExceeded, name: "EscrowCoverageExceeded", message: "Escrow deposit would exceed agent staked coverage.", recovery: "Increase agent stake or reduce deposit amount." },
|
|
172
|
+
[SapErrorCode.CoSignerIsAgentWallet]: { code: SapErrorCode.CoSignerIsAgentWallet, name: "CoSignerIsAgentWallet", message: "Co-signer cannot be the agent's own wallet.", recovery: "Use a different wallet for the co-signer." },
|
|
173
|
+
[SapErrorCode.PendingSettlementExists]: { code: SapErrorCode.PendingSettlementExists, name: "PendingSettlementExists", message: "Escrow has an unresolved pending settlement.", recovery: "Finalize or dispute the pending settlement before closing." },
|
|
174
|
+
[SapErrorCode.TokenAccountOwnerMismatch]: { code: SapErrorCode.TokenAccountOwnerMismatch, name: "TokenAccountOwnerMismatch", message: "SPL token account owner mismatch.", recovery: "Verify the destination token account belongs to the depositor." },
|
|
175
|
+
[SapErrorCode.MaxReceiptProofExceeded]: { code: SapErrorCode.MaxReceiptProofExceeded, name: "MaxReceiptProofExceeded", message: "Receipt proof exceeds 128 receipts.", recovery: "Submit proof in chunks of ≤128 receipts." },
|
|
176
|
+
[SapErrorCode.MaxMerkleDepthExceeded]: { code: SapErrorCode.MaxMerkleDepthExceeded, name: "MaxMerkleDepthExceeded", message: "Merkle proof depth exceeds 16.", recovery: "Verify merkle tree depth (≤16)." },
|
|
177
|
+
[SapErrorCode.StakeSlashLocksUnstake]: { code: SapErrorCode.StakeSlashLocksUnstake, name: "StakeSlashLocksUnstake", message: "Stake slash would lock unstake request.", recovery: "The unstake was reduced proportionally — retry." },
|
|
178
|
+
};
|
|
179
|
+
/** Decode an Anchor transaction error into structured info */
|
|
180
|
+
export function decodeSapError(err) {
|
|
181
|
+
// Anchor custom error format: { error: { errorCode: { code: number, number: number, ... }, ... } }
|
|
182
|
+
const anyErr = err;
|
|
183
|
+
let code;
|
|
184
|
+
// Anchor 0.30 format
|
|
185
|
+
if (anyErr.error?.errorCode?.code != null) {
|
|
186
|
+
code = anyErr.error.errorCode.code;
|
|
187
|
+
}
|
|
188
|
+
else if (anyErr.error?.errorCode?.number != null) {
|
|
189
|
+
code = anyErr.error.errorCode.number;
|
|
190
|
+
}
|
|
191
|
+
else if (anyErr.error?.instructionError?.[1]?.Custom != null) {
|
|
192
|
+
code = anyErr.error.instructionError[1].Custom;
|
|
193
|
+
}
|
|
194
|
+
if (code != null && ERROR_MAP[code]) {
|
|
195
|
+
return ERROR_MAP[code];
|
|
196
|
+
}
|
|
197
|
+
// Attempt log-based detection
|
|
198
|
+
if (anyErr.logs) {
|
|
199
|
+
for (const log of anyErr.logs) {
|
|
200
|
+
const match = log.match(/Error Code:\s*(\d+)/);
|
|
201
|
+
if (match) {
|
|
202
|
+
const logCode = parseInt(match[1], 10);
|
|
203
|
+
if (ERROR_MAP[logCode])
|
|
204
|
+
return ERROR_MAP[logCode];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
code: (code ?? -9999),
|
|
210
|
+
name: "UnknownError",
|
|
211
|
+
message: err?.message ?? "Unknown transaction error",
|
|
212
|
+
recovery: "Check transaction logs or retry with a different configuration.",
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/** Is this error retryable? */
|
|
216
|
+
export function isRetryableError(err) {
|
|
217
|
+
const retryable = [
|
|
218
|
+
SapErrorCode.DisputeWindowNotExpired,
|
|
219
|
+
SapErrorCode.UnstakeTooSoon,
|
|
220
|
+
SapErrorCode.EscrowExpired, // can retry with new escrow
|
|
221
|
+
];
|
|
222
|
+
return retryable.includes(err.code);
|
|
223
|
+
}
|
|
224
|
+
/** Is this a client-side validation error that should have been caught before sending?
|
|
225
|
+
* If true, the SDK's validate functions have a bug.
|
|
226
|
+
*/
|
|
227
|
+
export function isClientValidationFailure(err) {
|
|
228
|
+
const client = [
|
|
229
|
+
SapErrorCode.AmountMustBePositive,
|
|
230
|
+
SapErrorCode.PricePerCallMustBePositive,
|
|
231
|
+
SapErrorCode.InvalidVolumeCurve,
|
|
232
|
+
SapErrorCode.VolumeCurveNotDescending,
|
|
233
|
+
SapErrorCode.TooManyVolumeCurvePoints,
|
|
234
|
+
SapErrorCode.MaxCallsPerSettlementExceeded,
|
|
235
|
+
SapErrorCode.InvalidVolumeCurvePrice,
|
|
236
|
+
SapErrorCode.EscrowAlreadyExpired,
|
|
237
|
+
SapErrorCode.CoSignerIsAgentWallet,
|
|
238
|
+
SapErrorCode.MaxReceiptProofExceeded,
|
|
239
|
+
SapErrorCode.MaxMerkleDepthExceeded,
|
|
240
|
+
SapErrorCode.SubscriptionDurationTooLong,
|
|
241
|
+
];
|
|
242
|
+
return client.includes(err.code);
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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AU,gBAAgB,CAAC,GAAiB;IAChD,MAAM,SAAS,GAAG;QAChB,YAAY,CAAC,uBAAuB;QACpC,YAAY,CAAC,cAAc;QAC3B,YAAY,CAAC,aAAa,EAAE,4BAA4B;KACzD,CAAC;IACF,OAAO,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAiB;IACzD,MAAM,MAAM,GAAG;QACb,YAAY,CAAC,oBAAoB;QACjC,YAAY,CAAC,0BAA0B;QACvC,YAAY,CAAC,kBAAkB;QAC/B,YAAY,CAAC,wBAAwB;QACrC,YAAY,CAAC,wBAAwB;QACrC,YAAY,CAAC,6BAA6B;QAC1C,YAAY,CAAC,uBAAuB;QACpC,YAAY,CAAC,oBAAoB;QACjC,YAAY,CAAC,qBAAqB;QAClC,YAAY,CAAC,uBAAuB;QACpC,YAAY,CAAC,sBAAsB;QACnC,YAAY,CAAC,2BAA2B;KACzC,CAAC;IACF,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TransactionSignature } from "@solana/web3.js";
|
|
2
|
+
export interface ParsedEvent {
|
|
3
|
+
name: string;
|
|
4
|
+
data: Record<string, any>;
|
|
5
|
+
signature: TransactionSignature;
|
|
6
|
+
slot: number;
|
|
7
|
+
}
|
|
8
|
+
/** Parse program logs for emitted events */
|
|
9
|
+
export declare function parseEventsFromLogs(logs: string[], signature: string): ParsedEvent[];
|
|
10
|
+
/** Fetch + parse events for a given transaction */
|
|
11
|
+
export declare function fetchTransactionEvents(connection: any, // Connection
|
|
12
|
+
signature: TransactionSignature): Promise<ParsedEvent[]>;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/events/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAa,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,SAAS,EAAE,oBAAoB,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;CACd;AAYD,4CAA4C;AAC5C,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EAAE,EACd,SAAS,EAAE,MAAM,GAChB,WAAW,EAAE,CAef;AAED,mDAAmD;AACnD,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,GAAG,EAAE,aAAa;AAC9B,SAAS,EAAE,oBAAoB,GAC9B,OAAO,CAAC,WAAW,EAAE,CAAC,CAIxB"}
|
package/dist/esm/events/index.js
CHANGED
|
@@ -1,132 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* Exhaustive list of all SAP v2 event name strings.
|
|
29
|
-
*
|
|
30
|
-
* @name SAP_EVENT_NAMES
|
|
31
|
-
* @description Frozen array of every event discriminant emitted by the program.
|
|
32
|
-
* Useful for log filtering and exhaustive switch checks.
|
|
33
|
-
* @category Events
|
|
34
|
-
* @since v0.1.0
|
|
35
|
-
* @see {@link SapEventName}
|
|
36
|
-
*/
|
|
37
|
-
export const SAP_EVENT_NAMES = [
|
|
38
|
-
"RegisteredEvent",
|
|
39
|
-
"UpdatedEvent",
|
|
40
|
-
"DeactivatedEvent",
|
|
41
|
-
"ReactivatedEvent",
|
|
42
|
-
"ClosedEvent",
|
|
43
|
-
"FeedbackEvent",
|
|
44
|
-
"FeedbackUpdatedEvent",
|
|
45
|
-
"FeedbackRevokedEvent",
|
|
46
|
-
"ReputationUpdatedEvent",
|
|
47
|
-
"CallsReportedEvent",
|
|
48
|
-
"VaultInitializedEvent",
|
|
49
|
-
"SessionOpenedEvent",
|
|
50
|
-
"MemoryInscribedEvent",
|
|
51
|
-
"EpochOpenedEvent",
|
|
52
|
-
"SessionClosedEvent",
|
|
53
|
-
"VaultClosedEvent",
|
|
54
|
-
"SessionPdaClosedEvent",
|
|
55
|
-
"EpochPageClosedEvent",
|
|
56
|
-
"VaultNonceRotatedEvent",
|
|
57
|
-
"DelegateAddedEvent",
|
|
58
|
-
"DelegateRevokedEvent",
|
|
59
|
-
"ToolPublishedEvent",
|
|
60
|
-
"ToolSchemaInscribedEvent",
|
|
61
|
-
"ToolUpdatedEvent",
|
|
62
|
-
"ToolDeactivatedEvent",
|
|
63
|
-
"ToolReactivatedEvent",
|
|
64
|
-
"ToolClosedEvent",
|
|
65
|
-
"ToolInvocationReportedEvent",
|
|
66
|
-
"CheckpointCreatedEvent",
|
|
67
|
-
"EscrowCreatedEvent",
|
|
68
|
-
"EscrowDepositedEvent",
|
|
69
|
-
"PaymentSettledEvent",
|
|
70
|
-
"EscrowWithdrawnEvent",
|
|
71
|
-
"BatchSettledEvent",
|
|
72
|
-
"AttestationCreatedEvent",
|
|
73
|
-
"AttestationRevokedEvent",
|
|
74
|
-
"LedgerEntryEvent",
|
|
75
|
-
"LedgerSealedEvent",
|
|
76
|
-
];
|
|
77
|
-
/**
|
|
78
|
-
* Typed wrapper around Anchor’s `EventParser` for SAP v2 programs.
|
|
79
|
-
*
|
|
80
|
-
* Extracts strongly-typed {@link ParsedEvent} objects from raw
|
|
81
|
-
* transaction log lines.
|
|
82
|
-
*
|
|
83
|
-
* @name EventParser
|
|
84
|
-
* @description Instantiate with an Anchor `Program` and call {@link EventParser.parseLogs}
|
|
85
|
-
* to decode events, or {@link EventParser.filterByName} to narrow results.
|
|
86
|
-
* @category Events
|
|
87
|
-
* @since v0.1.0
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* ```ts
|
|
91
|
-
* const parser = new EventParser(program);
|
|
92
|
-
* const events = parser.parseLogs(txLogs);
|
|
93
|
-
* const settled = parser.filterByName(events, "PaymentSettledEvent");
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
export class EventParser {
|
|
97
|
-
parser;
|
|
98
|
-
/**
|
|
99
|
-
* Create a new `EventParser`.
|
|
100
|
-
*
|
|
101
|
-
* @param program - An Anchor `Program` instance whose IDL defines the events to decode.
|
|
102
|
-
*/
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
104
|
-
constructor(program) {
|
|
105
|
-
this.parser = new AnchorEventParser(program.programId, program.coder);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Parse raw transaction log lines into typed events.
|
|
109
|
-
*
|
|
110
|
-
* @param logs - Array of log strings from a confirmed transaction.
|
|
111
|
-
* @returns {ParsedEvent[]} Decoded events found in the logs.
|
|
112
|
-
*/
|
|
113
|
-
parseLogs(logs) {
|
|
114
|
-
const events = [];
|
|
115
|
-
const generator = this.parser.parseLogs(logs);
|
|
116
|
-
for (const event of generator) {
|
|
117
|
-
events.push(event);
|
|
1
|
+
// ================================================================
|
|
2
|
+
// synapse-sap-sdk / src/events/index.ts
|
|
3
|
+
// All program event parsers
|
|
4
|
+
// ================================================================
|
|
5
|
+
const EVENT_DISCRIMS = {
|
|
6
|
+
EscrowCreated: new Uint8Array([0]),
|
|
7
|
+
SettlementFiled: new Uint8Array([0]),
|
|
8
|
+
SettlementFinalized: new Uint8Array([0]),
|
|
9
|
+
DisputeFiled: new Uint8Array([0]),
|
|
10
|
+
DisputeResolved: new Uint8Array([0]),
|
|
11
|
+
StakeEvent: new Uint8Array([0]),
|
|
12
|
+
SubscriptionEvent: new Uint8Array([0]),
|
|
13
|
+
};
|
|
14
|
+
/** Parse program logs for emitted events */
|
|
15
|
+
export function parseEventsFromLogs(logs, signature) {
|
|
16
|
+
const events = [];
|
|
17
|
+
for (const log of logs) {
|
|
18
|
+
if (!log.includes("Program log:"))
|
|
19
|
+
continue;
|
|
20
|
+
const payload = log.replace(/^Program log:\s*/, "");
|
|
21
|
+
// Anchor event format: "Event <name> <base64encoded>"
|
|
22
|
+
for (const [name, _discrim] of Object.entries(EVENT_DISCRIMS)) {
|
|
23
|
+
if (payload.startsWith(`Event ${name} `)) {
|
|
24
|
+
const b64 = payload.slice(`Event ${name} `.length);
|
|
25
|
+
// TODO: full Borsh deserialization for each event schema
|
|
26
|
+
events.push({ name, data: { raw: b64 }, signature, slot: 0 });
|
|
27
|
+
}
|
|
118
28
|
}
|
|
119
|
-
return events;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Filter a list of parsed events by event name.
|
|
123
|
-
*
|
|
124
|
-
* @param events - The full array of {@link ParsedEvent} objects to filter.
|
|
125
|
-
* @param name - The {@link SapEventName} to match against.
|
|
126
|
-
* @returns {ParsedEvent[]} Only events whose `name` matches.
|
|
127
|
-
*/
|
|
128
|
-
filterByName(events, name) {
|
|
129
|
-
return events.filter((e) => e.name === name);
|
|
130
29
|
}
|
|
30
|
+
return events;
|
|
31
|
+
}
|
|
32
|
+
/** Fetch + parse events for a given transaction */
|
|
33
|
+
export async function fetchTransactionEvents(connection, // Connection
|
|
34
|
+
signature) {
|
|
35
|
+
const tx = await connection.getTransaction(signature, { commitment: "confirmed" });
|
|
36
|
+
if (!tx || !tx.meta?.logMessages)
|
|
37
|
+
return [];
|
|
38
|
+
return parseEventsFromLogs(tx.meta.logMessages, signature);
|
|
131
39
|
}
|
|
132
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/events/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/events/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,yCAAyC;AACzC,6BAA6B;AAC7B,mEAAmE;AAWnE,MAAM,cAAc,GAA+B;IACjD,aAAa,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,eAAe,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,mBAAmB,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,YAAY,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,eAAe,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,UAAU,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,iBAAiB,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC;AAEF,4CAA4C;AAC5C,MAAM,UAAU,mBAAmB,CACjC,IAAc,EACd,SAAiB;IAEjB,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC;YAAE,SAAS;QAC5C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;QACpD,sDAAsD;QACtD,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;YAC9D,IAAI,OAAO,CAAC,UAAU,CAAC,SAAS,IAAI,GAAG,CAAC,EAAE,CAAC;gBACzC,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;gBACnD,yDAAyD;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