@elisym/sdk 0.10.4 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/agent-store.cjs.map +1 -1
- package/dist/agent-store.js.map +1 -1
- package/dist/index.cjs +356 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -8
- package/dist/index.d.ts +109 -8
- package/dist/index.js +355 -107
- package/dist/index.js.map +1 -1
- package/dist/skills.cjs.map +1 -1
- package/dist/skills.js.map +1 -1
- package/package.json +3 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, TransactionSigner, Rpc, SolanaRpcApi } from '@solana/kit';
|
|
1
|
+
import { Address, TransactionSigner, Rpc, SolanaRpcApi, Signature } from '@solana/kit';
|
|
2
2
|
import { Filter, Event } from 'nostr-tools';
|
|
3
3
|
import { A as Asset } from './assets-C-nzSYD4.cjs';
|
|
4
4
|
export { C as Chain, K as KNOWN_ASSETS, N as NATIVE_SOL, U as USDC_SOLANA_DEVNET, a as assetByKey, b as assetKey, f as formatAssetAmount, p as parseAssetAmount, r as resolveAssetFromPaymentRequest, c as resolveKnownAsset } from './assets-C-nzSYD4.cjs';
|
|
@@ -183,8 +183,6 @@ interface PaymentValidationError {
|
|
|
183
183
|
message: string;
|
|
184
184
|
}
|
|
185
185
|
interface NetworkStats {
|
|
186
|
-
totalAgentCount: number;
|
|
187
|
-
agentCount: number;
|
|
188
186
|
jobCount: number;
|
|
189
187
|
totalLamports: number;
|
|
190
188
|
}
|
|
@@ -285,6 +283,14 @@ interface BuildTransactionOptions {
|
|
|
285
283
|
* quartile (default), 90 = aggressive.
|
|
286
284
|
*/
|
|
287
285
|
priorityFeePercentile?: number;
|
|
286
|
+
/**
|
|
287
|
+
* Nostr job request event id (hex) to embed in an SPL Memo instruction
|
|
288
|
+
* with payload `elisym:v1:<jobEventId>`. Off-chain indexers join the memo
|
|
289
|
+
* back to the originating job for per-provider/per-capability analytics.
|
|
290
|
+
* Memo is omitted when this option is absent; the protocol tag is still
|
|
291
|
+
* attached either way.
|
|
292
|
+
*/
|
|
293
|
+
jobEventId?: string;
|
|
288
294
|
}
|
|
289
295
|
|
|
290
296
|
declare class NostrPool {
|
|
@@ -314,7 +320,9 @@ declare class NostrPool {
|
|
|
314
320
|
publish(event: Event): Promise<void>;
|
|
315
321
|
/** Publish to all relays and wait for all to settle. Throws if none accepted. */
|
|
316
322
|
publishAll(event: Event): Promise<void>;
|
|
317
|
-
subscribe(filter: Filter, onEvent: (event: Event) => void
|
|
323
|
+
subscribe(filter: Filter, onEvent: (event: Event) => void, opts?: {
|
|
324
|
+
oneose?: () => void;
|
|
325
|
+
}): SubCloser;
|
|
318
326
|
/**
|
|
319
327
|
* Subscribe and wait until at least one relay confirms the subscription
|
|
320
328
|
* is active (EOSE). Resolves on the first relay that responds.
|
|
@@ -358,8 +366,6 @@ declare function compareAgentsByRank(a: Agent, b: Agent): number;
|
|
|
358
366
|
declare class DiscoveryService {
|
|
359
367
|
private pool;
|
|
360
368
|
constructor(pool: NostrPool);
|
|
361
|
-
/** Count elisym agents (kind:31990 with "elisym" tag). */
|
|
362
|
-
fetchAllAgentCount(): Promise<number>;
|
|
363
369
|
/**
|
|
364
370
|
* Fetch a single page of elisym agents with relay-side pagination.
|
|
365
371
|
* Uses `until` cursor for Nostr cursor-based pagination.
|
|
@@ -398,6 +404,43 @@ declare class DiscoveryService {
|
|
|
398
404
|
* provider.
|
|
399
405
|
*/
|
|
400
406
|
fetchAgents(network?: Network, limit?: number): Promise<Agent[]>;
|
|
407
|
+
/**
|
|
408
|
+
* Enrich an agent map with paid-job stats, feedback counters, and kind:0
|
|
409
|
+
* metadata, then return them sorted by `compareAgentsByRank`. Mutates the
|
|
410
|
+
* passed-in `Agent` objects in place.
|
|
411
|
+
*
|
|
412
|
+
* Shared between `fetchAgents` (one-shot) and `streamAgents` (post-EOSE
|
|
413
|
+
* second pass). The `signal` short-circuits the post-query work; in-flight
|
|
414
|
+
* pool queries are not cancellable today (they fall through to the standard
|
|
415
|
+
* timeout) and the caller drops the resolved value.
|
|
416
|
+
*/
|
|
417
|
+
private runEnrichment;
|
|
418
|
+
/**
|
|
419
|
+
* Stream elisym agents progressively as relays deliver events.
|
|
420
|
+
*
|
|
421
|
+
* Two live subscriptions:
|
|
422
|
+
* - kind:31990 (capability cards) - emits `onAgent(agent)` for every new or
|
|
423
|
+
* updated `(pubkey, d-tag)`. The emitted Agent is the merged view across
|
|
424
|
+
* all surviving cards for that author.
|
|
425
|
+
* - kind:6100 (default-offset job results) tagged `t=elisym` since 30d ago -
|
|
426
|
+
* emits `onPaidJob(pubkey, ts)` for each delivered result. Custom-kind
|
|
427
|
+
* results (offset != 100) are not on this stream; they enter the final
|
|
428
|
+
* ranking via the post-EOSE enrichment pass.
|
|
429
|
+
*
|
|
430
|
+
* After capabilities EOSE, an enrichment pass runs in parallel to the live
|
|
431
|
+
* subscriptions and produces a ranked snapshot via `onComplete`. The snapshot
|
|
432
|
+
* is a clone, so further live updates do not mutate it.
|
|
433
|
+
*
|
|
434
|
+
* `closer.close()` tears down both subscriptions and aborts an in-flight
|
|
435
|
+
* enrichment. If `opts.signal` is provided, aborting it does the same.
|
|
436
|
+
*/
|
|
437
|
+
streamAgents(network: Network, opts: {
|
|
438
|
+
onAgent: (agent: Agent) => void;
|
|
439
|
+
onPaidJob?: (pubkey: string, ts: number) => void;
|
|
440
|
+
onEose?: () => void;
|
|
441
|
+
onComplete?: (agents: Agent[]) => void;
|
|
442
|
+
signal?: AbortSignal;
|
|
443
|
+
}): SubCloser;
|
|
401
444
|
/**
|
|
402
445
|
* Publish a capability card (kind:31990) as a provider.
|
|
403
446
|
* Solana address is validated for Base58 format only - full decode
|
|
@@ -591,12 +634,24 @@ declare class SolanaPaymentStrategy implements PaymentStrategy {
|
|
|
591
634
|
* extra read-only account (canonical Solana Pay pattern);
|
|
592
635
|
* 4. `TransferChecked` from payer ATA to treasury ATA if a fee applies.
|
|
593
636
|
*
|
|
637
|
+
* Every provider transfer instruction also carries `ELISYM_PROTOCOL_TAG` as a
|
|
638
|
+
* read-only marker account so off-chain indexers can enumerate every elisym
|
|
639
|
+
* transaction with a single `getSignaturesForAddress(ELISYM_PROTOCOL_TAG)`
|
|
640
|
+
* call, regardless of fee size.
|
|
641
|
+
*
|
|
642
|
+
* If `options.jobEventId` is provided, an SPL Memo instruction with payload
|
|
643
|
+
* `elisym:v1:<jobEventId>` is prepended so explorers display the originating
|
|
644
|
+
* Nostr job id and indexers can join on-chain payments back to off-chain
|
|
645
|
+
* job context.
|
|
646
|
+
*
|
|
594
647
|
* Async because SPL ATAs are PDAs and `findAssociatedTokenPda` is async.
|
|
595
648
|
*
|
|
596
649
|
* Caller is responsible for validating `paymentRequest` upstream;
|
|
597
650
|
* `buildTransaction` already does that before invoking this helper.
|
|
598
651
|
*/
|
|
599
|
-
declare function buildPaymentInstructions(paymentRequest: PaymentRequestData, payerSigner: Signer
|
|
652
|
+
declare function buildPaymentInstructions(paymentRequest: PaymentRequestData, payerSigner: Signer, options?: {
|
|
653
|
+
jobEventId?: string;
|
|
654
|
+
}): Promise<readonly unknown[]>;
|
|
600
655
|
/**
|
|
601
656
|
* Convenience wrapper: fetch the on-chain protocol config first, then build a
|
|
602
657
|
* payment request using its current fee/treasury values.
|
|
@@ -838,6 +893,40 @@ interface QuickVerifyResult {
|
|
|
838
893
|
declare function clearQuickVerifyCache(): void;
|
|
839
894
|
declare function verifyJobPaymentQuick(rpc: Rpc<SolanaRpcApi>, txSignature: string, expectedRecipient: Address): Promise<QuickVerifyResult>;
|
|
840
895
|
|
|
896
|
+
/**
|
|
897
|
+
* Aggregated on-chain stats across the entire elisym network. Volume is
|
|
898
|
+
* keyed by `'native'` for SOL or by SPL mint address; values are subunits
|
|
899
|
+
* (lamports for native, raw token units for SPL).
|
|
900
|
+
*/
|
|
901
|
+
interface NetworkStatsResult {
|
|
902
|
+
jobCount: number;
|
|
903
|
+
volumeByAsset: Record<string, bigint>;
|
|
904
|
+
/** Most-recent signature returned by the RPC (use as cursor for forward sync). */
|
|
905
|
+
latestSignature?: string;
|
|
906
|
+
/** Oldest signature scanned in this batch (use as `before` for next page). */
|
|
907
|
+
oldestSignature?: string;
|
|
908
|
+
}
|
|
909
|
+
interface AggregateNetworkStatsOptions {
|
|
910
|
+
/** Cap on signatures fetched in one call. Defaults to 1000 (RPC max). */
|
|
911
|
+
limit?: number;
|
|
912
|
+
/** Page backwards from this signature for historical scans. */
|
|
913
|
+
before?: Signature;
|
|
914
|
+
/** Parallel `getTransaction` calls. Defaults to `DEFAULTS.QUERY_MAX_CONCURRENCY`. */
|
|
915
|
+
concurrency?: number;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Enumerate every elisym payment transaction reachable from the protocol tag
|
|
919
|
+
* pubkey and aggregate gross volume + count.
|
|
920
|
+
*
|
|
921
|
+
* Implementation detail: for SPL txs we sum positive token-balance deltas per
|
|
922
|
+
* mint (ignores ATA rent that would inflate native lamport deltas in the same
|
|
923
|
+
* tx). For native SOL txs we sum positive lamport deltas across all non-payer
|
|
924
|
+
* accounts - elisym native txs only emit provider + optional fee transfers,
|
|
925
|
+
* so this equals gross volume. The `tx_fee` paid by the fee-payer never shows
|
|
926
|
+
* up as a positive delta, so it is naturally excluded.
|
|
927
|
+
*/
|
|
928
|
+
declare function aggregateNetworkStats(rpc: Rpc<SolanaRpcApi>, options?: AggregateNetworkStatsOptions): Promise<NetworkStatsResult>;
|
|
929
|
+
|
|
841
930
|
/**
|
|
842
931
|
* Snapshot of the on-chain elisym-config program state.
|
|
843
932
|
*
|
|
@@ -1015,6 +1104,18 @@ declare const PROTOCOL_TREASURY: Address;
|
|
|
1015
1104
|
* treasury address, and admin rotation state. Read via `getProtocolConfig`.
|
|
1016
1105
|
*/
|
|
1017
1106
|
declare const PROTOCOL_PROGRAM_ID_DEVNET: Address;
|
|
1107
|
+
/**
|
|
1108
|
+
* Read-only marker pubkey attached as a non-signer account to every elisym
|
|
1109
|
+
* payment transaction. Lets indexers enumerate every elisym tx network-wide
|
|
1110
|
+
* via a single `getSignaturesForAddress(ELISYM_PROTOCOL_TAG)` call,
|
|
1111
|
+
* independent of fee size or recipient.
|
|
1112
|
+
*
|
|
1113
|
+
* The account does not need to exist on-chain; including its pubkey as an
|
|
1114
|
+
* extra read-only account in the provider transfer instruction is enough for
|
|
1115
|
+
* Solana's tx-by-account index to pick it up. The corresponding secret key
|
|
1116
|
+
* was generated and discarded - the tag never signs and never holds funds.
|
|
1117
|
+
*/
|
|
1118
|
+
declare const ELISYM_PROTOCOL_TAG: Address;
|
|
1018
1119
|
type ProtocolCluster = 'devnet' | 'mainnet' | 'localnet';
|
|
1019
1120
|
/**
|
|
1020
1121
|
* Resolve the elisym-config program ID for a given Solana cluster.
|
|
@@ -1050,4 +1151,4 @@ declare const LIMITS: {
|
|
|
1050
1151
|
readonly MAX_CAPABILITY_LENGTH: 64;
|
|
1051
1152
|
};
|
|
1052
1153
|
|
|
1053
|
-
export { type Agent, Asset, BoundedSet, type BuildTransactionOptions, type CapabilityCard, DEFAULTS, DEFAULT_KIND_OFFSET, DEFAULT_REDACT_PATHS, DiscoveryService, ElisymClient, type ElisymClientConfig, type ElisymClientFullConfig, ElisymIdentity, type EstimatePriorityFeeOptions, type EstimateSolFeeOptions, type GetProtocolConfigOptions, INPUT_REDACT_PATHS, type Job, type JobStatus, type JobSubscriptionOptions, type JobUpdateCallbacks, KIND_APP_HANDLER, KIND_JOB_FEEDBACK, KIND_JOB_REQUEST, KIND_JOB_REQUEST_BASE, KIND_JOB_RESULT, KIND_JOB_RESULT_BASE, KIND_PING, KIND_PONG, LAMPORTS_PER_SOL, LIMITS, MarketplaceService, MediaService, type Network, type NetworkStats, NostrPool, PROTOCOL_FEE_BPS, PROTOCOL_PROGRAM_ID_DEVNET, PROTOCOL_TREASURY, type ParseOptions, type ParseResult, type ParsedPaymentRequest, type PaymentAssetRef, type PaymentInfo, type PaymentRequestData, PaymentRequestSchema, type PaymentStrategy, type PaymentValidationCode, type PaymentValidationError, type PingResult, PingService, type ProtocolCluster, type ProtocolConfig, type ProtocolConfigInput, type QuickVerifyReason, type QuickVerifyResult, RELAYS, type RankKey, type RateLimitDecision, SECRET_REDACT_PATHS, type Signer, type SlidingWindowLimiter, type SlidingWindowLimiterOptions, type SolFeeEstimate, SolanaPaymentStrategy, type SubCloser, type SubmitJobOptions, type VerifyOptions, type VerifyResult, assertExpiry, assertLamports, buildPaymentInstructions, calculateProtocolFee, clearPriorityFeeCache, clearProtocolConfigCache, clearQuickVerifyCache, compareAgentsByRank, computeRankKey, createPaymentRequestWithOnchainConfig, createSlidingWindowLimiter, estimatePriorityFeeMicroLamports, estimateSolFeeLamports, formatFeeBreakdown, formatSol, getProtocolConfig, getProtocolProgramId, jobRequestKind, jobResultKind, makeCensor, nip44Decrypt, nip44Encrypt, parsePaymentRequest, pickPercentileFee, timeAgo, toDTag, truncateKey, validateAgentName, validateExpiry, verifyJobPaymentQuick };
|
|
1154
|
+
export { type Agent, type AggregateNetworkStatsOptions, Asset, BoundedSet, type BuildTransactionOptions, type CapabilityCard, DEFAULTS, DEFAULT_KIND_OFFSET, DEFAULT_REDACT_PATHS, DiscoveryService, ELISYM_PROTOCOL_TAG, ElisymClient, type ElisymClientConfig, type ElisymClientFullConfig, ElisymIdentity, type EstimatePriorityFeeOptions, type EstimateSolFeeOptions, type GetProtocolConfigOptions, INPUT_REDACT_PATHS, type Job, type JobStatus, type JobSubscriptionOptions, type JobUpdateCallbacks, KIND_APP_HANDLER, KIND_JOB_FEEDBACK, KIND_JOB_REQUEST, KIND_JOB_REQUEST_BASE, KIND_JOB_RESULT, KIND_JOB_RESULT_BASE, KIND_PING, KIND_PONG, LAMPORTS_PER_SOL, LIMITS, MarketplaceService, MediaService, type Network, type NetworkStats, type NetworkStatsResult, NostrPool, PROTOCOL_FEE_BPS, PROTOCOL_PROGRAM_ID_DEVNET, PROTOCOL_TREASURY, type ParseOptions, type ParseResult, type ParsedPaymentRequest, type PaymentAssetRef, type PaymentInfo, type PaymentRequestData, PaymentRequestSchema, type PaymentStrategy, type PaymentValidationCode, type PaymentValidationError, type PingResult, PingService, type ProtocolCluster, type ProtocolConfig, type ProtocolConfigInput, type QuickVerifyReason, type QuickVerifyResult, RELAYS, type RankKey, type RateLimitDecision, SECRET_REDACT_PATHS, type Signer, type SlidingWindowLimiter, type SlidingWindowLimiterOptions, type SolFeeEstimate, SolanaPaymentStrategy, type SubCloser, type SubmitJobOptions, type VerifyOptions, type VerifyResult, aggregateNetworkStats, assertExpiry, assertLamports, buildPaymentInstructions, calculateProtocolFee, clearPriorityFeeCache, clearProtocolConfigCache, clearQuickVerifyCache, compareAgentsByRank, computeRankKey, createPaymentRequestWithOnchainConfig, createSlidingWindowLimiter, estimatePriorityFeeMicroLamports, estimateSolFeeLamports, formatFeeBreakdown, formatSol, getProtocolConfig, getProtocolProgramId, jobRequestKind, jobResultKind, makeCensor, nip44Decrypt, nip44Encrypt, parsePaymentRequest, pickPercentileFee, timeAgo, toDTag, truncateKey, validateAgentName, validateExpiry, verifyJobPaymentQuick };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, TransactionSigner, Rpc, SolanaRpcApi } from '@solana/kit';
|
|
1
|
+
import { Address, TransactionSigner, Rpc, SolanaRpcApi, Signature } from '@solana/kit';
|
|
2
2
|
import { Filter, Event } from 'nostr-tools';
|
|
3
3
|
import { A as Asset } from './assets-C-nzSYD4.js';
|
|
4
4
|
export { C as Chain, K as KNOWN_ASSETS, N as NATIVE_SOL, U as USDC_SOLANA_DEVNET, a as assetByKey, b as assetKey, f as formatAssetAmount, p as parseAssetAmount, r as resolveAssetFromPaymentRequest, c as resolveKnownAsset } from './assets-C-nzSYD4.js';
|
|
@@ -183,8 +183,6 @@ interface PaymentValidationError {
|
|
|
183
183
|
message: string;
|
|
184
184
|
}
|
|
185
185
|
interface NetworkStats {
|
|
186
|
-
totalAgentCount: number;
|
|
187
|
-
agentCount: number;
|
|
188
186
|
jobCount: number;
|
|
189
187
|
totalLamports: number;
|
|
190
188
|
}
|
|
@@ -285,6 +283,14 @@ interface BuildTransactionOptions {
|
|
|
285
283
|
* quartile (default), 90 = aggressive.
|
|
286
284
|
*/
|
|
287
285
|
priorityFeePercentile?: number;
|
|
286
|
+
/**
|
|
287
|
+
* Nostr job request event id (hex) to embed in an SPL Memo instruction
|
|
288
|
+
* with payload `elisym:v1:<jobEventId>`. Off-chain indexers join the memo
|
|
289
|
+
* back to the originating job for per-provider/per-capability analytics.
|
|
290
|
+
* Memo is omitted when this option is absent; the protocol tag is still
|
|
291
|
+
* attached either way.
|
|
292
|
+
*/
|
|
293
|
+
jobEventId?: string;
|
|
288
294
|
}
|
|
289
295
|
|
|
290
296
|
declare class NostrPool {
|
|
@@ -314,7 +320,9 @@ declare class NostrPool {
|
|
|
314
320
|
publish(event: Event): Promise<void>;
|
|
315
321
|
/** Publish to all relays and wait for all to settle. Throws if none accepted. */
|
|
316
322
|
publishAll(event: Event): Promise<void>;
|
|
317
|
-
subscribe(filter: Filter, onEvent: (event: Event) => void
|
|
323
|
+
subscribe(filter: Filter, onEvent: (event: Event) => void, opts?: {
|
|
324
|
+
oneose?: () => void;
|
|
325
|
+
}): SubCloser;
|
|
318
326
|
/**
|
|
319
327
|
* Subscribe and wait until at least one relay confirms the subscription
|
|
320
328
|
* is active (EOSE). Resolves on the first relay that responds.
|
|
@@ -358,8 +366,6 @@ declare function compareAgentsByRank(a: Agent, b: Agent): number;
|
|
|
358
366
|
declare class DiscoveryService {
|
|
359
367
|
private pool;
|
|
360
368
|
constructor(pool: NostrPool);
|
|
361
|
-
/** Count elisym agents (kind:31990 with "elisym" tag). */
|
|
362
|
-
fetchAllAgentCount(): Promise<number>;
|
|
363
369
|
/**
|
|
364
370
|
* Fetch a single page of elisym agents with relay-side pagination.
|
|
365
371
|
* Uses `until` cursor for Nostr cursor-based pagination.
|
|
@@ -398,6 +404,43 @@ declare class DiscoveryService {
|
|
|
398
404
|
* provider.
|
|
399
405
|
*/
|
|
400
406
|
fetchAgents(network?: Network, limit?: number): Promise<Agent[]>;
|
|
407
|
+
/**
|
|
408
|
+
* Enrich an agent map with paid-job stats, feedback counters, and kind:0
|
|
409
|
+
* metadata, then return them sorted by `compareAgentsByRank`. Mutates the
|
|
410
|
+
* passed-in `Agent` objects in place.
|
|
411
|
+
*
|
|
412
|
+
* Shared between `fetchAgents` (one-shot) and `streamAgents` (post-EOSE
|
|
413
|
+
* second pass). The `signal` short-circuits the post-query work; in-flight
|
|
414
|
+
* pool queries are not cancellable today (they fall through to the standard
|
|
415
|
+
* timeout) and the caller drops the resolved value.
|
|
416
|
+
*/
|
|
417
|
+
private runEnrichment;
|
|
418
|
+
/**
|
|
419
|
+
* Stream elisym agents progressively as relays deliver events.
|
|
420
|
+
*
|
|
421
|
+
* Two live subscriptions:
|
|
422
|
+
* - kind:31990 (capability cards) - emits `onAgent(agent)` for every new or
|
|
423
|
+
* updated `(pubkey, d-tag)`. The emitted Agent is the merged view across
|
|
424
|
+
* all surviving cards for that author.
|
|
425
|
+
* - kind:6100 (default-offset job results) tagged `t=elisym` since 30d ago -
|
|
426
|
+
* emits `onPaidJob(pubkey, ts)` for each delivered result. Custom-kind
|
|
427
|
+
* results (offset != 100) are not on this stream; they enter the final
|
|
428
|
+
* ranking via the post-EOSE enrichment pass.
|
|
429
|
+
*
|
|
430
|
+
* After capabilities EOSE, an enrichment pass runs in parallel to the live
|
|
431
|
+
* subscriptions and produces a ranked snapshot via `onComplete`. The snapshot
|
|
432
|
+
* is a clone, so further live updates do not mutate it.
|
|
433
|
+
*
|
|
434
|
+
* `closer.close()` tears down both subscriptions and aborts an in-flight
|
|
435
|
+
* enrichment. If `opts.signal` is provided, aborting it does the same.
|
|
436
|
+
*/
|
|
437
|
+
streamAgents(network: Network, opts: {
|
|
438
|
+
onAgent: (agent: Agent) => void;
|
|
439
|
+
onPaidJob?: (pubkey: string, ts: number) => void;
|
|
440
|
+
onEose?: () => void;
|
|
441
|
+
onComplete?: (agents: Agent[]) => void;
|
|
442
|
+
signal?: AbortSignal;
|
|
443
|
+
}): SubCloser;
|
|
401
444
|
/**
|
|
402
445
|
* Publish a capability card (kind:31990) as a provider.
|
|
403
446
|
* Solana address is validated for Base58 format only - full decode
|
|
@@ -591,12 +634,24 @@ declare class SolanaPaymentStrategy implements PaymentStrategy {
|
|
|
591
634
|
* extra read-only account (canonical Solana Pay pattern);
|
|
592
635
|
* 4. `TransferChecked` from payer ATA to treasury ATA if a fee applies.
|
|
593
636
|
*
|
|
637
|
+
* Every provider transfer instruction also carries `ELISYM_PROTOCOL_TAG` as a
|
|
638
|
+
* read-only marker account so off-chain indexers can enumerate every elisym
|
|
639
|
+
* transaction with a single `getSignaturesForAddress(ELISYM_PROTOCOL_TAG)`
|
|
640
|
+
* call, regardless of fee size.
|
|
641
|
+
*
|
|
642
|
+
* If `options.jobEventId` is provided, an SPL Memo instruction with payload
|
|
643
|
+
* `elisym:v1:<jobEventId>` is prepended so explorers display the originating
|
|
644
|
+
* Nostr job id and indexers can join on-chain payments back to off-chain
|
|
645
|
+
* job context.
|
|
646
|
+
*
|
|
594
647
|
* Async because SPL ATAs are PDAs and `findAssociatedTokenPda` is async.
|
|
595
648
|
*
|
|
596
649
|
* Caller is responsible for validating `paymentRequest` upstream;
|
|
597
650
|
* `buildTransaction` already does that before invoking this helper.
|
|
598
651
|
*/
|
|
599
|
-
declare function buildPaymentInstructions(paymentRequest: PaymentRequestData, payerSigner: Signer
|
|
652
|
+
declare function buildPaymentInstructions(paymentRequest: PaymentRequestData, payerSigner: Signer, options?: {
|
|
653
|
+
jobEventId?: string;
|
|
654
|
+
}): Promise<readonly unknown[]>;
|
|
600
655
|
/**
|
|
601
656
|
* Convenience wrapper: fetch the on-chain protocol config first, then build a
|
|
602
657
|
* payment request using its current fee/treasury values.
|
|
@@ -838,6 +893,40 @@ interface QuickVerifyResult {
|
|
|
838
893
|
declare function clearQuickVerifyCache(): void;
|
|
839
894
|
declare function verifyJobPaymentQuick(rpc: Rpc<SolanaRpcApi>, txSignature: string, expectedRecipient: Address): Promise<QuickVerifyResult>;
|
|
840
895
|
|
|
896
|
+
/**
|
|
897
|
+
* Aggregated on-chain stats across the entire elisym network. Volume is
|
|
898
|
+
* keyed by `'native'` for SOL or by SPL mint address; values are subunits
|
|
899
|
+
* (lamports for native, raw token units for SPL).
|
|
900
|
+
*/
|
|
901
|
+
interface NetworkStatsResult {
|
|
902
|
+
jobCount: number;
|
|
903
|
+
volumeByAsset: Record<string, bigint>;
|
|
904
|
+
/** Most-recent signature returned by the RPC (use as cursor for forward sync). */
|
|
905
|
+
latestSignature?: string;
|
|
906
|
+
/** Oldest signature scanned in this batch (use as `before` for next page). */
|
|
907
|
+
oldestSignature?: string;
|
|
908
|
+
}
|
|
909
|
+
interface AggregateNetworkStatsOptions {
|
|
910
|
+
/** Cap on signatures fetched in one call. Defaults to 1000 (RPC max). */
|
|
911
|
+
limit?: number;
|
|
912
|
+
/** Page backwards from this signature for historical scans. */
|
|
913
|
+
before?: Signature;
|
|
914
|
+
/** Parallel `getTransaction` calls. Defaults to `DEFAULTS.QUERY_MAX_CONCURRENCY`. */
|
|
915
|
+
concurrency?: number;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Enumerate every elisym payment transaction reachable from the protocol tag
|
|
919
|
+
* pubkey and aggregate gross volume + count.
|
|
920
|
+
*
|
|
921
|
+
* Implementation detail: for SPL txs we sum positive token-balance deltas per
|
|
922
|
+
* mint (ignores ATA rent that would inflate native lamport deltas in the same
|
|
923
|
+
* tx). For native SOL txs we sum positive lamport deltas across all non-payer
|
|
924
|
+
* accounts - elisym native txs only emit provider + optional fee transfers,
|
|
925
|
+
* so this equals gross volume. The `tx_fee` paid by the fee-payer never shows
|
|
926
|
+
* up as a positive delta, so it is naturally excluded.
|
|
927
|
+
*/
|
|
928
|
+
declare function aggregateNetworkStats(rpc: Rpc<SolanaRpcApi>, options?: AggregateNetworkStatsOptions): Promise<NetworkStatsResult>;
|
|
929
|
+
|
|
841
930
|
/**
|
|
842
931
|
* Snapshot of the on-chain elisym-config program state.
|
|
843
932
|
*
|
|
@@ -1015,6 +1104,18 @@ declare const PROTOCOL_TREASURY: Address;
|
|
|
1015
1104
|
* treasury address, and admin rotation state. Read via `getProtocolConfig`.
|
|
1016
1105
|
*/
|
|
1017
1106
|
declare const PROTOCOL_PROGRAM_ID_DEVNET: Address;
|
|
1107
|
+
/**
|
|
1108
|
+
* Read-only marker pubkey attached as a non-signer account to every elisym
|
|
1109
|
+
* payment transaction. Lets indexers enumerate every elisym tx network-wide
|
|
1110
|
+
* via a single `getSignaturesForAddress(ELISYM_PROTOCOL_TAG)` call,
|
|
1111
|
+
* independent of fee size or recipient.
|
|
1112
|
+
*
|
|
1113
|
+
* The account does not need to exist on-chain; including its pubkey as an
|
|
1114
|
+
* extra read-only account in the provider transfer instruction is enough for
|
|
1115
|
+
* Solana's tx-by-account index to pick it up. The corresponding secret key
|
|
1116
|
+
* was generated and discarded - the tag never signs and never holds funds.
|
|
1117
|
+
*/
|
|
1118
|
+
declare const ELISYM_PROTOCOL_TAG: Address;
|
|
1018
1119
|
type ProtocolCluster = 'devnet' | 'mainnet' | 'localnet';
|
|
1019
1120
|
/**
|
|
1020
1121
|
* Resolve the elisym-config program ID for a given Solana cluster.
|
|
@@ -1050,4 +1151,4 @@ declare const LIMITS: {
|
|
|
1050
1151
|
readonly MAX_CAPABILITY_LENGTH: 64;
|
|
1051
1152
|
};
|
|
1052
1153
|
|
|
1053
|
-
export { type Agent, Asset, BoundedSet, type BuildTransactionOptions, type CapabilityCard, DEFAULTS, DEFAULT_KIND_OFFSET, DEFAULT_REDACT_PATHS, DiscoveryService, ElisymClient, type ElisymClientConfig, type ElisymClientFullConfig, ElisymIdentity, type EstimatePriorityFeeOptions, type EstimateSolFeeOptions, type GetProtocolConfigOptions, INPUT_REDACT_PATHS, type Job, type JobStatus, type JobSubscriptionOptions, type JobUpdateCallbacks, KIND_APP_HANDLER, KIND_JOB_FEEDBACK, KIND_JOB_REQUEST, KIND_JOB_REQUEST_BASE, KIND_JOB_RESULT, KIND_JOB_RESULT_BASE, KIND_PING, KIND_PONG, LAMPORTS_PER_SOL, LIMITS, MarketplaceService, MediaService, type Network, type NetworkStats, NostrPool, PROTOCOL_FEE_BPS, PROTOCOL_PROGRAM_ID_DEVNET, PROTOCOL_TREASURY, type ParseOptions, type ParseResult, type ParsedPaymentRequest, type PaymentAssetRef, type PaymentInfo, type PaymentRequestData, PaymentRequestSchema, type PaymentStrategy, type PaymentValidationCode, type PaymentValidationError, type PingResult, PingService, type ProtocolCluster, type ProtocolConfig, type ProtocolConfigInput, type QuickVerifyReason, type QuickVerifyResult, RELAYS, type RankKey, type RateLimitDecision, SECRET_REDACT_PATHS, type Signer, type SlidingWindowLimiter, type SlidingWindowLimiterOptions, type SolFeeEstimate, SolanaPaymentStrategy, type SubCloser, type SubmitJobOptions, type VerifyOptions, type VerifyResult, assertExpiry, assertLamports, buildPaymentInstructions, calculateProtocolFee, clearPriorityFeeCache, clearProtocolConfigCache, clearQuickVerifyCache, compareAgentsByRank, computeRankKey, createPaymentRequestWithOnchainConfig, createSlidingWindowLimiter, estimatePriorityFeeMicroLamports, estimateSolFeeLamports, formatFeeBreakdown, formatSol, getProtocolConfig, getProtocolProgramId, jobRequestKind, jobResultKind, makeCensor, nip44Decrypt, nip44Encrypt, parsePaymentRequest, pickPercentileFee, timeAgo, toDTag, truncateKey, validateAgentName, validateExpiry, verifyJobPaymentQuick };
|
|
1154
|
+
export { type Agent, type AggregateNetworkStatsOptions, Asset, BoundedSet, type BuildTransactionOptions, type CapabilityCard, DEFAULTS, DEFAULT_KIND_OFFSET, DEFAULT_REDACT_PATHS, DiscoveryService, ELISYM_PROTOCOL_TAG, ElisymClient, type ElisymClientConfig, type ElisymClientFullConfig, ElisymIdentity, type EstimatePriorityFeeOptions, type EstimateSolFeeOptions, type GetProtocolConfigOptions, INPUT_REDACT_PATHS, type Job, type JobStatus, type JobSubscriptionOptions, type JobUpdateCallbacks, KIND_APP_HANDLER, KIND_JOB_FEEDBACK, KIND_JOB_REQUEST, KIND_JOB_REQUEST_BASE, KIND_JOB_RESULT, KIND_JOB_RESULT_BASE, KIND_PING, KIND_PONG, LAMPORTS_PER_SOL, LIMITS, MarketplaceService, MediaService, type Network, type NetworkStats, type NetworkStatsResult, NostrPool, PROTOCOL_FEE_BPS, PROTOCOL_PROGRAM_ID_DEVNET, PROTOCOL_TREASURY, type ParseOptions, type ParseResult, type ParsedPaymentRequest, type PaymentAssetRef, type PaymentInfo, type PaymentRequestData, PaymentRequestSchema, type PaymentStrategy, type PaymentValidationCode, type PaymentValidationError, type PingResult, PingService, type ProtocolCluster, type ProtocolConfig, type ProtocolConfigInput, type QuickVerifyReason, type QuickVerifyResult, RELAYS, type RankKey, type RateLimitDecision, SECRET_REDACT_PATHS, type Signer, type SlidingWindowLimiter, type SlidingWindowLimiterOptions, type SolFeeEstimate, SolanaPaymentStrategy, type SubCloser, type SubmitJobOptions, type VerifyOptions, type VerifyResult, aggregateNetworkStats, assertExpiry, assertLamports, buildPaymentInstructions, calculateProtocolFee, clearPriorityFeeCache, clearProtocolConfigCache, clearQuickVerifyCache, compareAgentsByRank, computeRankKey, createPaymentRequestWithOnchainConfig, createSlidingWindowLimiter, estimatePriorityFeeMicroLamports, estimateSolFeeLamports, formatFeeBreakdown, formatSol, getProtocolConfig, getProtocolProgramId, jobRequestKind, jobResultKind, makeCensor, nip44Decrypt, nip44Encrypt, parsePaymentRequest, pickPercentileFee, timeAgo, toDTag, truncateKey, validateAgentName, validateExpiry, verifyJobPaymentQuick };
|