@ghostspeak/sdk 2.0.7 → 2.0.10
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 +145 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/{GhostSpeakClient-CWmGaM9Q.d.ts → GhostSpeakClient-qdLGyuDp.d.ts} +11 -7
- package/dist/{StakingModule-C5rzuOWb.d.ts → StakingModule-CPhp_ZY0.d.ts} +263 -343
- package/dist/{agent-5YLZ7DAC.js → agent-S42FIMR7.js} +3 -3
- package/dist/{agent-5YLZ7DAC.js.map → agent-S42FIMR7.js.map} +1 -1
- package/dist/browser-D1TpjbjZ.d.ts +234 -0
- package/dist/browser.d.ts +4 -64
- package/dist/browser.js +9 -9
- package/dist/{chunk-SFTSZ3LC.js → chunk-46QWY3MG.js} +3 -3
- package/dist/{chunk-SFTSZ3LC.js.map → chunk-46QWY3MG.js.map} +1 -1
- package/dist/{chunk-IHVDQ4YI.js → chunk-5QZVFUXB.js} +201 -256
- package/dist/chunk-5QZVFUXB.js.map +1 -0
- package/dist/{chunk-E3FD2CNY.js → chunk-5SS3OL4B.js} +20 -24
- package/dist/chunk-5SS3OL4B.js.map +1 -0
- package/dist/{chunk-SZGFSCNU.js → chunk-63A7F2YP.js} +504 -326
- package/dist/chunk-63A7F2YP.js.map +1 -0
- package/dist/{chunk-JV2SWONF.js → chunk-A7ALCVUI.js} +3 -3
- package/dist/{chunk-JV2SWONF.js.map → chunk-A7ALCVUI.js.map} +1 -1
- package/dist/{chunk-AL3HQN73.js → chunk-AWMGX3OX.js} +172 -112
- package/dist/chunk-AWMGX3OX.js.map +1 -0
- package/dist/{chunk-G7S6B6WB.js → chunk-EU6PHSM5.js} +7 -7
- package/dist/{chunk-G7S6B6WB.js.map → chunk-EU6PHSM5.js.map} +1 -1
- package/dist/{chunk-C5CDA3WX.js → chunk-HIDBANFS.js} +529 -4
- package/dist/chunk-HIDBANFS.js.map +1 -0
- package/dist/{chunk-S74EH3KD.js → chunk-IQM5RASO.js} +637 -25
- package/dist/chunk-IQM5RASO.js.map +1 -0
- package/dist/{chunk-KB6CKIUK.js → chunk-QLRWUHN2.js} +3 -3
- package/dist/{chunk-KB6CKIUK.js.map → chunk-QLRWUHN2.js.map} +1 -1
- package/dist/{chunk-BQDGRTVP.js → chunk-QWQTPTZ4.js} +39 -51
- package/dist/chunk-QWQTPTZ4.js.map +1 -0
- package/dist/client.d.ts +3 -4
- package/dist/client.js +10 -10
- package/dist/{createAgentAuthorization-ULG47ZJI.js → createAgentAuthorization-KGZNXZBT.js} +4 -4
- package/dist/{createAgentAuthorization-ULG47ZJI.js.map → createAgentAuthorization-KGZNXZBT.js.map} +1 -1
- package/dist/generated-QJREJQ2C.js +9 -0
- package/dist/{generated-EG5USUFG.js.map → generated-QJREJQ2C.js.map} +1 -1
- package/dist/index.d.ts +345 -236
- package/dist/index.js +372 -537
- package/dist/index.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/minimal/core-minimal.d.ts +266 -189
- package/dist/minimal/core-minimal.js +6 -6
- package/dist/minimal/core-minimal.js.map +1 -1
- package/dist/{revokeAuthorization-OK7E7OK3.js → revokeAuthorization-2ZRO6GUZ.js} +4 -4
- package/dist/{revokeAuthorization-OK7E7OK3.js.map → revokeAuthorization-2ZRO6GUZ.js.map} +1 -1
- package/dist/{signature-verification-DGxR4aYQ.d.ts → signature-verification-BDzoR1MG.d.ts} +0 -5
- package/dist/{updateReputationWithAuth-Y4ONEVSP.js → updateReputationWithAuth-PCEUOCFV.js} +4 -4
- package/dist/{updateReputationWithAuth-Y4ONEVSP.js.map → updateReputationWithAuth-PCEUOCFV.js.map} +1 -1
- package/dist/utils.d.ts +143 -2
- package/dist/utils.js +10 -10
- package/dist/utils.js.map +1 -1
- package/package.json +5 -3
- package/dist/chunk-AL3HQN73.js.map +0 -1
- package/dist/chunk-BQDGRTVP.js.map +0 -1
- package/dist/chunk-C5CDA3WX.js.map +0 -1
- package/dist/chunk-E3FD2CNY.js.map +0 -1
- package/dist/chunk-IHVDQ4YI.js.map +0 -1
- package/dist/chunk-S74EH3KD.js.map +0 -1
- package/dist/chunk-SZGFSCNU.js.map +0 -1
- package/dist/generated-EG5USUFG.js +0 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { REVOKE_AUTHORIZATION_DISCRIMINATOR, getRevokeAuthorizationDiscriminatorBytes, getRevokeAuthorizationInstruction, getRevokeAuthorizationInstructionDataCodec, getRevokeAuthorizationInstructionDataDecoder, getRevokeAuthorizationInstructionDataEncoder, parseRevokeAuthorizationInstruction } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { REVOKE_AUTHORIZATION_DISCRIMINATOR, getRevokeAuthorizationDiscriminatorBytes, getRevokeAuthorizationInstruction, getRevokeAuthorizationInstructionDataCodec, getRevokeAuthorizationInstructionDataDecoder, getRevokeAuthorizationInstructionDataEncoder, parseRevokeAuthorizationInstruction } from './chunk-A7ALCVUI.js';
|
|
2
|
+
import './chunk-AWMGX3OX.js';
|
|
3
3
|
import './chunk-UP2VWCW5.js';
|
|
4
|
-
//# sourceMappingURL=revokeAuthorization-
|
|
5
|
-
//# sourceMappingURL=revokeAuthorization-
|
|
4
|
+
//# sourceMappingURL=revokeAuthorization-2ZRO6GUZ.js.map
|
|
5
|
+
//# sourceMappingURL=revokeAuthorization-2ZRO6GUZ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"revokeAuthorization-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"revokeAuthorization-2ZRO6GUZ.js"}
|
|
@@ -171,11 +171,6 @@ interface CreateAuthorizationParams {
|
|
|
171
171
|
nonce?: string;
|
|
172
172
|
/** Optional metadata */
|
|
173
173
|
metadata?: AuthorizationMetadata;
|
|
174
|
-
/**
|
|
175
|
-
* Whether to store authorization on-chain (default: false)
|
|
176
|
-
* @deprecated Use onChainStorage.enabled instead
|
|
177
|
-
*/
|
|
178
|
-
storeOnChain?: boolean;
|
|
179
174
|
/**
|
|
180
175
|
* On-chain storage configuration
|
|
181
176
|
* If not provided, defaults to off-chain (free) storage
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { UPDATE_REPUTATION_WITH_AUTH_DISCRIMINATOR, getUpdateReputationWithAuthDiscriminatorBytes, getUpdateReputationWithAuthInstruction, getUpdateReputationWithAuthInstructionAsync, getUpdateReputationWithAuthInstructionDataCodec, getUpdateReputationWithAuthInstructionDataDecoder, getUpdateReputationWithAuthInstructionDataEncoder, parseUpdateReputationWithAuthInstruction } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { UPDATE_REPUTATION_WITH_AUTH_DISCRIMINATOR, getUpdateReputationWithAuthDiscriminatorBytes, getUpdateReputationWithAuthInstruction, getUpdateReputationWithAuthInstructionAsync, getUpdateReputationWithAuthInstructionDataCodec, getUpdateReputationWithAuthInstructionDataDecoder, getUpdateReputationWithAuthInstructionDataEncoder, parseUpdateReputationWithAuthInstruction } from './chunk-QLRWUHN2.js';
|
|
2
|
+
import './chunk-AWMGX3OX.js';
|
|
3
3
|
import './chunk-UP2VWCW5.js';
|
|
4
|
-
//# sourceMappingURL=updateReputationWithAuth-
|
|
5
|
-
//# sourceMappingURL=updateReputationWithAuth-
|
|
4
|
+
//# sourceMappingURL=updateReputationWithAuth-PCEUOCFV.js.map
|
|
5
|
+
//# sourceMappingURL=updateReputationWithAuth-PCEUOCFV.js.map
|
package/dist/{updateReputationWithAuth-Y4ONEVSP.js.map → updateReputationWithAuth-PCEUOCFV.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"updateReputationWithAuth-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"updateReputationWithAuth-PCEUOCFV.js"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,10 +1,151 @@
|
|
|
1
|
+
import { SolanaClient } from 'gill';
|
|
2
|
+
export { SolanaClient } from 'gill';
|
|
1
3
|
export { d as deriveAgentPda, f as findProgramDerivedAddress } from './pda-Ce7VYg4T.js';
|
|
2
4
|
export { E as ErrorContext, G as GhostSpeakSDKError, R as ReputationTagEngine, T as TokenProgram, j as accounts, c as createErrorContext, d as deriveAssociatedTokenAddress, a as detectTokenProgram, e as enhanceTransactionError, l as features, f as formatTokenAmount, g as getTokenProgramType, k as governance, b as ipfs, i as isToken2022Mint, p as parseTokenAmount, h as privacy, w as withEnhancedErrors } from './feature-flags-B1g0DCPe.js';
|
|
3
|
-
export { s as authSignatures, c as createAuthorizationMessage, b as createSignedAuthorization, e as deserializeAuthorization, g as generateNonce, f as getAuthorizationId, h as isAuthorizationExhausted, i as isAuthorizationExpired, d as serializeAuthorization, a as signAuthorizationMessage, j as validateAuthorizationNetwork, v as verifyAuthorizationSignature } from './signature-verification-
|
|
5
|
+
export { s as authSignatures, c as createAuthorizationMessage, b as createSignedAuthorization, e as deserializeAuthorization, g as generateNonce, f as getAuthorizationId, h as isAuthorizationExhausted, i as isAuthorizationExpired, d as serializeAuthorization, a as signAuthorizationMessage, j as validateAuthorizationNetwork, v as verifyAuthorizationSignature } from './signature-verification-BDzoR1MG.js';
|
|
4
6
|
import { R as ReputationData, J as JobPerformance, a as ReputationCalculationResult, P as PerformanceSnapshot } from './reputation-types-Yebf0Rm_.js';
|
|
5
7
|
import '@solana/addresses';
|
|
6
8
|
import '@solana/kit';
|
|
7
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Centralized Solana Client Utilities using Gill
|
|
12
|
+
*
|
|
13
|
+
* This module provides a unified interface for creating and managing
|
|
14
|
+
* Solana RPC clients using the Gill library. It serves as the single
|
|
15
|
+
* source of truth for all RPC client operations in the SDK.
|
|
16
|
+
*
|
|
17
|
+
* Gill is a modern Solana JavaScript/TypeScript SDK built on top of
|
|
18
|
+
* @solana/kit (formerly web3.js v2) that provides:
|
|
19
|
+
* - Simplified client creation
|
|
20
|
+
* - Built-in transaction confirmation
|
|
21
|
+
* - Network moniker support (devnet, mainnet, localnet)
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { createSolanaClient, getDefaultSolanaClient } from './solana-client.js'
|
|
26
|
+
*
|
|
27
|
+
* // Create a client with custom endpoint
|
|
28
|
+
* const client = createSolanaClient({ urlOrMoniker: 'https://my-rpc.com' })
|
|
29
|
+
*
|
|
30
|
+
* // Get the default singleton client
|
|
31
|
+
* const defaultClient = getDefaultSolanaClient()
|
|
32
|
+
*
|
|
33
|
+
* // Use the RPC
|
|
34
|
+
* const balance = await client.rpc.getBalance(address).send()
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Configuration options for creating a Solana client
|
|
40
|
+
*/
|
|
41
|
+
interface SolanaClientConfig {
|
|
42
|
+
/** RPC URL or network moniker (devnet, mainnet, localnet, testnet) */
|
|
43
|
+
urlOrMoniker: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Network monikers supported by Gill
|
|
47
|
+
*/
|
|
48
|
+
type NetworkMoniker = 'devnet' | 'mainnet' | 'localnet' | 'testnet';
|
|
49
|
+
/**
|
|
50
|
+
* Create a new Solana client using Gill
|
|
51
|
+
*
|
|
52
|
+
* This is a wrapper around Gill's createSolanaClient that provides
|
|
53
|
+
* additional configuration options and a consistent interface.
|
|
54
|
+
*
|
|
55
|
+
* @param config - Configuration options for the client
|
|
56
|
+
* @returns A new SolanaClient instance
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* // Using a network moniker
|
|
61
|
+
* const devnetClient = createSolanaClient({ urlOrMoniker: 'devnet' })
|
|
62
|
+
*
|
|
63
|
+
* // Using a custom RPC URL
|
|
64
|
+
* const customClient = createSolanaClient({
|
|
65
|
+
* urlOrMoniker: 'https://my-rpc-provider.com'
|
|
66
|
+
* })
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare function createSolanaClient(config: SolanaClientConfig): SolanaClient<any>;
|
|
70
|
+
/**
|
|
71
|
+
* Get or create the default singleton Solana client
|
|
72
|
+
*
|
|
73
|
+
* This function provides a singleton pattern for SDK-wide RPC operations.
|
|
74
|
+
* The client is lazily initialized and reused across all calls.
|
|
75
|
+
*
|
|
76
|
+
* If an endpoint is provided and differs from the cached endpoint,
|
|
77
|
+
* a new client will be created.
|
|
78
|
+
*
|
|
79
|
+
* @param endpoint - Optional RPC endpoint or network moniker
|
|
80
|
+
* @returns The singleton SolanaClient instance
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* // Get default client (devnet)
|
|
85
|
+
* const client = getDefaultSolanaClient()
|
|
86
|
+
*
|
|
87
|
+
* // Get client for specific endpoint
|
|
88
|
+
* const mainnetClient = getDefaultSolanaClient('mainnet')
|
|
89
|
+
*
|
|
90
|
+
* // Use custom RPC
|
|
91
|
+
* const customClient = getDefaultSolanaClient('https://my-rpc.com')
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
declare function getDefaultSolanaClient(endpoint?: string): SolanaClient<any>;
|
|
95
|
+
/**
|
|
96
|
+
* Reset the default singleton client
|
|
97
|
+
*
|
|
98
|
+
* This is useful for testing or when you need to force a client refresh.
|
|
99
|
+
* After calling this function, the next call to getDefaultSolanaClient
|
|
100
|
+
* will create a new client instance.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* // In tests
|
|
105
|
+
* beforeEach(() => {
|
|
106
|
+
* resetDefaultClient()
|
|
107
|
+
* })
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
declare function resetDefaultClient(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Create a network-specific Solana client
|
|
113
|
+
*
|
|
114
|
+
* This is a convenience function for creating clients connected
|
|
115
|
+
* to standard Solana networks using Gill's network moniker support.
|
|
116
|
+
*
|
|
117
|
+
* @param network - The network to connect to
|
|
118
|
+
* @returns A new SolanaClient instance connected to the specified network
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const devnetClient = createNetworkClient('devnet')
|
|
123
|
+
* const mainnetClient = createNetworkClient('mainnet')
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
declare function createNetworkClient(network: NetworkMoniker): SolanaClient<any>;
|
|
127
|
+
/**
|
|
128
|
+
* Check if an endpoint is a network moniker
|
|
129
|
+
*
|
|
130
|
+
* @param endpoint - The endpoint string to check
|
|
131
|
+
* @returns True if the endpoint is a recognized network moniker
|
|
132
|
+
*/
|
|
133
|
+
declare function isNetworkMoniker(endpoint: string): endpoint is NetworkMoniker;
|
|
134
|
+
/**
|
|
135
|
+
* Get the default RPC URL for a network
|
|
136
|
+
*
|
|
137
|
+
* @param network - The network moniker
|
|
138
|
+
* @returns The default RPC URL for the network
|
|
139
|
+
*/
|
|
140
|
+
declare function getDefaultEndpoint(network: NetworkMoniker): string;
|
|
141
|
+
/**
|
|
142
|
+
* Detect the network from an RPC endpoint URL
|
|
143
|
+
*
|
|
144
|
+
* @param endpoint - The RPC endpoint URL
|
|
145
|
+
* @returns The detected network or 'unknown'
|
|
146
|
+
*/
|
|
147
|
+
declare function detectNetworkFromEndpoint(endpoint: string): NetworkMoniker | 'unknown';
|
|
148
|
+
|
|
8
149
|
/**
|
|
9
150
|
* Common utility functions for GhostSpeak SDK
|
|
10
151
|
*/
|
|
@@ -84,4 +225,4 @@ declare class ReputationCalculator {
|
|
|
84
225
|
calculateStakingBonus(stakeAmount: number): number;
|
|
85
226
|
}
|
|
86
227
|
|
|
87
|
-
export { ReputationCalculator, lamportsToSol, sol };
|
|
228
|
+
export { type NetworkMoniker, ReputationCalculator, type SolanaClientConfig, createNetworkClient, createSolanaClient, detectNetworkFromEndpoint, getDefaultEndpoint, getDefaultSolanaClient, isNetworkMoniker, lamportsToSol, resetDefaultClient, sol };
|
package/dist/utils.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { account_diagnostics_exports as accounts, deriveAssociatedTokenAddress, detectTokenProgram, feature_flags_exports as features, formatTokenAmount, getTokenProgramType, governance_helpers_exports as governance, isToken2022Mint, parseTokenAmount, client_encryption_exports as privacy } from './chunk-
|
|
1
|
+
export { account_diagnostics_exports as accounts, deriveAssociatedTokenAddress, detectTokenProgram, feature_flags_exports as features, formatTokenAmount, getTokenProgramType, governance_helpers_exports as governance, isToken2022Mint, parseTokenAmount, client_encryption_exports as privacy } from './chunk-EU6PHSM5.js';
|
|
2
2
|
export { deriveAgentPda, findProgramDerivedAddress } from './chunk-BF3IQ35I.js';
|
|
3
|
-
export { signature_verification_exports as authSignatures, createAuthorizationMessage, createSignedAuthorization, deserializeAuthorization, generateNonce, getAuthorizationId, isAuthorizationExhausted, isAuthorizationExpired, serializeAuthorization, signAuthorizationMessage, validateAuthorizationNetwork, verifyAuthorizationSignature } from './chunk-
|
|
4
|
-
import { init_reputation_tag_engine } from './chunk-
|
|
5
|
-
export { GhostSpeakSDKError, ReputationCalculator, ReputationTagEngine, createErrorContext, enhanceTransactionError, ipfs_client_exports as ipfs, withEnhancedErrors } from './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
3
|
+
export { signature_verification_exports as authSignatures, createAuthorizationMessage, createSignedAuthorization, deserializeAuthorization, generateNonce, getAuthorizationId, isAuthorizationExhausted, isAuthorizationExpired, serializeAuthorization, signAuthorizationMessage, validateAuthorizationNetwork, verifyAuthorizationSignature } from './chunk-QWQTPTZ4.js';
|
|
4
|
+
import { init_reputation_tag_engine } from './chunk-HIDBANFS.js';
|
|
5
|
+
export { GhostSpeakSDKError, ReputationCalculator, ReputationTagEngine, createErrorContext, createNetworkClient, createSolanaClient, detectNetworkFromEndpoint, enhanceTransactionError, getDefaultEndpoint, getDefaultSolanaClient, ipfs_client_exports as ipfs, isNetworkMoniker, resetDefaultClient, withEnhancedErrors } from './chunk-HIDBANFS.js';
|
|
6
|
+
import './chunk-IQM5RASO.js';
|
|
7
|
+
import './chunk-5QZVFUXB.js';
|
|
8
|
+
import './chunk-46QWY3MG.js';
|
|
9
|
+
import './chunk-A7ALCVUI.js';
|
|
10
|
+
import './chunk-QLRWUHN2.js';
|
|
11
|
+
import './chunk-AWMGX3OX.js';
|
|
12
12
|
import './chunk-SRS2SKFS.js';
|
|
13
13
|
import './chunk-UP2VWCW5.js';
|
|
14
14
|
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/common.ts","../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAOO,SAAS,IAAI,MAAA,EAAwB;AAC1C,EAAA,OAAO,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,MAAA,GAAS,GAAa,CAAC,CAAA;AAClD;AAKO,SAAS,cAAc,QAAA,EAA0B;AACtD,EAAA,OAAO,MAAA,CAAO,QAAQ,CAAA,GAAI,GAAA;AAC5B;;;
|
|
1
|
+
{"version":3,"sources":["../src/utils/common.ts","../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAOO,SAAS,IAAI,MAAA,EAAwB;AAC1C,EAAA,OAAO,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,MAAA,GAAS,GAAa,CAAC,CAAA;AAClD;AAKO,SAAS,cAAc,QAAA,EAA0B;AACtD,EAAA,OAAO,MAAA,CAAO,QAAQ,CAAA,GAAI,GAAA;AAC5B;;;AC0EA,0BAAA,EAAA","file":"utils.js","sourcesContent":["/**\n * Common utility functions for GhostSpeak SDK\n */\n\n/**\n * Convert SOL to lamports\n */\nexport function sol(amount: number): bigint {\n return BigInt(Math.round(amount * 1_000_000_000))\n}\n\n/**\n * Convert lamports to SOL\n */\nexport function lamportsToSol(lamports: bigint): number {\n return Number(lamports) / 1_000_000_000\n}","/**\n * Utilities Index - Tree-shakeable Exports\n *\n * Import only the utilities you need for optimal bundle size.\n */\n\n// Solana Client utilities (Gill-powered)\nexport {\n createSolanaClient,\n getDefaultSolanaClient,\n resetDefaultClient,\n createNetworkClient,\n isNetworkMoniker,\n getDefaultEndpoint,\n detectNetworkFromEndpoint,\n type SolanaClientConfig,\n type NetworkMoniker,\n type SolanaClient\n} from './solana-client.js'\n\n// Most commonly used utilities\nexport { sol, lamportsToSol } from './common.js'\n\n// PDA derivation (frequently used)\nexport {\n deriveAgentPda,\n findProgramDerivedAddress\n} from './pda.js'\n\n// Token operations (moderate usage)\nexport {\n deriveAssociatedTokenAddress,\n detectTokenProgram,\n isToken2022Mint,\n getTokenProgramType,\n formatTokenAmount,\n parseTokenAmount,\n type TokenProgram\n} from './token-utils.js'\n\n// Error handling (essential for good UX)\nexport {\n GhostSpeakSDKError,\n withEnhancedErrors,\n enhanceTransactionError,\n createErrorContext,\n type ErrorContext\n} from './enhanced-client-errors.js'\n\n// Advanced utilities (tree-shakeable bulk exports)\n// Only import specific modules if needed to avoid bundle bloat\n\n// Token-2022 extensions removed - not aligned with pivot\n\n// IPFS operations (for large content)\nexport * as ipfs from './ipfs-client.js'\n\n// Privacy and encryption (specialized usage)\nexport * as privacy from './client-encryption.js'\n\n// Agent authorization signatures - GhostSpeak trustless delegation\nexport * as authSignatures from './signature-verification.js'\nexport {\n createAuthorizationMessage,\n signAuthorizationMessage,\n verifyAuthorizationSignature,\n createSignedAuthorization,\n generateNonce,\n serializeAuthorization,\n deserializeAuthorization,\n getAuthorizationId,\n isAuthorizationExpired,\n isAuthorizationExhausted,\n validateAuthorizationNetwork,\n} from './signature-verification.js'\n\n// Confidential transfers removed - x402 payment protocol focus\n// export * as confidential from './confidential-transfer-manager.js'\n\n// Account management (diagnostic and migration)\nexport * as accounts from './account-diagnostics.js'\n\n// Governance helpers (DAO functionality)\nexport * as governance from './governance-helpers.js'\n\n// Feature flags and gates (configuration)\nexport * as features from './feature-flags.js'\n\n// Reputation calculation and tagging (reputation layer)\nexport { ReputationCalculator } from './reputation-calculator.js'\nexport { ReputationTagEngine } from './reputation-tag-engine.js'\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ghostspeak/sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "TypeScript SDK for GhostSpeak AI Agent Commerce Protocol - Production Ready Beta",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"build:wasm": "bun run wasm:build",
|
|
63
63
|
"build:dev": "tsup --watch",
|
|
64
64
|
"dev": "tsup --watch",
|
|
65
|
+
"prepare": "tsup",
|
|
65
66
|
"type-check": "tsc --noEmit",
|
|
66
67
|
"test": "vitest run --reporter=verbose",
|
|
67
68
|
"test:ci": "vitest run --reporter=default",
|
|
@@ -99,11 +100,11 @@
|
|
|
99
100
|
"homepage": "https://www.ghostspeak.io/",
|
|
100
101
|
"repository": {
|
|
101
102
|
"type": "git",
|
|
102
|
-
"url": "https://github.com/
|
|
103
|
+
"url": "https://github.com/ghostspeak/ghostspeak.git",
|
|
103
104
|
"directory": "packages/sdk-typescript"
|
|
104
105
|
},
|
|
105
106
|
"bugs": {
|
|
106
|
-
"url": "https://github.com/
|
|
107
|
+
"url": "https://github.com/ghostspeak/ghostspeak/issues"
|
|
107
108
|
},
|
|
108
109
|
"publishConfig": {
|
|
109
110
|
"access": "public"
|
|
@@ -133,6 +134,7 @@
|
|
|
133
134
|
"@solana/spl-account-compression": "^0.4.1",
|
|
134
135
|
"@solana/sysvars": "^5.1.0",
|
|
135
136
|
"bs58": "^6.0.0",
|
|
137
|
+
"gill": "^0.14.0",
|
|
136
138
|
"kubo-rpc-client": "^5.2.0",
|
|
137
139
|
"lru-cache": "^11.2.4"
|
|
138
140
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generated/programs/ghostspeakMarketplace.ts","../src/generated/shared/index.ts"],"names":["GhostspeakMarketplaceAccount","GhostspeakMarketplaceInstruction","kitIsTransactionSigner"],"mappings":";;;AAkEO,IAAM,sCAAA,GACX;AAEK,IAAK,4BAAA,qBAAAA,6BAAAA,KAAL;AACL,EAAAA,6BAAAA,CAAAA,6BAAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAA;AACA,EAAAA,6BAAAA,CAAAA,6BAAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,qBAAA;AACA,EAAAA,6BAAAA,CAAAA,6BAAAA,CAAA,iBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,iBAAA;AACA,EAAAA,6BAAAA,CAAAA,6BAAAA,CAAA,mBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,mBAAA;AACA,EAAAA,6BAAAA,CAAAA,6BAAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAA;AACA,EAAAA,6BAAAA,CAAAA,6BAAAA,CAAA,0BAAA,CAAA,GAAA,CAAA,CAAA,GAAA,0BAAA;AACA,EAAAA,6BAAAA,CAAAA,6BAAAA,CAAA,kBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,kBAAA;AACA,EAAAA,6BAAAA,CAAAA,6BAAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAA;AACA,EAAAA,6BAAAA,CAAAA,6BAAAA,CAAA,oBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,oBAAA;AACA,EAAAA,6BAAAA,CAAAA,6BAAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gBAAA;AACA,EAAAA,6BAAAA,CAAAA,6BAAAA,CAAA,aAAA,CAAA,GAAA,EAAA,CAAA,GAAA,aAAA;AACA,EAAAA,6BAAAA,CAAAA,6BAAAA,CAAA,oBAA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ACvC;AACA,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,SAAA,IAAa,KAAA,EAAO;AACnD,IAAA,OAAO,KAAA,CAAM,OAAA;AAAA,EACf;AACA,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,IAAA,OAAO,MAAM,CAAC,CAAA;AAAA,EAChB;AACA,EAAA,OAAO,KAAA;AACT;AAsEO,SAAS,qBAAA,CACd,gBACA,uBAAA,EACA;AACA,EAAA,OAAO,CACL,OAAA,KACgD;AAChD,IAAA,IAAI,CAAC,QAAQ,KAAA,EAAO;AAClB,MAAA,IAAI,4BAA4B,SAAA,EAAW;AAC3C,MAAA,OAAO,OAAO,MAAA,CAAO;AAAA,QACnB,OAAA,EAAS,cAAA;AAAA,QACT,MAAM,WAAA,CAAY;AAAA,OACnB,CAAA;AAAA,IACH;AAEA,IAAA,MAAM,YAAA,GAAe,OAAA,CAAQ,UAAA,GACzB,WAAA,CAAY,WACZ,WAAA,CAAY,QAAA;AAChB,IAAA,OAAO,OAAO,MAAA,CAAO;AAAA,MACnB,OAAA,EAAS,aAAA,CAAc,OAAA,CAAQ,KAAK,CAAA;AAAA,MACpC,MAAM,mBAAA,CAAoB,OAAA,CAAQ,KAAK,CAAA,GACnC,mBAAA,CAAoB,YAAY,CAAA,GAChC,YAAA;AAAA,MACJ,GAAI,mBAAA,CAAoB,OAAA,CAAQ,KAAK,CAAA,GAAI,EAAE,MAAA,EAAQ,OAAA,CAAQ,KAAA,EAAM,GAAI;AAAC,KACvE,CAAA;AAAA,EACH,CAAA;AACF;AAEO,SAAS,oBACd,KAAA,EAIsC;AACtC,EAAA,OACE,CAAC,CAAC,KAAA,IACF,OAAO,UAAU,QAAA,IACjB,SAAA,IAAa,KAAA,IACbC,qBAAA,CAAuB,KAAK,CAAA;AAEhC","file":"chunk-AL3HQN73.js","sourcesContent":["/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n containsBytes,\n fixEncoderSize,\n getBytesEncoder,\n type Address,\n type ReadonlyUint8Array,\n} from \"@solana/kit\";\nimport {\n type ParsedActivateAgentInstruction,\n type ParsedApproveDeliveryInstruction,\n type ParsedArbitrateDisputeInstruction,\n type ParsedCreateAgentAuthorizationInstruction,\n type ParsedCreateCredentialTemplateInstruction,\n type ParsedCreateCredentialTypeInstruction,\n type ParsedCreateDidDocumentInstruction,\n type ParsedCreateEscrowInstruction,\n type ParsedCreateMultisigInstruction,\n type ParsedDeactivateAgentInstruction,\n type ParsedDeactivateCredentialTemplateInstruction,\n type ParsedDeactivateCredentialTypeInstruction,\n type ParsedDeactivateDidDocumentInstruction,\n type ParsedEnableProtocolFeesInstruction,\n type ParsedFileDisputeInstruction,\n type ParsedGenerateComplianceReportInstruction,\n type ParsedInitializeAuditTrailInstruction,\n type ParsedInitializeGovernanceProposalInstruction,\n type ParsedInitializeProtocolConfigInstruction,\n type ParsedInitializeRbacConfigInstruction,\n type ParsedInitializeReputationMetricsInstruction,\n type ParsedInitializeStakingConfigInstruction,\n type ParsedInitReentrancyGuardInstruction,\n type ParsedIssueCredentialInstruction,\n type ParsedManageAgentStatusInstruction,\n type ParsedRecordPayaiPaymentInstruction,\n type ParsedRegisterAgentCompressedInstruction,\n type ParsedRegisterAgentInstruction,\n type ParsedResetReentrancyGuardInstruction,\n type ParsedResolveDidDocumentInstruction,\n type ParsedRevokeAuthorizationInstruction,\n type ParsedRevokeCredentialInstruction,\n type ParsedSlashStakeInstruction,\n type ParsedStakeGhostInstruction,\n type ParsedSubmitDeliveryInstruction,\n type ParsedSubmitServiceRatingInstruction,\n type ParsedUnstakeGhostInstruction,\n type ParsedUpdateAgentInstruction,\n type ParsedUpdateAgentReputationInstruction,\n type ParsedUpdateAgentServiceInstruction,\n type ParsedUpdateCrosschainStatusInstruction,\n type ParsedUpdateDidDocumentInstruction,\n type ParsedUpdateProtocolConfigInstruction,\n type ParsedUpdateReputationTagsInstruction,\n type ParsedUpdateReputationWithAuthInstruction,\n type ParsedUpdateSourceReputationInstruction,\n type ParsedVerifyAgentInstruction,\n type ParsedVerifyAuthorizationInstruction,\n} from \"../instructions\";\n\nexport const GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS =\n \"4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB\" as Address<\"4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB\">;\n\nexport enum GhostspeakMarketplaceAccount {\n Agent,\n AgentReputationAuth,\n AgentTreeConfig,\n AgentVerification,\n AuditTrail,\n AuthorizationUsageRecord,\n ComplianceReport,\n Credential,\n CredentialTemplate,\n CredentialType,\n DidDocument,\n GhostProtectEscrow,\n GovernanceProposal,\n Multisig,\n ProtocolConfig,\n RbacConfig,\n ReentrancyGuard,\n ReputationMetrics,\n StakingAccount,\n StakingConfig,\n UserRegistry,\n}\n\nexport function identifyGhostspeakMarketplaceAccount(\n account: { data: ReadonlyUint8Array } | ReadonlyUint8Array,\n): GhostspeakMarketplaceAccount {\n const data = \"data\" in account ? account.data : account;\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([47, 166, 112, 147, 155, 197, 86, 7]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.Agent;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([30, 249, 165, 44, 155, 194, 188, 175]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.AgentReputationAuth;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([145, 145, 156, 0, 197, 232, 130, 245]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.AgentTreeConfig;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([128, 155, 95, 241, 66, 207, 166, 59]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.AgentVerification;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([171, 223, 253, 181, 134, 88, 66, 26]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.AuditTrail;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([109, 102, 102, 17, 210, 84, 85, 210]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.AuthorizationUsageRecord;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([75, 146, 78, 26, 130, 240, 228, 35]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.ComplianceReport;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([145, 44, 68, 220, 67, 46, 100, 135]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.Credential;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([229, 129, 99, 91, 179, 207, 66, 75]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.CredentialTemplate;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([132, 171, 20, 181, 39, 219, 217, 112]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.CredentialType;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([109, 220, 168, 224, 33, 173, 192, 166]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.DidDocument;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([38, 0, 98, 160, 102, 4, 51, 160]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.GhostProtectEscrow;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([53, 107, 240, 190, 43, 73, 65, 143]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.GovernanceProposal;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([224, 116, 121, 186, 68, 161, 79, 236]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.Multisig;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([207, 91, 250, 28, 152, 179, 215, 209]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.ProtocolConfig;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([177, 94, 184, 202, 221, 112, 110, 38]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.RbacConfig;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([207, 227, 141, 11, 194, 21, 193, 32]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.ReentrancyGuard;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([8, 160, 71, 30, 66, 150, 108, 33]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.ReputationMetrics;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([52, 178, 251, 157, 180, 186, 98, 234]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.StakingAccount;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([45, 134, 252, 82, 37, 57, 84, 25]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.StakingConfig;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([37, 84, 98, 14, 130, 63, 210, 138]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceAccount.UserRegistry;\n }\n throw new Error(\n \"The provided account could not be identified as a ghostspeakMarketplace account.\",\n );\n}\n\nexport enum GhostspeakMarketplaceInstruction {\n ActivateAgent,\n ApproveDelivery,\n ArbitrateDispute,\n CreateAgentAuthorization,\n CreateCredentialTemplate,\n CreateCredentialType,\n CreateDidDocument,\n CreateEscrow,\n CreateMultisig,\n DeactivateAgent,\n DeactivateCredentialTemplate,\n DeactivateCredentialType,\n DeactivateDidDocument,\n EnableProtocolFees,\n FileDispute,\n GenerateComplianceReport,\n InitReentrancyGuard,\n InitializeAuditTrail,\n InitializeGovernanceProposal,\n InitializeProtocolConfig,\n InitializeRbacConfig,\n InitializeReputationMetrics,\n InitializeStakingConfig,\n IssueCredential,\n ManageAgentStatus,\n RecordPayaiPayment,\n RegisterAgent,\n RegisterAgentCompressed,\n ResetReentrancyGuard,\n ResolveDidDocument,\n RevokeAuthorization,\n RevokeCredential,\n SlashStake,\n StakeGhost,\n SubmitDelivery,\n SubmitServiceRating,\n UnstakeGhost,\n UpdateAgent,\n UpdateAgentReputation,\n UpdateAgentService,\n UpdateCrosschainStatus,\n UpdateDidDocument,\n UpdateProtocolConfig,\n UpdateReputationTags,\n UpdateReputationWithAuth,\n UpdateSourceReputation,\n VerifyAgent,\n VerifyAuthorization,\n}\n\nexport function identifyGhostspeakMarketplaceInstruction(\n instruction: { data: ReadonlyUint8Array } | ReadonlyUint8Array,\n): GhostspeakMarketplaceInstruction {\n const data = \"data\" in instruction ? instruction.data : instruction;\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([252, 139, 87, 21, 195, 152, 29, 217]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.ActivateAgent;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([28, 233, 51, 115, 33, 220, 41, 28]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.ApproveDelivery;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([225, 89, 166, 101, 215, 40, 191, 4]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.ArbitrateDispute;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([48, 219, 232, 202, 151, 97, 230, 20]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.CreateAgentAuthorization;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([183, 109, 12, 128, 134, 8, 139, 144]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.CreateCredentialTemplate;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([211, 208, 67, 175, 20, 248, 8, 227]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.CreateCredentialType;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([253, 40, 200, 239, 69, 147, 82, 182]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.CreateDidDocument;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([253, 215, 165, 116, 36, 108, 68, 80]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.CreateEscrow;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([148, 146, 240, 10, 226, 215, 167, 174]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.CreateMultisig;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([205, 171, 239, 225, 82, 126, 96, 166]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.DeactivateAgent;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([177, 8, 195, 104, 56, 34, 84, 162]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.DeactivateCredentialTemplate;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([110, 174, 221, 244, 36, 206, 60, 237]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.DeactivateCredentialType;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([77, 13, 56, 161, 67, 155, 206, 119]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.DeactivateDidDocument;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([9, 115, 79, 19, 158, 209, 221, 38]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.EnableProtocolFees;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([210, 63, 221, 114, 212, 97, 195, 156]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.FileDispute;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([213, 97, 79, 234, 22, 228, 14, 32]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.GenerateComplianceReport;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([156, 109, 115, 85, 12, 60, 245, 99]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.InitReentrancyGuard;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([145, 182, 236, 249, 212, 17, 175, 161]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.InitializeAuditTrail;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([137, 84, 234, 206, 17, 58, 54, 215]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.InitializeGovernanceProposal;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([28, 50, 43, 233, 244, 98, 123, 118]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.InitializeProtocolConfig;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([215, 68, 129, 228, 237, 165, 0, 240]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.InitializeRbacConfig;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([228, 11, 207, 44, 52, 188, 169, 237]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.InitializeReputationMetrics;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([78, 164, 6, 115, 206, 48, 168, 105]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.InitializeStakingConfig;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([255, 193, 171, 224, 68, 171, 194, 87]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.IssueCredential;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([164, 219, 91, 38, 45, 31, 33, 47]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.ManageAgentStatus;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([165, 202, 159, 139, 65, 65, 36, 163]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.RecordPayaiPayment;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([135, 157, 66, 195, 2, 113, 175, 30]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.RegisterAgent;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([15, 6, 94, 55, 65, 80, 123, 248]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.RegisterAgentCompressed;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([93, 74, 168, 125, 46, 153, 9, 255]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.ResetReentrancyGuard;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([168, 180, 218, 211, 184, 19, 102, 12]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.ResolveDidDocument;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([222, 179, 207, 59, 191, 78, 24, 248]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.RevokeAuthorization;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([38, 123, 95, 95, 223, 158, 169, 87]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.RevokeCredential;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([190, 242, 137, 27, 41, 18, 233, 37]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.SlashStake;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([5, 196, 24, 54, 196, 56, 173, 191]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.StakeGhost;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([217, 177, 33, 54, 136, 185, 123, 96]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.SubmitDelivery;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([23, 160, 228, 88, 168, 145, 129, 19]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.SubmitServiceRating;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([252, 101, 172, 252, 1, 4, 12, 116]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.UnstakeGhost;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([85, 2, 178, 9, 119, 139, 102, 164]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.UpdateAgent;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([80, 227, 92, 245, 231, 37, 99, 180]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.UpdateAgentReputation;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([87, 146, 181, 198, 252, 68, 243, 102]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.UpdateAgentService;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([22, 167, 59, 238, 22, 231, 239, 146]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.UpdateCrosschainStatus;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([64, 216, 17, 91, 205, 94, 45, 57]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.UpdateDidDocument;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([197, 97, 123, 54, 221, 168, 11, 135]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.UpdateProtocolConfig;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([206, 96, 254, 186, 129, 180, 103, 198]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.UpdateReputationTags;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([61, 236, 225, 167, 134, 43, 53, 93]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.UpdateReputationWithAuth;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([161, 240, 255, 69, 130, 227, 71, 123]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.UpdateSourceReputation;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([206, 212, 108, 12, 105, 61, 100, 66]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.VerifyAgent;\n }\n if (\n containsBytes(\n data,\n fixEncoderSize(getBytesEncoder(), 8).encode(\n new Uint8Array([43, 9, 131, 59, 74, 118, 113, 170]),\n ),\n 0,\n )\n ) {\n return GhostspeakMarketplaceInstruction.VerifyAuthorization;\n }\n throw new Error(\n \"The provided instruction could not be identified as a ghostspeakMarketplace instruction.\",\n );\n}\n\nexport type ParsedGhostspeakMarketplaceInstruction<\n TProgram extends string = \"4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB\",\n> =\n | ({\n instructionType: GhostspeakMarketplaceInstruction.ActivateAgent;\n } & ParsedActivateAgentInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.ApproveDelivery;\n } & ParsedApproveDeliveryInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.ArbitrateDispute;\n } & ParsedArbitrateDisputeInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.CreateAgentAuthorization;\n } & ParsedCreateAgentAuthorizationInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.CreateCredentialTemplate;\n } & ParsedCreateCredentialTemplateInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.CreateCredentialType;\n } & ParsedCreateCredentialTypeInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.CreateDidDocument;\n } & ParsedCreateDidDocumentInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.CreateEscrow;\n } & ParsedCreateEscrowInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.CreateMultisig;\n } & ParsedCreateMultisigInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.DeactivateAgent;\n } & ParsedDeactivateAgentInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.DeactivateCredentialTemplate;\n } & ParsedDeactivateCredentialTemplateInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.DeactivateCredentialType;\n } & ParsedDeactivateCredentialTypeInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.DeactivateDidDocument;\n } & ParsedDeactivateDidDocumentInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.EnableProtocolFees;\n } & ParsedEnableProtocolFeesInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.FileDispute;\n } & ParsedFileDisputeInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.GenerateComplianceReport;\n } & ParsedGenerateComplianceReportInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.InitReentrancyGuard;\n } & ParsedInitReentrancyGuardInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.InitializeAuditTrail;\n } & ParsedInitializeAuditTrailInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.InitializeGovernanceProposal;\n } & ParsedInitializeGovernanceProposalInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.InitializeProtocolConfig;\n } & ParsedInitializeProtocolConfigInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.InitializeRbacConfig;\n } & ParsedInitializeRbacConfigInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.InitializeReputationMetrics;\n } & ParsedInitializeReputationMetricsInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.InitializeStakingConfig;\n } & ParsedInitializeStakingConfigInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.IssueCredential;\n } & ParsedIssueCredentialInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.ManageAgentStatus;\n } & ParsedManageAgentStatusInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.RecordPayaiPayment;\n } & ParsedRecordPayaiPaymentInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.RegisterAgent;\n } & ParsedRegisterAgentInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.RegisterAgentCompressed;\n } & ParsedRegisterAgentCompressedInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.ResetReentrancyGuard;\n } & ParsedResetReentrancyGuardInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.ResolveDidDocument;\n } & ParsedResolveDidDocumentInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.RevokeAuthorization;\n } & ParsedRevokeAuthorizationInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.RevokeCredential;\n } & ParsedRevokeCredentialInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.SlashStake;\n } & ParsedSlashStakeInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.StakeGhost;\n } & ParsedStakeGhostInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.SubmitDelivery;\n } & ParsedSubmitDeliveryInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.SubmitServiceRating;\n } & ParsedSubmitServiceRatingInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.UnstakeGhost;\n } & ParsedUnstakeGhostInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.UpdateAgent;\n } & ParsedUpdateAgentInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.UpdateAgentReputation;\n } & ParsedUpdateAgentReputationInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.UpdateAgentService;\n } & ParsedUpdateAgentServiceInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.UpdateCrosschainStatus;\n } & ParsedUpdateCrosschainStatusInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.UpdateDidDocument;\n } & ParsedUpdateDidDocumentInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.UpdateProtocolConfig;\n } & ParsedUpdateProtocolConfigInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.UpdateReputationTags;\n } & ParsedUpdateReputationTagsInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.UpdateReputationWithAuth;\n } & ParsedUpdateReputationWithAuthInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.UpdateSourceReputation;\n } & ParsedUpdateSourceReputationInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.VerifyAgent;\n } & ParsedVerifyAgentInstruction<TProgram>)\n | ({\n instructionType: GhostspeakMarketplaceInstruction.VerifyAuthorization;\n } & ParsedVerifyAuthorizationInstruction<TProgram>);\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n AccountRole,\n isProgramDerivedAddress,\n isTransactionSigner as kitIsTransactionSigner,\n type AccountMeta,\n type AccountSignerMeta,\n type Address,\n type ProgramDerivedAddress,\n type TransactionSigner,\n upgradeRoleToSigner,\n} from \"@solana/kit\";\n\n/**\n * Asserts that the given value is not null or undefined.\n * @internal\n */\nexport function expectSome<T>(value: T | null | undefined): T {\n if (value === null || value === undefined) {\n throw new Error(\"Expected a value but received null or undefined.\");\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a PublicKey.\n * @internal\n */\nexport function expectAddress<T extends string = string>(\n value:\n | Address<T>\n | ProgramDerivedAddress<T>\n | TransactionSigner<T>\n | null\n | undefined,\n): Address<T> {\n if (!value) {\n throw new Error(\"Expected a Address.\");\n }\n if (typeof value === \"object\" && \"address\" in value) {\n return value.address;\n }\n if (Array.isArray(value)) {\n return value[0] as Address<T>;\n }\n return value as Address<T>;\n}\n\n/**\n * Asserts that the given value is a PDA.\n * @internal\n */\nexport function expectProgramDerivedAddress<T extends string = string>(\n value:\n | Address<T>\n | ProgramDerivedAddress<T>\n | TransactionSigner<T>\n | null\n | undefined,\n): ProgramDerivedAddress<T> {\n if (!value || !Array.isArray(value) || !isProgramDerivedAddress(value)) {\n throw new Error(\"Expected a ProgramDerivedAddress.\");\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a TransactionSigner.\n * @internal\n */\nexport function expectTransactionSigner<T extends string = string>(\n value:\n | Address<T>\n | ProgramDerivedAddress<T>\n | TransactionSigner<T>\n | null\n | undefined,\n): TransactionSigner<T> {\n if (!value || !isTransactionSigner(value)) {\n throw new Error(\"Expected a TransactionSigner.\");\n }\n return value;\n}\n\n/**\n * Defines an instruction account to resolve.\n * @internal\n */\nexport type ResolvedAccount<\n T extends string = string,\n U extends\n | Address<T>\n | ProgramDerivedAddress<T>\n | TransactionSigner<T>\n | null =\n | Address<T>\n | ProgramDerivedAddress<T>\n | TransactionSigner<T>\n | null,\n> = {\n isWritable: boolean;\n value: U;\n};\n\n/**\n * Defines an instruction that stores additional bytes on-chain.\n * @internal\n */\nexport type InstructionWithByteDelta = {\n byteDelta: number;\n};\n\n/**\n * Get account metas and signers from resolved accounts.\n * @internal\n */\nexport function getAccountMetaFactory(\n programAddress: Address,\n optionalAccountStrategy: \"omitted\" | \"programId\",\n) {\n return (\n account: ResolvedAccount,\n ): AccountMeta | AccountSignerMeta | undefined => {\n if (!account.value) {\n if (optionalAccountStrategy === \"omitted\") return;\n return Object.freeze({\n address: programAddress,\n role: AccountRole.READONLY,\n });\n }\n\n const writableRole = account.isWritable\n ? AccountRole.WRITABLE\n : AccountRole.READONLY;\n return Object.freeze({\n address: expectAddress(account.value),\n role: isTransactionSigner(account.value)\n ? upgradeRoleToSigner(writableRole)\n : writableRole,\n ...(isTransactionSigner(account.value) ? { signer: account.value } : {}),\n });\n };\n}\n\nexport function isTransactionSigner<TAddress extends string = string>(\n value:\n | Address<TAddress>\n | ProgramDerivedAddress<TAddress>\n | TransactionSigner<TAddress>,\n): value is TransactionSigner<TAddress> {\n return (\n !!value &&\n typeof value === \"object\" &&\n \"address\" in value &&\n kitIsTransactionSigner(value)\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/signature-verification.ts"],"names":["authorization","buffer","data"],"mappings":";;;;;AAAA,IAAA,8BAAA,GAAA;AAAA,QAAA,CAAA,8BAAA,EAAA;AAAA,EAAA,0BAAA,EAAA,MAAA,0BAAA;AAAA,EAAA,yBAAA,EAAA,MAAA,yBAAA;AAAA,EAAA,wB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OAAO,OAAOA,cAAAA,CAAc,SAAA;AAC9B;AASO,SAAS,wBAAA,CACdA,gBACA,YAAA,EACS;AACT,EAAA,OAAO,gBAAgBA,cAAAA,CAAc,UAAA;AACvC;AASO,SAAS,4BAAA,CACdA,gBACA,eAAA,EACS;AACT,EAAA,OAAOA,eAAc,OAAA,KAAY,eAAA;AACnC","file":"chunk-BQDGRTVP.js","sourcesContent":["/**\n * Agent Authorization Signature Verification\n *\n * Ed25519 signature creation and verification for GhostSpeak's\n * trustless agent pre-authorization system.\n *\n * Enables verifiable delegation of reputation update authority.\n */\n\nimport { address } from '@solana/addresses'\nimport type { Address } from '@solana/addresses'\nimport type {\n ReputationAuthorization,\n AuthorizationMessage,\n CreateAuthorizationParams,\n SolanaNetwork,\n} from '../types/authorization/authorization-types'\nimport bs58 from 'bs58'\n\n/**\n * Keypair interface for Ed25519 signing operations\n * Compatible with both legacy and modern Solana key formats\n */\nexport interface SigningKeypair {\n publicKey: {\n toBase58(): string\n toBytes(): Uint8Array\n }\n secretKey: Uint8Array\n}\n\n/**\n * Authorization message domain separator\n * Prevents signature reuse across different protocols\n */\nconst DOMAIN_SEPARATOR = 'GhostSpeak Reputation Authorization'\n\n/**\n * Create authorization message for signing\n *\n * Message format:\n * - Domain separator (prevents cross-protocol replay)\n * - Agent address (32 bytes)\n * - Authorized source (32 bytes)\n * - Index limit (8 bytes, u64 big-endian)\n * - Expiration timestamp (8 bytes, u64 big-endian)\n * - Network string (variable length)\n * - Nonce (optional, 32 bytes if present)\n *\n * @param message - Authorization message parameters\n * @returns Buffer ready for signing\n */\nexport function createAuthorizationMessage(message: AuthorizationMessage): Buffer {\n const components: Buffer[] = []\n\n // 1. Domain separator\n components.push(Buffer.from(DOMAIN_SEPARATOR, 'utf8'))\n\n // 2. Agent address (32 bytes)\n const agentBytes = bs58.decode(message.agentAddress)\n components.push(Buffer.from(agentBytes))\n\n // 3. Authorized source (32 bytes)\n const sourceBytes = bs58.decode(message.authorizedSource)\n components.push(Buffer.from(sourceBytes))\n\n // 4. Index limit (8 bytes, u64 big-endian)\n const indexLimitBuffer = Buffer.allocUnsafe(8)\n indexLimitBuffer.writeBigUInt64BE(BigInt(message.indexLimit))\n components.push(indexLimitBuffer)\n\n // 5. Expiration timestamp (8 bytes, u64 big-endian)\n const expiresAtBuffer = Buffer.allocUnsafe(8)\n expiresAtBuffer.writeBigUInt64BE(BigInt(message.expiresAt))\n components.push(expiresAtBuffer)\n\n // 6. Network string\n components.push(Buffer.from(message.network, 'utf8'))\n\n // 7. Nonce (optional, 32 bytes)\n if (message.nonce) {\n components.push(Buffer.from(message.nonce, 'utf8'))\n }\n\n return Buffer.concat(components)\n}\n\n/**\n * Sign authorization message with agent's private key\n *\n * @param message - Authorization message to sign\n * @param agentKeypair - Agent's keypair (must match message.agentAddress)\n * @returns Ed25519 signature (64 bytes)\n */\nexport async function signAuthorizationMessage(\n message: AuthorizationMessage,\n agentKeypair: SigningKeypair\n): Promise<Uint8Array> {\n // Verify keypair matches agent address\n const keypairAddress = agentKeypair.publicKey.toBase58()\n if (keypairAddress !== message.agentAddress) {\n throw new Error(\n `Keypair public key ${keypairAddress} does not match agent address ${message.agentAddress}`\n )\n }\n\n // Create message buffer\n const messageBuffer = createAuthorizationMessage(message)\n\n // Sign with Ed25519\n const nacl = await import('tweetnacl')\n const signature = nacl.sign.detached(messageBuffer, agentKeypair.secretKey)\n\n return signature\n}\n\n/**\n * Verify authorization signature\n *\n * @param authorization - Authorization to verify\n * @returns True if signature is valid\n */\nexport async function verifyAuthorizationSignature(\n authorization: ReputationAuthorization\n): Promise<boolean> {\n try {\n // Reconstruct message\n const message: AuthorizationMessage = {\n agentAddress: authorization.agentAddress,\n authorizedSource: authorization.authorizedSource,\n indexLimit: authorization.indexLimit,\n expiresAt: authorization.expiresAt,\n network: authorization.network,\n nonce: authorization.nonce,\n }\n\n const messageBuffer = createAuthorizationMessage(message)\n\n // Verify signature\n const nacl = await import('tweetnacl')\n const agentPubkeyBytes = bs58.decode(authorization.agentAddress)\n const isValid = nacl.sign.detached.verify(\n messageBuffer,\n authorization.signature,\n agentPubkeyBytes\n )\n\n return isValid\n } catch (error) {\n console.error('[Auth Signature] Verification failed:', error)\n return false\n }\n}\n\n/**\n * Create a complete authorization with signature\n *\n * @param params - Authorization parameters\n * @param agentKeypair - Agent's keypair for signing\n * @returns Complete signed authorization\n */\nexport async function createSignedAuthorization(\n params: CreateAuthorizationParams,\n agentKeypair: SigningKeypair\n): Promise<ReputationAuthorization> {\n // Get agent address from keypair\n const agentAddress = address(agentKeypair.publicKey.toBase58())\n\n // Calculate expiration\n const now = Math.floor(Date.now() / 1000)\n const expiresAt = params.expiresAt || now + (params.expiresIn || 30 * 24 * 60 * 60) // Default 30 days\n\n // Default index limit\n const indexLimit = params.indexLimit || 1000\n\n // Default network (would need to be passed or detected from cluster)\n const network: SolanaNetwork = params.network || 'devnet'\n\n // Use \"default\" nonce if not provided to avoid PDA seed length issues (64-char hex exceeds 32-byte limit)\n // Note: This matches Rust's unwrap_or(&String::from(\"default\")) behavior\n const nonce = params.nonce !== undefined ? params.nonce : \"default\"\n\n // Create message\n const message: AuthorizationMessage = {\n agentAddress,\n authorizedSource: params.authorizedSource,\n indexLimit,\n expiresAt,\n network,\n nonce,\n }\n\n // Sign message\n const signature = await signAuthorizationMessage(message, agentKeypair)\n\n // Return complete authorization\n const authorization: ReputationAuthorization = {\n agentAddress,\n authorizedSource: params.authorizedSource,\n indexLimit,\n expiresAt,\n network,\n signature,\n nonce,\n metadata: params.metadata,\n }\n\n return authorization\n}\n\n/**\n * Generate a random nonce for replay protection\n *\n * @returns 32-byte random nonce as hex string\n */\nexport function generateNonce(): string {\n // Use global crypto if available (browser/modern Node.js)\n if (globalThis.crypto) {\n const buffer = new Uint8Array(32)\n globalThis.crypto.getRandomValues(buffer)\n return Buffer.from(buffer).toString('hex')\n }\n\n // Fallback for Node.js < 19 (though we require Node 24+)\n // This branch should rarely execute but provides compatibility\n const nodeCrypto = eval('require')('crypto')\n const buffer = new Uint8Array(32)\n nodeCrypto.webcrypto.getRandomValues(buffer)\n return Buffer.from(buffer).toString('hex')\n}\n\n/**\n * Serialize authorization to JSON-safe format\n *\n * @param authorization - Authorization to serialize\n * @returns JSON-safe object (signature as base58)\n */\nexport function serializeAuthorization(authorization: ReputationAuthorization): {\n agentAddress: string\n authorizedSource: string\n indexLimit: number\n expiresAt: number\n network: SolanaNetwork\n signature: string\n nonce?: string\n metadata?: any\n} {\n return {\n agentAddress: authorization.agentAddress,\n authorizedSource: authorization.authorizedSource,\n indexLimit: authorization.indexLimit,\n expiresAt: authorization.expiresAt,\n network: authorization.network,\n signature: bs58.encode(authorization.signature),\n nonce: authorization.nonce,\n metadata: authorization.metadata,\n }\n}\n\n/**\n * Deserialize authorization from JSON format\n *\n * @param data - Serialized authorization data\n * @returns ReputationAuthorization with Uint8Array signature\n */\nexport function deserializeAuthorization(data: {\n agentAddress: string\n authorizedSource: string\n indexLimit: number\n expiresAt: number\n network: SolanaNetwork\n signature: string\n nonce?: string\n metadata?: any\n}): ReputationAuthorization {\n return {\n agentAddress: data.agentAddress as Address,\n authorizedSource: data.authorizedSource as Address,\n indexLimit: data.indexLimit,\n expiresAt: data.expiresAt,\n network: data.network,\n signature: bs58.decode(data.signature),\n nonce: data.nonce,\n metadata: data.metadata,\n }\n}\n\n/**\n * Get authorization ID (deterministic hash)\n *\n * @param authorization - Authorization to hash\n * @returns Base58-encoded SHA-256 hash\n */\nexport async function getAuthorizationId(authorization: ReputationAuthorization): Promise<string> {\n const serialized = serializeAuthorization(authorization)\n const json = JSON.stringify(serialized)\n const encoder = new TextEncoder()\n const data = encoder.encode(json)\n\n // Use global crypto if available\n let crypto: Crypto\n if (globalThis.crypto) {\n crypto = globalThis.crypto\n } else {\n // Fallback for Node.js < 19\n const nodeCrypto = eval('require')('crypto')\n crypto = nodeCrypto.webcrypto as Crypto\n }\n\n // SHA-256 hash\n const hashBuffer = await crypto.subtle.digest('SHA-256', data)\n const hashArray = new Uint8Array(hashBuffer)\n\n return bs58.encode(hashArray)\n}\n\n/**\n * Check if authorization is expired\n *\n * @param authorization - Authorization to check\n * @param currentTime - Current Unix timestamp (defaults to now)\n * @returns True if expired\n */\nexport function isAuthorizationExpired(\n authorization: ReputationAuthorization,\n currentTime?: number\n): boolean {\n const now = currentTime || Math.floor(Date.now() / 1000)\n return now >= authorization.expiresAt\n}\n\n/**\n * Check if authorization has exceeded index limit\n *\n * @param authorization - Authorization to check\n * @param currentIndex - Current usage count\n * @returns True if exhausted\n */\nexport function isAuthorizationExhausted(\n authorization: ReputationAuthorization,\n currentIndex: number\n): boolean {\n return currentIndex >= authorization.indexLimit\n}\n\n/**\n * Validate authorization network matches expected\n *\n * @param authorization - Authorization to check\n * @param expectedNetwork - Expected network\n * @returns True if networks match\n */\nexport function validateAuthorizationNetwork(\n authorization: ReputationAuthorization,\n expectedNetwork: SolanaNetwork\n): boolean {\n return authorization.network === expectedNetwork\n}\n"]}
|