@ghostspeak/sdk 2.0.6 → 2.0.8

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.
Files changed (118) hide show
  1. package/README.md +295 -30
  2. package/dist/GhostSpeakClient-bnXwUPHI.d.ts +1011 -0
  3. package/dist/StakingModule-DunDShLq.d.ts +2446 -0
  4. package/dist/{agent-M74TCRON.js → agent-S42FIMR7.js} +4 -4
  5. package/dist/{agent-M74TCRON.js.map → agent-S42FIMR7.js.map} +1 -1
  6. package/dist/batch-operations-45CQFEID.js +4 -0
  7. package/dist/batch-operations-45CQFEID.js.map +1 -0
  8. package/dist/browser-CI5_6Gzk.d.ts +234 -0
  9. package/dist/browser.d.ts +6 -576
  10. package/dist/browser.js +15 -842
  11. package/dist/browser.js.map +1 -1
  12. package/dist/chunk-46QWY3MG.js +156 -0
  13. package/dist/chunk-46QWY3MG.js.map +1 -0
  14. package/dist/{chunk-F3DZMBUA.js → chunk-5QBSC4T4.js} +327 -493
  15. package/dist/chunk-5QBSC4T4.js.map +1 -0
  16. package/dist/chunk-5QZVFUXB.js +4176 -0
  17. package/dist/chunk-5QZVFUXB.js.map +1 -0
  18. package/dist/chunk-6XCCMJ6M.js +1865 -0
  19. package/dist/chunk-6XCCMJ6M.js.map +1 -0
  20. package/dist/chunk-A7ALCVUI.js +98 -0
  21. package/dist/chunk-A7ALCVUI.js.map +1 -0
  22. package/dist/chunk-AWMGX3OX.js +814 -0
  23. package/dist/chunk-AWMGX3OX.js.map +1 -0
  24. package/dist/chunk-BF3IQ35I.js +284 -0
  25. package/dist/chunk-BF3IQ35I.js.map +1 -0
  26. package/dist/chunk-BQDGRTVP.js +168 -0
  27. package/dist/chunk-BQDGRTVP.js.map +1 -0
  28. package/dist/chunk-IQM5RASO.js +8502 -0
  29. package/dist/chunk-IQM5RASO.js.map +1 -0
  30. package/dist/chunk-JYXSOXCP.js +3850 -0
  31. package/dist/chunk-JYXSOXCP.js.map +1 -0
  32. package/dist/chunk-OXA7MECJ.js +7787 -0
  33. package/dist/chunk-OXA7MECJ.js.map +1 -0
  34. package/dist/chunk-QLRWUHN2.js +231 -0
  35. package/dist/chunk-QLRWUHN2.js.map +1 -0
  36. package/dist/chunk-SKMJJ3Q6.js +125 -0
  37. package/dist/chunk-SKMJJ3Q6.js.map +1 -0
  38. package/dist/chunk-TTB4OS2D.js +69 -0
  39. package/dist/chunk-TTB4OS2D.js.map +1 -0
  40. package/dist/chunk-UP2VWCW5.js +33 -0
  41. package/dist/{chunk-NSBPE2FW.js.map → chunk-UP2VWCW5.js.map} +1 -1
  42. package/dist/{chunk-UJUGGLMT.js → chunk-VQZQCHUT.js} +5 -5
  43. package/dist/{chunk-UJUGGLMT.js.map → chunk-VQZQCHUT.js.map} +1 -1
  44. package/dist/client.d.ts +4 -4
  45. package/dist/client.js +11 -10
  46. package/dist/createAgentAuthorization-KGZNXZBT.js +5 -0
  47. package/dist/createAgentAuthorization-KGZNXZBT.js.map +1 -0
  48. package/dist/credentials.js +1 -1
  49. package/dist/crypto.js +2 -2
  50. package/dist/errors.js +1 -1
  51. package/dist/feature-flags-B1g0DCPe.d.ts +1181 -0
  52. package/dist/generated-QJREJQ2C.js +9 -0
  53. package/dist/{generated-VNLHMR6Y.js.map → generated-QJREJQ2C.js.map} +1 -1
  54. package/dist/{ghostspeak_wasm-SB2RPJ3D.js → ghostspeak_wasm-F227HOSM.js} +3 -3
  55. package/dist/{ghostspeak_wasm-SB2RPJ3D.js.map → ghostspeak_wasm-F227HOSM.js.map} +1 -1
  56. package/dist/index.d.ts +1179 -1498
  57. package/dist/index.js +356 -3578
  58. package/dist/index.js.map +1 -1
  59. package/dist/metafile-esm.json +1 -1
  60. package/dist/minimal/core-minimal.d.ts +2446 -1245
  61. package/dist/minimal/core-minimal.js +9 -9
  62. package/dist/minimal/core-minimal.js.map +1 -1
  63. package/dist/nacl-fast-W5BJ3KZ2.js +2229 -0
  64. package/dist/nacl-fast-W5BJ3KZ2.js.map +1 -0
  65. package/dist/pda-4KP7CURF.js +4 -0
  66. package/dist/pda-4KP7CURF.js.map +1 -0
  67. package/dist/pda-Ce7VYg4T.d.ts +25 -0
  68. package/dist/reputation-types-Yebf0Rm_.d.ts +1071 -0
  69. package/dist/revokeAuthorization-2ZRO6GUZ.js +5 -0
  70. package/dist/revokeAuthorization-2ZRO6GUZ.js.map +1 -0
  71. package/dist/signature-verification-DGxR4aYQ.d.ts +448 -0
  72. package/dist/types.js +1 -1
  73. package/dist/updateReputationWithAuth-PCEUOCFV.js +5 -0
  74. package/dist/updateReputationWithAuth-PCEUOCFV.js.map +1 -0
  75. package/dist/utils.d.ts +69 -203
  76. package/dist/utils.js +15 -153
  77. package/dist/utils.js.map +1 -1
  78. package/package.json +27 -34
  79. package/dist/.tsbuildinfo +0 -1
  80. package/dist/GhostSpeakClient-D_66Uzsf.d.ts +0 -707
  81. package/dist/GovernanceModule-DQYYys-H.d.ts +0 -1766
  82. package/dist/chunk-APCKGD23.js +0 -1328
  83. package/dist/chunk-APCKGD23.js.map +0 -1
  84. package/dist/chunk-ASQXX4IT.js +0 -572
  85. package/dist/chunk-ASQXX4IT.js.map +0 -1
  86. package/dist/chunk-COGZFWOT.js +0 -19657
  87. package/dist/chunk-COGZFWOT.js.map +0 -1
  88. package/dist/chunk-F3DZMBUA.js.map +0 -1
  89. package/dist/chunk-GMHIUK2R.js +0 -7526
  90. package/dist/chunk-GMHIUK2R.js.map +0 -1
  91. package/dist/chunk-IAWBZYPE.js +0 -356
  92. package/dist/chunk-IAWBZYPE.js.map +0 -1
  93. package/dist/chunk-NSBPE2FW.js +0 -15
  94. package/dist/chunk-OWYHJG6H.js +0 -13311
  95. package/dist/chunk-OWYHJG6H.js.map +0 -1
  96. package/dist/chunk-RDDPOFR5.js +0 -3
  97. package/dist/chunk-RDDPOFR5.js.map +0 -1
  98. package/dist/chunk-RERCHKZP.js +0 -35
  99. package/dist/chunk-RERCHKZP.js.map +0 -1
  100. package/dist/chunk-TVVGXYCI.js +0 -2887
  101. package/dist/chunk-TVVGXYCI.js.map +0 -1
  102. package/dist/chunk-ZGP5552B.js +0 -377
  103. package/dist/chunk-ZGP5552B.js.map +0 -1
  104. package/dist/chunk-ZWOYNHVK.js +0 -196
  105. package/dist/chunk-ZWOYNHVK.js.map +0 -1
  106. package/dist/dist/.tsbuildinfo +0 -1
  107. package/dist/elgamal-VZLWB3XK.js +0 -5
  108. package/dist/elgamal-VZLWB3XK.js.map +0 -1
  109. package/dist/feature-flags-V722ZuXO.d.ts +0 -3512
  110. package/dist/generated-VNLHMR6Y.js +0 -5
  111. package/dist/ipfs-types-BOt9ZNg4.d.ts +0 -592
  112. package/dist/multisigConfig-BzEhy6jy.d.ts +0 -58
  113. package/dist/pda-B_nS8SbD.d.ts +0 -114
  114. package/dist/pda-S4BFJVGE.js +0 -4
  115. package/dist/pda-S4BFJVGE.js.map +0 -1
  116. package/dist/system-addresses-BFNLEbFx.d.ts +0 -857
  117. package/dist/token-2022-rpc-RALH4RK7.js +0 -593
  118. package/dist/token-2022-rpc-RALH4RK7.js.map +0 -1
@@ -0,0 +1,231 @@
1
+ import { GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, expectAddress, expectSome, getAccountMetaFactory } from './chunk-AWMGX3OX.js';
2
+ import { fixEncoderSize, getBytesEncoder, transformEncoder, getStructEncoder, getI64Encoder, addEncoderSizePrefix, getOptionEncoder, getUtf8Encoder, getU32Encoder, getStructDecoder, fixDecoderSize, getI64Decoder, addDecoderSizePrefix, getOptionDecoder, getBytesDecoder, getUtf8Decoder, getU32Decoder, combineCodec, getProgramDerivedAddress, getAddressEncoder } from '@solana/kit';
3
+
4
+ var UPDATE_REPUTATION_WITH_AUTH_DISCRIMINATOR = new Uint8Array([
5
+ 61,
6
+ 236,
7
+ 225,
8
+ 167,
9
+ 134,
10
+ 43,
11
+ 53,
12
+ 93
13
+ ]);
14
+ function getUpdateReputationWithAuthDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(
16
+ UPDATE_REPUTATION_WITH_AUTH_DISCRIMINATOR
17
+ );
18
+ }
19
+ function getUpdateReputationWithAuthInstructionDataEncoder() {
20
+ return transformEncoder(
21
+ getStructEncoder([
22
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
23
+ ["reputationChange", getI64Encoder()],
24
+ [
25
+ "transactionSignature",
26
+ addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())
27
+ ],
28
+ [
29
+ "metadata",
30
+ getOptionEncoder(
31
+ addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())
32
+ )
33
+ ],
34
+ [
35
+ "nonce",
36
+ getOptionEncoder(
37
+ addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())
38
+ )
39
+ ]
40
+ ]),
41
+ (value) => ({
42
+ ...value,
43
+ discriminator: UPDATE_REPUTATION_WITH_AUTH_DISCRIMINATOR
44
+ })
45
+ );
46
+ }
47
+ function getUpdateReputationWithAuthInstructionDataDecoder() {
48
+ return getStructDecoder([
49
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
50
+ ["reputationChange", getI64Decoder()],
51
+ [
52
+ "transactionSignature",
53
+ addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())
54
+ ],
55
+ [
56
+ "metadata",
57
+ getOptionDecoder(addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()))
58
+ ],
59
+ [
60
+ "nonce",
61
+ getOptionDecoder(addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()))
62
+ ]
63
+ ]);
64
+ }
65
+ function getUpdateReputationWithAuthInstructionDataCodec() {
66
+ return combineCodec(
67
+ getUpdateReputationWithAuthInstructionDataEncoder(),
68
+ getUpdateReputationWithAuthInstructionDataDecoder()
69
+ );
70
+ }
71
+ async function getUpdateReputationWithAuthInstructionAsync(input, config) {
72
+ const programAddress = config?.programAddress ?? GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS;
73
+ const originalAccounts = {
74
+ agent: { value: input.agent ?? null, isWritable: false },
75
+ reputationMetrics: {
76
+ value: input.reputationMetrics ?? null,
77
+ isWritable: true
78
+ },
79
+ authorization: { value: input.authorization ?? null, isWritable: true },
80
+ usageRecord: { value: input.usageRecord ?? null, isWritable: true },
81
+ authorizedSource: {
82
+ value: input.authorizedSource ?? null,
83
+ isWritable: true
84
+ },
85
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
86
+ clock: { value: input.clock ?? null, isWritable: false }
87
+ };
88
+ const accounts = originalAccounts;
89
+ const args = { ...input };
90
+ if (!accounts.reputationMetrics.value) {
91
+ accounts.reputationMetrics.value = await getProgramDerivedAddress({
92
+ programAddress,
93
+ seeds: [
94
+ getBytesEncoder().encode(
95
+ new Uint8Array([
96
+ 114,
97
+ 101,
98
+ 112,
99
+ 117,
100
+ 116,
101
+ 97,
102
+ 116,
103
+ 105,
104
+ 111,
105
+ 110,
106
+ 95,
107
+ 109,
108
+ 101,
109
+ 116,
110
+ 114,
111
+ 105,
112
+ 99,
113
+ 115
114
+ ])
115
+ ),
116
+ getAddressEncoder().encode(expectAddress(accounts.agent.value))
117
+ ]
118
+ });
119
+ }
120
+ if (!accounts.authorization.value) {
121
+ accounts.authorization.value = await getProgramDerivedAddress({
122
+ programAddress,
123
+ seeds: [
124
+ getBytesEncoder().encode(
125
+ new Uint8Array([97, 103, 101, 110, 116, 95, 97, 117, 116, 104])
126
+ ),
127
+ getAddressEncoder().encode(expectAddress(accounts.agent.value)),
128
+ getAddressEncoder().encode(
129
+ expectAddress(accounts.authorizedSource.value)
130
+ ),
131
+ getOptionEncoder(
132
+ addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())
133
+ ).encode(expectSome(args.nonce))
134
+ ]
135
+ });
136
+ }
137
+ if (!accounts.systemProgram.value) {
138
+ accounts.systemProgram.value = "11111111111111111111111111111111";
139
+ }
140
+ if (!accounts.clock.value) {
141
+ accounts.clock.value = "SysvarC1ock11111111111111111111111111111111";
142
+ }
143
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
144
+ return Object.freeze({
145
+ accounts: [
146
+ getAccountMeta(accounts.agent),
147
+ getAccountMeta(accounts.reputationMetrics),
148
+ getAccountMeta(accounts.authorization),
149
+ getAccountMeta(accounts.usageRecord),
150
+ getAccountMeta(accounts.authorizedSource),
151
+ getAccountMeta(accounts.systemProgram),
152
+ getAccountMeta(accounts.clock)
153
+ ],
154
+ data: getUpdateReputationWithAuthInstructionDataEncoder().encode(
155
+ args
156
+ ),
157
+ programAddress
158
+ });
159
+ }
160
+ function getUpdateReputationWithAuthInstruction(input, config) {
161
+ const programAddress = config?.programAddress ?? GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS;
162
+ const originalAccounts = {
163
+ agent: { value: input.agent ?? null, isWritable: false },
164
+ reputationMetrics: {
165
+ value: input.reputationMetrics ?? null,
166
+ isWritable: true
167
+ },
168
+ authorization: { value: input.authorization ?? null, isWritable: true },
169
+ usageRecord: { value: input.usageRecord ?? null, isWritable: true },
170
+ authorizedSource: {
171
+ value: input.authorizedSource ?? null,
172
+ isWritable: true
173
+ },
174
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
175
+ clock: { value: input.clock ?? null, isWritable: false }
176
+ };
177
+ const accounts = originalAccounts;
178
+ const args = { ...input };
179
+ if (!accounts.systemProgram.value) {
180
+ accounts.systemProgram.value = "11111111111111111111111111111111";
181
+ }
182
+ if (!accounts.clock.value) {
183
+ accounts.clock.value = "SysvarC1ock11111111111111111111111111111111";
184
+ }
185
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
186
+ return Object.freeze({
187
+ accounts: [
188
+ getAccountMeta(accounts.agent),
189
+ getAccountMeta(accounts.reputationMetrics),
190
+ getAccountMeta(accounts.authorization),
191
+ getAccountMeta(accounts.usageRecord),
192
+ getAccountMeta(accounts.authorizedSource),
193
+ getAccountMeta(accounts.systemProgram),
194
+ getAccountMeta(accounts.clock)
195
+ ],
196
+ data: getUpdateReputationWithAuthInstructionDataEncoder().encode(
197
+ args
198
+ ),
199
+ programAddress
200
+ });
201
+ }
202
+ function parseUpdateReputationWithAuthInstruction(instruction) {
203
+ if (instruction.accounts.length < 7) {
204
+ throw new Error("Not enough accounts");
205
+ }
206
+ let accountIndex = 0;
207
+ const getNextAccount = () => {
208
+ const accountMeta = instruction.accounts[accountIndex];
209
+ accountIndex += 1;
210
+ return accountMeta;
211
+ };
212
+ return {
213
+ programAddress: instruction.programAddress,
214
+ accounts: {
215
+ agent: getNextAccount(),
216
+ reputationMetrics: getNextAccount(),
217
+ authorization: getNextAccount(),
218
+ usageRecord: getNextAccount(),
219
+ authorizedSource: getNextAccount(),
220
+ systemProgram: getNextAccount(),
221
+ clock: getNextAccount()
222
+ },
223
+ data: getUpdateReputationWithAuthInstructionDataDecoder().decode(
224
+ instruction.data
225
+ )
226
+ };
227
+ }
228
+
229
+ export { UPDATE_REPUTATION_WITH_AUTH_DISCRIMINATOR, getUpdateReputationWithAuthDiscriminatorBytes, getUpdateReputationWithAuthInstruction, getUpdateReputationWithAuthInstructionAsync, getUpdateReputationWithAuthInstructionDataCodec, getUpdateReputationWithAuthInstructionDataDecoder, getUpdateReputationWithAuthInstructionDataEncoder, parseUpdateReputationWithAuthInstruction };
230
+ //# sourceMappingURL=chunk-QLRWUHN2.js.map
231
+ //# sourceMappingURL=chunk-QLRWUHN2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/generated/instructions/updateReputationWithAuth.ts"],"names":[],"mappings":";;;AAsDO,IAAM,yCAAA,GAA4C,IAAI,UAAA,CAAW;AAAA,EACtE,EAAA;AAAA,EAAI,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,EAAA;AAAA,EAAI,EAAA;AAAA,EAAI;AAClC,CAAC;AAEM,SAAS,6CAAA,GAAgD;AAC9D,EAAA,OAAO,cAAA,CAAe,eAAA,EAAgB,EAAG,CAAC,CAAA,CAAE,MAAA;AAAA,IAC1C;AAAA,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,MAAM,qBAAqB,CAAA;AAAA,EACvC;AACA,EAAA,IAAI,YAAA,GAAe,CAAA;AACnB,EAAA,MAAM,iBAAiB,MAAM;AAC3B,IAAA,MAAM,WAAA,GAAe,WAAA,CAAY,QAAA,CAA2B,YAAY,CAAA;AACxE,IAAA,YAAA,IAAgB,CAAA;AAChB,IAAA,OAAO,WAAA;AAAA,EACT,CAAA;AACA,EAAA,OAAO;AAAA,IACL,gBAAgB,WAAA,CAAY,cAAA;AAAA,IAC5B,QAAA,EAAU;AAAA,MACR,OAAO,cAAA,EAAe;AAAA,MACtB,mBAAmB,cAAA,EAAe;AAAA,MAClC,eAAe,cAAA,EAAe;AAAA,MAC9B,aAAa,cAAA,EAAe;AAAA,MAC5B,kBAAkB,cAAA,EAAe;AAAA,MACjC,eAAe,cAAA,EAAe;AAAA,MAC9B,OAAO,cAAA;AAAe,KACxB;AAAA,IACA,IAAA,EAAM,mDAAkD,CAAE,MAAA;AAAA,MACxD,WAAA,CAAY;AAAA;AACd,GACF;AACF","file":"chunk-QLRWUHN2.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 addDecoderSizePrefix,\n addEncoderSizePrefix,\n combineCodec,\n fixDecoderSize,\n fixEncoderSize,\n getAddressEncoder,\n getBytesDecoder,\n getBytesEncoder,\n getI64Decoder,\n getI64Encoder,\n getOptionDecoder,\n getOptionEncoder,\n getProgramDerivedAddress,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getUtf8Decoder,\n getUtf8Encoder,\n transformEncoder,\n type AccountMeta,\n type AccountSignerMeta,\n type Address,\n type Codec,\n type Decoder,\n type Encoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type Option,\n type OptionOrNullable,\n type ReadonlyAccount,\n type ReadonlyUint8Array,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from \"@solana/kit\";\nimport { GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS } from \"../programs\";\nimport {\n expectAddress,\n expectSome,\n getAccountMetaFactory,\n type ResolvedAccount,\n} from \"../shared\";\n\nexport const UPDATE_REPUTATION_WITH_AUTH_DISCRIMINATOR = new Uint8Array([\n 61, 236, 225, 167, 134, 43, 53, 93,\n]);\n\nexport function getUpdateReputationWithAuthDiscriminatorBytes() {\n return fixEncoderSize(getBytesEncoder(), 8).encode(\n UPDATE_REPUTATION_WITH_AUTH_DISCRIMINATOR,\n );\n}\n\nexport type UpdateReputationWithAuthInstruction<\n TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS,\n TAccountAgent extends string | AccountMeta<string> = string,\n TAccountReputationMetrics extends string | AccountMeta<string> = string,\n TAccountAuthorization extends string | AccountMeta<string> = string,\n TAccountUsageRecord extends string | AccountMeta<string> = string,\n TAccountAuthorizedSource extends string | AccountMeta<string> = string,\n TAccountSystemProgram extends string | AccountMeta<string> =\n \"11111111111111111111111111111111\",\n TAccountClock extends string | AccountMeta<string> =\n \"SysvarC1ock11111111111111111111111111111111\",\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<\n [\n TAccountAgent extends string\n ? ReadonlyAccount<TAccountAgent>\n : TAccountAgent,\n TAccountReputationMetrics extends string\n ? WritableAccount<TAccountReputationMetrics>\n : TAccountReputationMetrics,\n TAccountAuthorization extends string\n ? WritableAccount<TAccountAuthorization>\n : TAccountAuthorization,\n TAccountUsageRecord extends string\n ? WritableAccount<TAccountUsageRecord>\n : TAccountUsageRecord,\n TAccountAuthorizedSource extends string\n ? WritableSignerAccount<TAccountAuthorizedSource> &\n AccountSignerMeta<TAccountAuthorizedSource>\n : TAccountAuthorizedSource,\n TAccountSystemProgram extends string\n ? ReadonlyAccount<TAccountSystemProgram>\n : TAccountSystemProgram,\n TAccountClock extends string\n ? ReadonlyAccount<TAccountClock>\n : TAccountClock,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type UpdateReputationWithAuthInstructionData = {\n discriminator: ReadonlyUint8Array;\n reputationChange: bigint;\n transactionSignature: string;\n metadata: Option<string>;\n nonce: Option<string>;\n};\n\nexport type UpdateReputationWithAuthInstructionDataArgs = {\n reputationChange: number | bigint;\n transactionSignature: string;\n metadata: OptionOrNullable<string>;\n nonce: OptionOrNullable<string>;\n};\n\nexport function getUpdateReputationWithAuthInstructionDataEncoder(): Encoder<UpdateReputationWithAuthInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n [\"discriminator\", fixEncoderSize(getBytesEncoder(), 8)],\n [\"reputationChange\", getI64Encoder()],\n [\n \"transactionSignature\",\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n ],\n [\n \"metadata\",\n getOptionEncoder(\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n ),\n ],\n [\n \"nonce\",\n getOptionEncoder(\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n ),\n ],\n ]),\n (value) => ({\n ...value,\n discriminator: UPDATE_REPUTATION_WITH_AUTH_DISCRIMINATOR,\n }),\n );\n}\n\nexport function getUpdateReputationWithAuthInstructionDataDecoder(): Decoder<UpdateReputationWithAuthInstructionData> {\n return getStructDecoder([\n [\"discriminator\", fixDecoderSize(getBytesDecoder(), 8)],\n [\"reputationChange\", getI64Decoder()],\n [\n \"transactionSignature\",\n addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder()),\n ],\n [\n \"metadata\",\n getOptionDecoder(addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())),\n ],\n [\n \"nonce\",\n getOptionDecoder(addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())),\n ],\n ]);\n}\n\nexport function getUpdateReputationWithAuthInstructionDataCodec(): Codec<\n UpdateReputationWithAuthInstructionDataArgs,\n UpdateReputationWithAuthInstructionData\n> {\n return combineCodec(\n getUpdateReputationWithAuthInstructionDataEncoder(),\n getUpdateReputationWithAuthInstructionDataDecoder(),\n );\n}\n\nexport type UpdateReputationWithAuthAsyncInput<\n TAccountAgent extends string = string,\n TAccountReputationMetrics extends string = string,\n TAccountAuthorization extends string = string,\n TAccountUsageRecord extends string = string,\n TAccountAuthorizedSource extends string = string,\n TAccountSystemProgram extends string = string,\n TAccountClock extends string = string,\n> = {\n /** Agent whose reputation is being updated */\n agent: Address<TAccountAgent>;\n /** Agent reputation metrics */\n reputationMetrics?: Address<TAccountReputationMetrics>;\n /** Authorization account (PDA) */\n authorization?: Address<TAccountAuthorization>;\n /** Usage record account (optional, for audit trail) */\n usageRecord: Address<TAccountUsageRecord>;\n /** Authorized source (e.g., PayAI facilitator) */\n authorizedSource: TransactionSigner<TAccountAuthorizedSource>;\n /** System program */\n systemProgram?: Address<TAccountSystemProgram>;\n /** Clock for timestamps */\n clock?: Address<TAccountClock>;\n reputationChange: UpdateReputationWithAuthInstructionDataArgs[\"reputationChange\"];\n transactionSignature: UpdateReputationWithAuthInstructionDataArgs[\"transactionSignature\"];\n metadata: UpdateReputationWithAuthInstructionDataArgs[\"metadata\"];\n nonce: UpdateReputationWithAuthInstructionDataArgs[\"nonce\"];\n};\n\nexport async function getUpdateReputationWithAuthInstructionAsync<\n TAccountAgent extends string,\n TAccountReputationMetrics extends string,\n TAccountAuthorization extends string,\n TAccountUsageRecord extends string,\n TAccountAuthorizedSource extends string,\n TAccountSystemProgram extends string,\n TAccountClock extends string,\n TProgramAddress extends Address =\n typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS,\n>(\n input: UpdateReputationWithAuthAsyncInput<\n TAccountAgent,\n TAccountReputationMetrics,\n TAccountAuthorization,\n TAccountUsageRecord,\n TAccountAuthorizedSource,\n TAccountSystemProgram,\n TAccountClock\n >,\n config?: { programAddress?: TProgramAddress },\n): Promise<\n UpdateReputationWithAuthInstruction<\n TProgramAddress,\n TAccountAgent,\n TAccountReputationMetrics,\n TAccountAuthorization,\n TAccountUsageRecord,\n TAccountAuthorizedSource,\n TAccountSystemProgram,\n TAccountClock\n >\n> {\n // Program address.\n const programAddress =\n config?.programAddress ?? GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n agent: { value: input.agent ?? null, isWritable: false },\n reputationMetrics: {\n value: input.reputationMetrics ?? null,\n isWritable: true,\n },\n authorization: { value: input.authorization ?? null, isWritable: true },\n usageRecord: { value: input.usageRecord ?? null, isWritable: true },\n authorizedSource: {\n value: input.authorizedSource ?? null,\n isWritable: true,\n },\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n clock: { value: input.clock ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.reputationMetrics.value) {\n accounts.reputationMetrics.value = await getProgramDerivedAddress({\n programAddress,\n seeds: [\n getBytesEncoder().encode(\n new Uint8Array([\n 114, 101, 112, 117, 116, 97, 116, 105, 111, 110, 95, 109, 101, 116,\n 114, 105, 99, 115,\n ]),\n ),\n getAddressEncoder().encode(expectAddress(accounts.agent.value)),\n ],\n });\n }\n if (!accounts.authorization.value) {\n accounts.authorization.value = await getProgramDerivedAddress({\n programAddress,\n seeds: [\n getBytesEncoder().encode(\n new Uint8Array([97, 103, 101, 110, 116, 95, 97, 117, 116, 104]),\n ),\n getAddressEncoder().encode(expectAddress(accounts.agent.value)),\n getAddressEncoder().encode(\n expectAddress(accounts.authorizedSource.value),\n ),\n getOptionEncoder(\n addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder()),\n ).encode(expectSome(args.nonce)),\n ],\n });\n }\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n \"11111111111111111111111111111111\" as Address<\"11111111111111111111111111111111\">;\n }\n if (!accounts.clock.value) {\n accounts.clock.value =\n \"SysvarC1ock11111111111111111111111111111111\" as Address<\"SysvarC1ock11111111111111111111111111111111\">;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, \"programId\");\n return Object.freeze({\n accounts: [\n getAccountMeta(accounts.agent),\n getAccountMeta(accounts.reputationMetrics),\n getAccountMeta(accounts.authorization),\n getAccountMeta(accounts.usageRecord),\n getAccountMeta(accounts.authorizedSource),\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.clock),\n ],\n data: getUpdateReputationWithAuthInstructionDataEncoder().encode(\n args as UpdateReputationWithAuthInstructionDataArgs,\n ),\n programAddress,\n } as UpdateReputationWithAuthInstruction<\n TProgramAddress,\n TAccountAgent,\n TAccountReputationMetrics,\n TAccountAuthorization,\n TAccountUsageRecord,\n TAccountAuthorizedSource,\n TAccountSystemProgram,\n TAccountClock\n >);\n}\n\nexport type UpdateReputationWithAuthInput<\n TAccountAgent extends string = string,\n TAccountReputationMetrics extends string = string,\n TAccountAuthorization extends string = string,\n TAccountUsageRecord extends string = string,\n TAccountAuthorizedSource extends string = string,\n TAccountSystemProgram extends string = string,\n TAccountClock extends string = string,\n> = {\n /** Agent whose reputation is being updated */\n agent: Address<TAccountAgent>;\n /** Agent reputation metrics */\n reputationMetrics: Address<TAccountReputationMetrics>;\n /** Authorization account (PDA) */\n authorization: Address<TAccountAuthorization>;\n /** Usage record account (optional, for audit trail) */\n usageRecord: Address<TAccountUsageRecord>;\n /** Authorized source (e.g., PayAI facilitator) */\n authorizedSource: TransactionSigner<TAccountAuthorizedSource>;\n /** System program */\n systemProgram?: Address<TAccountSystemProgram>;\n /** Clock for timestamps */\n clock?: Address<TAccountClock>;\n reputationChange: UpdateReputationWithAuthInstructionDataArgs[\"reputationChange\"];\n transactionSignature: UpdateReputationWithAuthInstructionDataArgs[\"transactionSignature\"];\n metadata: UpdateReputationWithAuthInstructionDataArgs[\"metadata\"];\n nonce: UpdateReputationWithAuthInstructionDataArgs[\"nonce\"];\n};\n\nexport function getUpdateReputationWithAuthInstruction<\n TAccountAgent extends string,\n TAccountReputationMetrics extends string,\n TAccountAuthorization extends string,\n TAccountUsageRecord extends string,\n TAccountAuthorizedSource extends string,\n TAccountSystemProgram extends string,\n TAccountClock extends string,\n TProgramAddress extends Address =\n typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS,\n>(\n input: UpdateReputationWithAuthInput<\n TAccountAgent,\n TAccountReputationMetrics,\n TAccountAuthorization,\n TAccountUsageRecord,\n TAccountAuthorizedSource,\n TAccountSystemProgram,\n TAccountClock\n >,\n config?: { programAddress?: TProgramAddress },\n): UpdateReputationWithAuthInstruction<\n TProgramAddress,\n TAccountAgent,\n TAccountReputationMetrics,\n TAccountAuthorization,\n TAccountUsageRecord,\n TAccountAuthorizedSource,\n TAccountSystemProgram,\n TAccountClock\n> {\n // Program address.\n const programAddress =\n config?.programAddress ?? GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n agent: { value: input.agent ?? null, isWritable: false },\n reputationMetrics: {\n value: input.reputationMetrics ?? null,\n isWritable: true,\n },\n authorization: { value: input.authorization ?? null, isWritable: true },\n usageRecord: { value: input.usageRecord ?? null, isWritable: true },\n authorizedSource: {\n value: input.authorizedSource ?? null,\n isWritable: true,\n },\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n clock: { value: input.clock ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n \"11111111111111111111111111111111\" as Address<\"11111111111111111111111111111111\">;\n }\n if (!accounts.clock.value) {\n accounts.clock.value =\n \"SysvarC1ock11111111111111111111111111111111\" as Address<\"SysvarC1ock11111111111111111111111111111111\">;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, \"programId\");\n return Object.freeze({\n accounts: [\n getAccountMeta(accounts.agent),\n getAccountMeta(accounts.reputationMetrics),\n getAccountMeta(accounts.authorization),\n getAccountMeta(accounts.usageRecord),\n getAccountMeta(accounts.authorizedSource),\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.clock),\n ],\n data: getUpdateReputationWithAuthInstructionDataEncoder().encode(\n args as UpdateReputationWithAuthInstructionDataArgs,\n ),\n programAddress,\n } as UpdateReputationWithAuthInstruction<\n TProgramAddress,\n TAccountAgent,\n TAccountReputationMetrics,\n TAccountAuthorization,\n TAccountUsageRecord,\n TAccountAuthorizedSource,\n TAccountSystemProgram,\n TAccountClock\n >);\n}\n\nexport type ParsedUpdateReputationWithAuthInstruction<\n TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS,\n TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],\n> = {\n programAddress: Address<TProgram>;\n accounts: {\n /** Agent whose reputation is being updated */\n agent: TAccountMetas[0];\n /** Agent reputation metrics */\n reputationMetrics: TAccountMetas[1];\n /** Authorization account (PDA) */\n authorization: TAccountMetas[2];\n /** Usage record account (optional, for audit trail) */\n usageRecord: TAccountMetas[3];\n /** Authorized source (e.g., PayAI facilitator) */\n authorizedSource: TAccountMetas[4];\n /** System program */\n systemProgram: TAccountMetas[5];\n /** Clock for timestamps */\n clock: TAccountMetas[6];\n };\n data: UpdateReputationWithAuthInstructionData;\n};\n\nexport function parseUpdateReputationWithAuthInstruction<\n TProgram extends string,\n TAccountMetas extends readonly AccountMeta[],\n>(\n instruction: Instruction<TProgram> &\n InstructionWithAccounts<TAccountMetas> &\n InstructionWithData<ReadonlyUint8Array>,\n): ParsedUpdateReputationWithAuthInstruction<TProgram, TAccountMetas> {\n if (instruction.accounts.length < 7) {\n // TODO: Coded error.\n throw new Error(\"Not enough accounts\");\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n agent: getNextAccount(),\n reputationMetrics: getNextAccount(),\n authorization: getNextAccount(),\n usageRecord: getNextAccount(),\n authorizedSource: getNextAccount(),\n systemProgram: getNextAccount(),\n clock: getNextAccount(),\n },\n data: getUpdateReputationWithAuthInstructionDataDecoder().decode(\n instruction.data,\n ),\n };\n}\n"]}
@@ -0,0 +1,125 @@
1
+ // src/utils/batch-operations.ts
2
+ var MAX_ACCOUNTS_PER_BATCH = 100;
3
+ function chunkArray(array, size) {
4
+ const chunks = [];
5
+ for (let i = 0; i < array.length; i += size) {
6
+ chunks.push(array.slice(i, i + size));
7
+ }
8
+ return chunks;
9
+ }
10
+ async function batchGetAccounts(rpc, addresses, config = {}) {
11
+ const batchSize = Math.min(
12
+ config.batchSize ?? MAX_ACCOUNTS_PER_BATCH,
13
+ MAX_ACCOUNTS_PER_BATCH
14
+ );
15
+ if (addresses.length === 0) return [];
16
+ if (addresses.length <= batchSize) {
17
+ const result = await rpc.getMultipleAccounts(addresses).send();
18
+ return result.value;
19
+ }
20
+ const batches = chunkArray(addresses, batchSize);
21
+ const results = [];
22
+ let completed = 0;
23
+ const batchPromises = batches.map(async (batch) => {
24
+ const result = await rpc.getMultipleAccounts(batch).send();
25
+ completed += batch.length;
26
+ config.onProgress?.(completed, addresses.length);
27
+ return result.value;
28
+ });
29
+ results.push(...await Promise.all(batchPromises));
30
+ return results.flat();
31
+ }
32
+ async function batchGetExistingAccounts(rpc, addresses, config = {}) {
33
+ const accounts = await batchGetAccounts(rpc, addresses, config);
34
+ const existing = [];
35
+ for (let i = 0; i < accounts.length; i++) {
36
+ const account = accounts[i];
37
+ if (account !== null) {
38
+ existing.push({
39
+ address: addresses[i],
40
+ account
41
+ });
42
+ }
43
+ }
44
+ return existing;
45
+ }
46
+ async function batchGetAndMap(rpc, addresses, mapper, config = {}) {
47
+ const accounts = await batchGetAccounts(rpc, addresses, config);
48
+ return accounts.map(
49
+ (account, index) => mapper(account, addresses[index], index)
50
+ );
51
+ }
52
+ async function batchGetAccountsWithRetry(rpc, addresses, config = {}, maxRetries = 3) {
53
+ const batchSize = Math.min(
54
+ config.batchSize ?? MAX_ACCOUNTS_PER_BATCH,
55
+ MAX_ACCOUNTS_PER_BATCH
56
+ );
57
+ if (addresses.length === 0) return [];
58
+ const batches = chunkArray(addresses, batchSize);
59
+ const results = new Array(addresses.length);
60
+ let completed = 0;
61
+ await Promise.all(
62
+ batches.map(async (batch, batchIndex) => {
63
+ let retries = 0;
64
+ let success = false;
65
+ while (!success && retries <= maxRetries) {
66
+ try {
67
+ const result = await rpc.getMultipleAccounts(batch).send();
68
+ const batchResults = result.value;
69
+ batchResults.forEach((account, i) => {
70
+ results[batchIndex * batchSize + i] = account;
71
+ });
72
+ completed += batch.length;
73
+ config.onProgress?.(completed, addresses.length);
74
+ success = true;
75
+ } catch (error) {
76
+ retries++;
77
+ if (retries > maxRetries) {
78
+ throw new Error(
79
+ `Batch ${batchIndex} failed after ${maxRetries} retries: ${error}`
80
+ );
81
+ }
82
+ await new Promise(
83
+ (resolve) => setTimeout(resolve, 100 * Math.pow(2, retries - 1))
84
+ );
85
+ }
86
+ }
87
+ })
88
+ );
89
+ return results;
90
+ }
91
+ function createBatchFetcher(rpc, defaultConfig = {}) {
92
+ return {
93
+ /**
94
+ * Fetch multiple accounts
95
+ */
96
+ getAccounts: (addresses, config) => batchGetAccounts(rpc, addresses, { ...defaultConfig, ...config }),
97
+ /**
98
+ * Fetch only existing accounts
99
+ */
100
+ getExisting: (addresses, config) => batchGetExistingAccounts(rpc, addresses, {
101
+ ...defaultConfig,
102
+ ...config
103
+ }),
104
+ /**
105
+ * Fetch and map accounts
106
+ */
107
+ getAndMap: (addresses, mapper, config) => batchGetAndMap(rpc, addresses, mapper, {
108
+ ...defaultConfig,
109
+ ...config
110
+ }),
111
+ /**
112
+ * Fetch with retry logic
113
+ */
114
+ getWithRetry: (addresses, config, maxRetries) => batchGetAccountsWithRetry(
115
+ rpc,
116
+ addresses,
117
+ { ...defaultConfig, ...config },
118
+ maxRetries
119
+ )
120
+ };
121
+ }
122
+
123
+ export { batchGetAccounts, batchGetAccountsWithRetry, batchGetAndMap, batchGetExistingAccounts, createBatchFetcher };
124
+ //# sourceMappingURL=chunk-SKMJJ3Q6.js.map
125
+ //# sourceMappingURL=chunk-SKMJJ3Q6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/batch-operations.ts"],"names":[],"mappings":";AAgBA,IAAM,sBAAA,GAAyB,GAAA;AAwB/B,SAAS,UAAA,CAAc,OAAY,IAAA,EAAqB;AACtD,EAAA,MAAM,SAAgB,EAAC;AACvB,EAAA,KAAA,IAAS,IAAI,CAAA,EAAG,CAAA,GAAI,KAAA,CAAM,MAAA,EAAQ,KAAK,IAAA,EAAM;AAC3C,IAAA,MAAA,CAAO,KAAK,KAAA,CAAM,KAAA,CAAM,CAAA,EAAG,CAAA,GAAI,IAAI,CAAC,CAAA;AAAA,EACtC;AACA,EAAA,OAAO,MAAA;AACT;AAqCA,eAAsB,gBAAA,CACpB,GAAA,EACA,SAAA,EACA,MAAA,GAA2B,EAAC,EACL;AACvB,EAAA,MAAM,YAAY,IAAA,CAAK,GAAA;AAAA,IACrB,OAAO,SAAA,IAAa,sBAAA;AAAA,IACpB;AAAA,GACF;AAEA,EAAA,IAAI,SAAA,CAAU,MAAA,KAAW,CAAA,EAAG,OAAO,EAAC;AAGpC,EAAA,IAAI,SAAA,CAAU,UAAU,SAAA,EAAW;AACjC,IAAA,MAAM,SAAS,MAAM,GAAA,CAAI,mBAAA,CAAoB,SAAS,EAAE,IAAA,EAAK;AAC7D,IAAA,OAAO,MAAA,CAAO,KAAA;AAAA,EAChB;AAGA,EAAA,MAAM,OAAA,GAAU,UAAA,CAAW,SAAA,EAAW,SAAS,CAAA;AAC/C,EAAA,MAAM,UAA0B,EAAC;AACjC,EAAA,IAAI,SAAA,GAAY,CAAA;AAGhB,EAAA,MAAM,aAAA,GAAgB,OAAA,CAAQ,GAAA,CAAI,OAAO,KAAA,KAAU;AACjD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,UAAU,CAAA,cAAA,EAAiB,UAAU,aAAa,KAAK,CAAA;AAAA,aAClE;AAAA,UACF;AAGA,UAAA,MAAM,IAAI,OAAA;AAAA,YAAQ,CAAC,OAAA,KACjB,UAAA,CAAW,OAAA,EAAS,GAAA,GAAM,KAAK,GAAA,CAAI,CAAA,EAAG,OAAA,GAAU,CAAC,CAAC;AAAA,WACpD;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,GACH;AAEA,EAAA,OAAO,OAAA;AACT;AAsBO,SAAS,kBAAA,CACd,GAAA,EACA,aAAA,GAAkC,EAAC,EACnC;AACA,EAAA,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,WAAA,EAAa,CACX,SAAA,EACA,MAAA,KACG,gBAAA,CAAoB,GAAA,EAAK,SAAA,EAAW,EAAE,GAAG,aAAA,EAAe,GAAG,MAAA,EAAQ,CAAA;AAAA;AAAA;AAAA;AAAA,IAKxE,aAAa,CACX,SAAA,EACA,MAAA,KAEA,wBAAA,CAA4B,KAAK,SAAA,EAAW;AAAA,MAC1C,GAAG,aAAA;AAAA,MACH,GAAG;AAAA,KACJ,CAAA;AAAA;AAAA;AAAA;AAAA,IAKH,SAAA,EAAW,CACT,SAAA,EACA,MAAA,EACA,WAEA,cAAA,CAAqB,GAAA,EAAK,WAAW,MAAA,EAAQ;AAAA,MAC3C,GAAG,aAAA;AAAA,MACH,GAAG;AAAA,KACJ,CAAA;AAAA;AAAA;AAAA;AAAA,IAKH,YAAA,EAAc,CACZ,SAAA,EACA,MAAA,EACA,UAAA,KAEA,yBAAA;AAAA,MACE,GAAA;AAAA,MACA,SAAA;AAAA,MACA,EAAE,GAAG,aAAA,EAAe,GAAG,MAAA,EAAO;AAAA,MAC9B;AAAA;AACF,GACJ;AACF","file":"chunk-SKMJJ3Q6.js","sourcesContent":["/**\n * Batch Operations - Efficient multi-account fetching\n *\n * Utilities for batching RPC calls to reduce network overhead.\n * Uses Solana's getMultipleAccounts with 100-account limit.\n *\n * @module batch-operations\n */\n\nimport type { Address } from '@solana/addresses'\nimport type { ExtendedRpcApi } from '../types/index.js'\n\n/**\n * Maximum accounts per getMultipleAccounts call\n * Solana RPC limit is 100 accounts\n */\nconst MAX_ACCOUNTS_PER_BATCH = 100\n\n/**\n * Batch progress callback\n */\nexport type BatchProgressCallback = (completed: number, total: number) => void\n\n/**\n * Batch fetch configuration\n */\nexport interface BatchFetchConfig {\n /** Progress callback for large batches */\n onProgress?: BatchProgressCallback\n /** Batch size (default: 100, max: 100) */\n batchSize?: number\n}\n\n/**\n * Chunk array into smaller batches\n *\n * @param array - Array to chunk\n * @param size - Chunk size (max 100 for RPC calls)\n * @returns Array of chunks\n */\nfunction chunkArray<T>(array: T[], size: number): T[][] {\n const chunks: T[][] = []\n for (let i = 0; i < array.length; i += size) {\n chunks.push(array.slice(i, i + size))\n }\n return chunks\n}\n\n/**\n * Account data type (simplified for RPC returns)\n */\nexport interface AccountData {\n data: Uint8Array | null\n executable: boolean\n lamports: bigint\n owner: Address\n rentEpoch: bigint\n}\n\n/**\n * Batch fetch multiple accounts with automatic chunking\n *\n * Features:\n * - Automatic batching (100 accounts per RPC call)\n * - Parallel batch execution\n * - Progress callback support\n * - Preserves order\n *\n * @param rpc - RPC client\n * @param addresses - Account addresses to fetch\n * @param config - Batch configuration\n * @returns Array of accounts (in same order as input)\n *\n * @example\n * ```typescript\n * const addresses = [...1000 agent addresses...]\n * const accounts = await batchGetAccounts(rpc, addresses, {\n * onProgress: (completed, total) => {\n * console.log(`Fetched ${completed}/${total} accounts`)\n * }\n * })\n * ```\n */\nexport async function batchGetAccounts<T>(\n rpc: ExtendedRpcApi,\n addresses: Address[],\n config: BatchFetchConfig = {}\n): Promise<(T | null)[]> {\n const batchSize = Math.min(\n config.batchSize ?? MAX_ACCOUNTS_PER_BATCH,\n MAX_ACCOUNTS_PER_BATCH\n )\n\n if (addresses.length === 0) return []\n\n // Single batch optimization\n if (addresses.length <= batchSize) {\n const result = await rpc.getMultipleAccounts(addresses).send()\n return result.value as (T | null)[]\n }\n\n // Chunk addresses into batches\n const batches = chunkArray(addresses, batchSize)\n const results: (T | null)[][] = []\n let completed = 0\n\n // Execute all batches in parallel\n const batchPromises = batches.map(async (batch) => {\n const result = await rpc.getMultipleAccounts(batch).send()\n completed += batch.length\n config.onProgress?.(completed, addresses.length)\n return result.value as (T | null)[]\n })\n\n results.push(...(await Promise.all(batchPromises)))\n\n // Flatten results while preserving order\n return results.flat()\n}\n\n/**\n * Batch fetch with filtering (only non-null accounts)\n *\n * Useful when you expect some addresses to not exist.\n *\n * @param rpc - RPC client\n * @param addresses - Account addresses to fetch\n * @param config - Batch configuration\n * @returns Array of non-null accounts with their addresses\n *\n * @example\n * ```typescript\n * const addresses = [...agent addresses...]\n * const existing = await batchGetExistingAccounts(rpc, addresses)\n * // Returns only accounts that exist: [{ address, account }, ...]\n * ```\n */\nexport async function batchGetExistingAccounts<T>(\n rpc: ExtendedRpcApi,\n addresses: Address[],\n config: BatchFetchConfig = {}\n): Promise<Array<{ address: Address; account: T }>> {\n const accounts = await batchGetAccounts<T>(rpc, addresses, config)\n\n const existing: Array<{ address: Address; account: T }> = []\n for (let i = 0; i < accounts.length; i++) {\n const account = accounts[i]\n if (account !== null) {\n existing.push({\n address: addresses[i],\n account,\n })\n }\n }\n\n return existing\n}\n\n/**\n * Batch fetch with mapping\n *\n * Fetches accounts and immediately maps them to a transformed type.\n *\n * @param rpc - RPC client\n * @param addresses - Account addresses to fetch\n * @param mapper - Transform function (account, address, index) => result\n * @param config - Batch configuration\n * @returns Array of mapped results\n *\n * @example\n * ```typescript\n * const agentSummaries = await batchGetAndMap(\n * rpc,\n * agentAddresses,\n * (account, address) => ({\n * address,\n * name: account.data.name,\n * reputation: account.data.totalScore\n * })\n * )\n * ```\n */\nexport async function batchGetAndMap<T, R>(\n rpc: ExtendedRpcApi,\n addresses: Address[],\n mapper: (account: T | null, address: Address, index: number) => R,\n config: BatchFetchConfig = {}\n): Promise<R[]> {\n const accounts = await batchGetAccounts<T>(rpc, addresses, config)\n return accounts.map((account, index) =>\n mapper(account, addresses[index], index)\n )\n}\n\n/**\n * Batch fetch with retry logic\n *\n * Retries failed batches with exponential backoff.\n *\n * @param rpc - RPC client\n * @param addresses - Account addresses to fetch\n * @param config - Batch configuration\n * @param maxRetries - Maximum retry attempts (default: 3)\n * @returns Array of accounts\n */\nexport async function batchGetAccountsWithRetry<T>(\n rpc: ExtendedRpcApi,\n addresses: Address[],\n config: BatchFetchConfig = {},\n maxRetries = 3\n): Promise<(T | null)[]> {\n const batchSize = Math.min(\n config.batchSize ?? MAX_ACCOUNTS_PER_BATCH,\n MAX_ACCOUNTS_PER_BATCH\n )\n\n if (addresses.length === 0) return []\n\n const batches = chunkArray(addresses, batchSize)\n const results: (T | null)[] = new Array(addresses.length)\n let completed = 0\n\n // Execute batches with retry logic\n await Promise.all(\n batches.map(async (batch, batchIndex) => {\n let retries = 0\n let success = false\n\n while (!success && retries <= maxRetries) {\n try {\n const result = await rpc.getMultipleAccounts(batch).send()\n const batchResults = result.value as (T | null)[]\n\n // Insert results at correct indices\n batchResults.forEach((account, i) => {\n results[batchIndex * batchSize + i] = account\n })\n\n completed += batch.length\n config.onProgress?.(completed, addresses.length)\n success = true\n } catch (error) {\n retries++\n if (retries > maxRetries) {\n throw new Error(\n `Batch ${batchIndex} failed after ${maxRetries} retries: ${error}`\n )\n }\n\n // Exponential backoff: 100ms, 200ms, 400ms\n await new Promise((resolve) =>\n setTimeout(resolve, 100 * Math.pow(2, retries - 1))\n )\n }\n }\n })\n )\n\n return results\n}\n\n/**\n * Create a batch fetcher with reusable configuration\n *\n * Factory pattern for creating pre-configured batch fetchers.\n *\n * @param rpc - RPC client\n * @param defaultConfig - Default batch configuration\n * @returns Batch fetcher functions\n *\n * @example\n * ```typescript\n * const fetcher = createBatchFetcher(rpc, {\n * batchSize: 50,\n * onProgress: (c, t) => console.log(`${c}/${t}`)\n * })\n *\n * const accounts = await fetcher.getAccounts(addresses)\n * const existing = await fetcher.getExisting(addresses)\n * ```\n */\nexport function createBatchFetcher(\n rpc: ExtendedRpcApi,\n defaultConfig: BatchFetchConfig = {}\n) {\n return {\n /**\n * Fetch multiple accounts\n */\n getAccounts: <T>(\n addresses: Address[],\n config?: BatchFetchConfig\n ) => batchGetAccounts<T>(rpc, addresses, { ...defaultConfig, ...config }),\n\n /**\n * Fetch only existing accounts\n */\n getExisting: <T>(\n addresses: Address[],\n config?: BatchFetchConfig\n ) =>\n batchGetExistingAccounts<T>(rpc, addresses, {\n ...defaultConfig,\n ...config,\n }),\n\n /**\n * Fetch and map accounts\n */\n getAndMap: <T, R>(\n addresses: Address[],\n mapper: (account: T | null, address: Address, index: number) => R,\n config?: BatchFetchConfig\n ) =>\n batchGetAndMap<T, R>(rpc, addresses, mapper, {\n ...defaultConfig,\n ...config,\n }),\n\n /**\n * Fetch with retry logic\n */\n getWithRetry: <T>(\n addresses: Address[],\n config?: BatchFetchConfig,\n maxRetries?: number\n ) =>\n batchGetAccountsWithRetry<T>(\n rpc,\n addresses,\n { ...defaultConfig, ...config },\n maxRetries\n ),\n }\n}\n"]}
@@ -0,0 +1,69 @@
1
+ import { address } from '@solana/addresses';
2
+
3
+ // src/modules/reputation/adapters/ReputationSourceAdapter.ts
4
+ var ReputationSource = /* @__PURE__ */ ((ReputationSource2) => {
5
+ ReputationSource2["PayAI"] = "payai";
6
+ ReputationSource2["DirectSolana"] = "direct-solana";
7
+ ReputationSource2["GitHub"] = "github";
8
+ ReputationSource2["Twitter"] = "twitter";
9
+ ReputationSource2["CustomWebhook"] = "custom-webhook";
10
+ ReputationSource2["OnChainHistory"] = "onchain-history";
11
+ return ReputationSource2;
12
+ })(ReputationSource || {});
13
+ var BaseReputationAdapter = class {
14
+ config;
15
+ constructor(config) {
16
+ this.config = config;
17
+ }
18
+ /**
19
+ * Default reliability calculation uses configured reliability
20
+ */
21
+ calculateReliability(_data) {
22
+ return this.config.reliability / 1e4;
23
+ }
24
+ /**
25
+ * Check if adapter is enabled
26
+ */
27
+ isEnabled() {
28
+ return this.config.enabled;
29
+ }
30
+ /**
31
+ * Get adapter weight in basis points
32
+ */
33
+ getWeight() {
34
+ return this.config.weight;
35
+ }
36
+ /**
37
+ * Validate score is in valid range (0-1000)
38
+ */
39
+ validateScoreRange(score) {
40
+ return score >= 0 && score <= 1e3;
41
+ }
42
+ /**
43
+ * Clamp score to valid range
44
+ */
45
+ clampScore(score) {
46
+ return Math.max(0, Math.min(1e3, score));
47
+ }
48
+ };
49
+ var GHOSTSPEAK_PROGRAM_ID = address("4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB");
50
+ var NETWORK_CONFIG = {
51
+ devnet: {
52
+ programId: "4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB",
53
+ rpcUrl: "https://api.devnet.solana.com"
54
+ },
55
+ testnet: {
56
+ programId: "4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB",
57
+ rpcUrl: "https://api.testnet.solana.com"
58
+ },
59
+ mainnet: {
60
+ programId: "4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB",
61
+ // TODO: Update with mainnet deployment
62
+ rpcUrl: "https://api.mainnet-beta.solana.com"
63
+ }
64
+ };
65
+ address("DFQ9ejBt1T192Xnru1J21bFq9FSU7gjRRRYJkehvpump");
66
+
67
+ export { BaseReputationAdapter, GHOSTSPEAK_PROGRAM_ID, NETWORK_CONFIG, ReputationSource };
68
+ //# sourceMappingURL=chunk-TTB4OS2D.js.map
69
+ //# sourceMappingURL=chunk-TTB4OS2D.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/modules/reputation/adapters/ReputationSourceAdapter.ts","../src/constants/ghostspeak.ts"],"names":["ReputationSource"],"mappings":";;;AAYO,IAAK,gBAAA,qBAAAA,iBAAAA,KAAL;AACL,EAAAA,kBAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,kBAAA,cAAA,CAA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ACV;AAAA,EACA,OAAA,EAAS;AAAA,IACP,SAAA,EAAW,8CAAA;AAAA;AAAA,IACX,MAAA,EAAQ;AAAA;AAEZ;AAwBgC,QAAQ,8CAA8C","file":"chunk-TTB4OS2D.js","sourcesContent":["/**\n * Reputation Source Adapter Interface\n *\n * Base interface for all reputation data sources (PayAI, GitHub, custom webhooks, etc.)\n * Each adapter normalizes external data to a standard format for aggregation.\n */\n\nimport type { Address } from '@solana/addresses'\n\n/**\n * Supported reputation sources\n */\nexport enum ReputationSource {\n PayAI = 'payai',\n DirectSolana = 'direct-solana',\n GitHub = 'github',\n Twitter = 'twitter',\n CustomWebhook = 'custom-webhook',\n OnChainHistory = 'onchain-history',\n}\n\n/**\n * Configuration for a reputation source\n */\nexport interface ReputationSourceConfig {\n /** Source identifier */\n source: ReputationSource\n /** Weight in basis points (0-10000) */\n weight: number\n /** Reliability score in basis points (0-10000) */\n reliability: number\n /** Source-specific configuration (API keys, URLs, etc.) */\n config: Record<string, any>\n /** Whether this source is enabled */\n enabled: boolean\n}\n\n/**\n * Normalized reputation data from a source\n */\nexport interface SourceReputationData {\n /** Source identifier */\n source: ReputationSource\n /** Reputation score (0-1000) */\n score: number\n /** Number of data points contributing to score */\n dataPoints: number\n /** Reliability of this data (0-1) */\n reliability: number\n /** Raw data from source (for debugging/audit) */\n rawData: any\n /** Timestamp when data was fetched */\n timestamp: Date\n}\n\n/**\n * Base interface for reputation source adapters\n */\nexport interface ReputationSourceAdapter {\n /** Source identifier */\n readonly source: ReputationSource\n\n /**\n * Fetch reputation data for an agent\n *\n * @param agentId - Agent identifier (public key or external ID)\n * @returns Normalized reputation data\n */\n fetchReputationData(agentId: string): Promise<SourceReputationData>\n\n /**\n * Validate raw data from source\n *\n * @param data - Raw data to validate\n * @returns True if data is valid\n */\n validateData(data: any): boolean\n\n /**\n * Normalize raw score to 0-1000 scale\n *\n * @param rawScore - Raw score from source\n * @returns Normalized score (0-1000)\n */\n normalizeScore(rawScore: any): number\n\n /**\n * Calculate reliability score for this data point\n *\n * @param data - Source data\n * @returns Reliability (0-1)\n */\n calculateReliability(data: any): number\n}\n\n/**\n * Abstract base class for reputation adapters\n */\nexport abstract class BaseReputationAdapter implements ReputationSourceAdapter {\n protected config: ReputationSourceConfig\n\n constructor(config: ReputationSourceConfig) {\n this.config = config\n }\n\n abstract get source(): ReputationSource\n abstract fetchReputationData(agentId: string): Promise<SourceReputationData>\n abstract validateData(data: any): boolean\n abstract normalizeScore(rawScore: any): number\n\n /**\n * Default reliability calculation uses configured reliability\n */\n calculateReliability(_data: any): number {\n return this.config.reliability / 10000 // Convert basis points to 0-1\n }\n\n /**\n * Check if adapter is enabled\n */\n isEnabled(): boolean {\n return this.config.enabled\n }\n\n /**\n * Get adapter weight in basis points\n */\n getWeight(): number {\n return this.config.weight\n }\n\n /**\n * Validate score is in valid range (0-1000)\n */\n protected validateScoreRange(score: number): boolean {\n return score >= 0 && score <= 1000\n }\n\n /**\n * Clamp score to valid range\n */\n protected clampScore(score: number): number {\n return Math.max(0, Math.min(1000, score))\n }\n}\n","/**\n * GhostSpeak Protocol Constants\n * July 2025 Implementation\n */\n\nimport { address } from '@solana/addresses'\n\n/**\n * Program ID for GhostSpeak Marketplace on Solana\n * Deployed on devnet - December 30, 2025\n * Deployment signature: 5zdU8HdtenhgwDmeEJu2ZPrQwoG9gztHHM5Ft6URxCzTj7m4y9ZkvmVKrpvMK41skcHvh8xa7ckNuUkQwPsierJr\n */\nexport const GHOSTSPEAK_PROGRAM_ID = address('4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB')\n\n/**\n * Network-specific configurations\n */\nexport const NETWORK_CONFIG = {\n devnet: {\n programId: '4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB',\n rpcUrl: 'https://api.devnet.solana.com'\n },\n testnet: {\n programId: '4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB',\n rpcUrl: 'https://api.testnet.solana.com'\n },\n mainnet: {\n programId: '4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB', // TODO: Update with mainnet deployment\n rpcUrl: 'https://api.mainnet-beta.solana.com'\n }\n} as const\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONFIG = {\n network: 'devnet' as keyof typeof NETWORK_CONFIG,\n confirmations: 1,\n timeout: 30000,\n maxRetries: 3\n} as const\n\n/**\n * GHOST Token Configuration\n * Official GhostSpeak utility token launched December 26, 2025\n * Deployed on pump.fun with immutable supply\n */\n\n/**\n * GHOST Token Mint Address (Solana Mainnet)\n * - Mint Authority: REVOKED (immutable supply)\n * - Freeze Authority: REVOKED (decentralized)\n * - Supply: ~999.75M GHOST (fixed)\n */\nexport const GHOST_TOKEN_MINT = address('DFQ9ejBt1T192Xnru1J21bFq9FSU7gjRRRYJkehvpump')\n\n/**\n * GHOST Token Metadata\n */\nexport const GHOST_TOKEN_CONFIG = {\n /** Token mint address */\n mint: GHOST_TOKEN_MINT,\n /** Token symbol */\n symbol: 'GHOST',\n /** Token name */\n name: 'Ghostspeak',\n /** Token decimals (1 GHOST = 1_000_000 lamports) */\n decimals: 6,\n /** Total supply in lamports */\n supplyLamports: 999753007258579n,\n /** Total supply in tokens */\n supplyTokens: 999753007.258579,\n /** Mint authority (null = immutable) */\n mintAuthority: null,\n /** Freeze authority (null = decentralized) */\n freezeAuthority: null,\n /** Primary DEX pair */\n dexPair: 'https://dexscreener.com/solana/e44xj7jyjxyermlqqwrpu4nekcphawfjf3ppn2uokgdb',\n /** Launch date */\n launchedAt: new Date('2025-12-26'),\n} as const\n\n/**\n * Staking Tier Requirements (in GHOST tokens with 6 decimals)\n */\nexport const STAKING_TIERS = {\n /** Basic Staker: 1,000 GHOST */\n BASIC: {\n name: 'Basic Staker',\n required: 1_000_000_000_000n, // 1,000 GHOST (6 decimals)\n multiplier: 1.0,\n benefits: [\n 'Proportional revenue share',\n 'Vote on protocol parameters',\n 'Public staking dashboard access'\n ]\n },\n /** Verified Staker: 5,000 GHOST */\n VERIFIED: {\n name: 'Verified Staker',\n required: 5_000_000_000_000n, // 5,000 GHOST (6 decimals)\n multiplier: 1.5,\n benefits: [\n 'All Basic benefits',\n 'Unlimited agent verifications',\n '\"Verified Reviewer\" badge (2x review weight)',\n 'Early feature access'\n ]\n },\n /** Pro Staker: 50,000 GHOST */\n PRO: {\n name: 'Pro Staker',\n required: 50_000_000_000_000n, // 50,000 GHOST (6 decimals)\n multiplier: 2.0,\n benefits: [\n 'All Verified benefits',\n 'API access (100K requests/month)',\n 'Webhook notifications',\n 'Priority support',\n 'Governance voting power (2x)'\n ]\n },\n /** Whale Staker: 500,000 GHOST */\n WHALE: {\n name: 'Whale Staker',\n required: 500_000_000_000_000n, // 500,000 GHOST (6 decimals)\n multiplier: 3.0,\n benefits: [\n 'All Pro benefits',\n 'Unlimited API requests',\n 'White-label options',\n 'Direct line to core team',\n 'Protocol fee discounts (20%)'\n ]\n }\n} as const\n\n/**\n * Payment Options with GHOST Burning\n */\nexport const PAYMENT_OPTIONS = {\n /** Standard USDC payment */\n USDC: {\n amount: 1_000_000n, // 1 USDC (6 decimals)\n token: 'USDC',\n discount: 0\n },\n /** Burn GHOST for 25% discount */\n GHOST_BURN: {\n amount: 75_000_000n, // 75 GHOST (6 decimals)\n token: 'GHOST',\n discount: 0.25, // 25% discount (equivalent to 1 USDC)\n note: 'Tokens are permanently burned (deflationary)'\n }\n} as const"]}
@@ -0,0 +1,33 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
6
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
7
+ }) : x)(function(x) {
8
+ if (typeof require !== "undefined") return require.apply(this, arguments);
9
+ throw Error('Dynamic require of "' + x + '" is not supported');
10
+ });
11
+ var __esm = (fn, res) => function __init() {
12
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
+ };
14
+ var __commonJS = (cb, mod) => function __require2() {
15
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
+ };
17
+ var __export = (target, all) => {
18
+ for (var name in all)
19
+ __defProp(target, name, { get: all[name], enumerable: true });
20
+ };
21
+ var __copyProps = (to, from, except, desc) => {
22
+ if (from && typeof from === "object" || typeof from === "function") {
23
+ for (let key of __getOwnPropNames(from))
24
+ if (!__hasOwnProp.call(to, key) && key !== except)
25
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
+ }
27
+ return to;
28
+ };
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ export { __commonJS, __esm, __export, __require, __toCommonJS };
32
+ //# sourceMappingURL=chunk-UP2VWCW5.js.map
33
+ //# sourceMappingURL=chunk-UP2VWCW5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-NSBPE2FW.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-UP2VWCW5.js"}
@@ -1,4 +1,4 @@
1
- import { __export } from './chunk-NSBPE2FW.js';
1
+ import { __export } from './chunk-UP2VWCW5.js';
2
2
  import { ed25519 } from '@noble/curves/ed25519';
3
3
  import { sha256 } from '@noble/hashes/sha256';
4
4
  import { randomBytes, bytesToNumberLE, numberToBytesBE } from '@noble/curves/abstract/utils';
@@ -512,7 +512,7 @@ async function loadWasmModule() {
512
512
  try {
513
513
  let wasmModule2;
514
514
  try {
515
- wasmModule2 = await import('./ghostspeak_wasm-SB2RPJ3D.js');
515
+ wasmModule2 = await import('./ghostspeak_wasm-F227HOSM.js');
516
516
  } catch {
517
517
  throw new Error("WASM module not built");
518
518
  }
@@ -565,7 +565,7 @@ async function loadWasmModuleInternal() {
565
565
  try {
566
566
  let wasmImport;
567
567
  try {
568
- wasmImport = await import('./ghostspeak_wasm-SB2RPJ3D.js');
568
+ wasmImport = await import('./ghostspeak_wasm-F227HOSM.js');
569
569
  } catch {
570
570
  throw new Error("WASM module not built");
571
571
  }
@@ -651,5 +651,5 @@ var wasm_bridge_default = {
651
651
  };
652
652
 
653
653
  export { decrypt, elgamal_exports, encrypt, generateKeypair, generateTransferProof, generateWithdrawProof, isWasmAvailable, loadWasmModule2 as loadWasmModule, wasm_bridge_exports };
654
- //# sourceMappingURL=chunk-UJUGGLMT.js.map
655
- //# sourceMappingURL=chunk-UJUGGLMT.js.map
654
+ //# sourceMappingURL=chunk-VQZQCHUT.js.map
655
+ //# sourceMappingURL=chunk-VQZQCHUT.js.map