naracli 1.0.40 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nara-cli-bundle.cjs +879 -479
- package/package.json +2 -2
package/dist/nara-cli-bundle.cjs
CHANGED
|
@@ -24702,7 +24702,7 @@ var require_index_cjs = __commonJS({
|
|
|
24702
24702
|
return value._bn !== void 0;
|
|
24703
24703
|
}
|
|
24704
24704
|
var uniquePublicKeyCounter = 1;
|
|
24705
|
-
var
|
|
24705
|
+
var PublicKey30 = class _PublicKey2 extends Struct {
|
|
24706
24706
|
/**
|
|
24707
24707
|
* Create a new PublicKey object
|
|
24708
24708
|
* @param value ed25519 public key as buffer or base-58 encoded string
|
|
@@ -24864,9 +24864,9 @@ var require_index_cjs = __commonJS({
|
|
|
24864
24864
|
return isOnCurve(pubkey.toBytes());
|
|
24865
24865
|
}
|
|
24866
24866
|
};
|
|
24867
|
-
_PublicKey =
|
|
24868
|
-
|
|
24869
|
-
SOLANA_SCHEMA.set(
|
|
24867
|
+
_PublicKey = PublicKey30;
|
|
24868
|
+
PublicKey30.default = new _PublicKey("11111111111111111111111111111111");
|
|
24869
|
+
SOLANA_SCHEMA.set(PublicKey30, {
|
|
24870
24870
|
kind: "struct",
|
|
24871
24871
|
fields: [["_bn", "u256"]]
|
|
24872
24872
|
});
|
|
@@ -24898,7 +24898,7 @@ var require_index_cjs = __commonJS({
|
|
|
24898
24898
|
* The public key for this account
|
|
24899
24899
|
*/
|
|
24900
24900
|
get publicKey() {
|
|
24901
|
-
return new
|
|
24901
|
+
return new PublicKey30(this._publicKey);
|
|
24902
24902
|
}
|
|
24903
24903
|
/**
|
|
24904
24904
|
* The **unencrypted** secret key for this account. The first 32 bytes
|
|
@@ -24909,7 +24909,7 @@ var require_index_cjs = __commonJS({
|
|
|
24909
24909
|
return buffer.Buffer.concat([this._secretKey, this._publicKey], 64);
|
|
24910
24910
|
}
|
|
24911
24911
|
};
|
|
24912
|
-
var BPF_LOADER_DEPRECATED_PROGRAM_ID = new
|
|
24912
|
+
var BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey30("BPFLoader1111111111111111111111111111111111");
|
|
24913
24913
|
var PACKET_DATA_SIZE = 1280 - 40 - 8;
|
|
24914
24914
|
var VERSION_PREFIX_MASK = 127;
|
|
24915
24915
|
var SIGNATURE_LENGTH_IN_BYTES = 64;
|
|
@@ -25140,7 +25140,7 @@ var require_index_cjs = __commonJS({
|
|
|
25140
25140
|
const [payerAddress] = writableSigners[0];
|
|
25141
25141
|
assert(payerAddress === this.payer.toBase58(), "Expected first writable signer key to be the fee payer");
|
|
25142
25142
|
}
|
|
25143
|
-
const staticAccountKeys = [...writableSigners.map(([address]) => new
|
|
25143
|
+
const staticAccountKeys = [...writableSigners.map(([address]) => new PublicKey30(address)), ...readonlySigners.map(([address]) => new PublicKey30(address)), ...writableNonSigners.map(([address]) => new PublicKey30(address)), ...readonlyNonSigners.map(([address]) => new PublicKey30(address))];
|
|
25144
25144
|
return [header, staticAccountKeys];
|
|
25145
25145
|
}
|
|
25146
25146
|
extractTableLookup(lookupTable) {
|
|
@@ -25164,7 +25164,7 @@ var require_index_cjs = __commonJS({
|
|
|
25164
25164
|
const drainedKeys = new Array();
|
|
25165
25165
|
for (const [address, keyMeta] of this.keyMetaMap.entries()) {
|
|
25166
25166
|
if (keyMetaFilter(keyMeta)) {
|
|
25167
|
-
const key = new
|
|
25167
|
+
const key = new PublicKey30(address);
|
|
25168
25168
|
const lookupTableIndex = lookupTableEntries.findIndex((entry) => entry.equals(key));
|
|
25169
25169
|
if (lookupTableIndex >= 0) {
|
|
25170
25170
|
assert(lookupTableIndex < 256, "Max lookup table index exceeded");
|
|
@@ -25199,7 +25199,7 @@ var require_index_cjs = __commonJS({
|
|
|
25199
25199
|
this.instructions = void 0;
|
|
25200
25200
|
this.indexToProgramIds = /* @__PURE__ */ new Map();
|
|
25201
25201
|
this.header = args.header;
|
|
25202
|
-
this.accountKeys = args.accountKeys.map((account) => new
|
|
25202
|
+
this.accountKeys = args.accountKeys.map((account) => new PublicKey30(account));
|
|
25203
25203
|
this.recentBlockhash = args.recentBlockhash;
|
|
25204
25204
|
this.instructions = args.instructions;
|
|
25205
25205
|
this.instructions.forEach((ix) => this.indexToProgramIds.set(ix.programIdIndex, this.accountKeys[ix.programIdIndex]));
|
|
@@ -25325,7 +25325,7 @@ var require_index_cjs = __commonJS({
|
|
|
25325
25325
|
let accountKeys = [];
|
|
25326
25326
|
for (let i = 0; i < accountCount; i++) {
|
|
25327
25327
|
const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2);
|
|
25328
|
-
accountKeys.push(new
|
|
25328
|
+
accountKeys.push(new PublicKey30(buffer.Buffer.from(account)));
|
|
25329
25329
|
}
|
|
25330
25330
|
const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2);
|
|
25331
25331
|
const instructionCount = decodeLength(byteArray);
|
|
@@ -25549,7 +25549,7 @@ var require_index_cjs = __commonJS({
|
|
|
25549
25549
|
const staticAccountKeys = [];
|
|
25550
25550
|
const staticAccountKeysLength = decodeLength(byteArray);
|
|
25551
25551
|
for (let i = 0; i < staticAccountKeysLength; i++) {
|
|
25552
|
-
staticAccountKeys.push(new
|
|
25552
|
+
staticAccountKeys.push(new PublicKey30(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2)));
|
|
25553
25553
|
}
|
|
25554
25554
|
const recentBlockhash = bs58__default.default.encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
25555
25555
|
const instructionCount = decodeLength(byteArray);
|
|
@@ -25569,7 +25569,7 @@ var require_index_cjs = __commonJS({
|
|
|
25569
25569
|
const addressTableLookupsCount = decodeLength(byteArray);
|
|
25570
25570
|
const addressTableLookups = [];
|
|
25571
25571
|
for (let i = 0; i < addressTableLookupsCount; i++) {
|
|
25572
|
-
const accountKey = new
|
|
25572
|
+
const accountKey = new PublicKey30(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
25573
25573
|
const writableIndexesLength = decodeLength(byteArray);
|
|
25574
25574
|
const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength);
|
|
25575
25575
|
const readonlyIndexesLength = decodeLength(byteArray);
|
|
@@ -25618,7 +25618,7 @@ var require_index_cjs = __commonJS({
|
|
|
25618
25618
|
return TransactionStatus2;
|
|
25619
25619
|
}({});
|
|
25620
25620
|
var DEFAULT_SIGNATURE = buffer.Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);
|
|
25621
|
-
var
|
|
25621
|
+
var TransactionInstruction44 = class {
|
|
25622
25622
|
constructor(opts) {
|
|
25623
25623
|
this.keys = void 0;
|
|
25624
25624
|
this.programId = void 0;
|
|
@@ -25750,7 +25750,7 @@ var require_index_cjs = __commonJS({
|
|
|
25750
25750
|
} else if ("data" in item && "programId" in item && "keys" in item) {
|
|
25751
25751
|
this.instructions.push(item);
|
|
25752
25752
|
} else {
|
|
25753
|
-
this.instructions.push(new
|
|
25753
|
+
this.instructions.push(new TransactionInstruction44(item));
|
|
25754
25754
|
}
|
|
25755
25755
|
});
|
|
25756
25756
|
return this;
|
|
@@ -25809,7 +25809,7 @@ var require_index_cjs = __commonJS({
|
|
|
25809
25809
|
});
|
|
25810
25810
|
programIds.forEach((programId) => {
|
|
25811
25811
|
accountMetas.push({
|
|
25812
|
-
pubkey: new
|
|
25812
|
+
pubkey: new PublicKey30(programId),
|
|
25813
25813
|
isSigner: false,
|
|
25814
25814
|
isWritable: false
|
|
25815
25815
|
});
|
|
@@ -26243,7 +26243,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
26243
26243
|
isWritable: message.isAccountWritable(account)
|
|
26244
26244
|
};
|
|
26245
26245
|
});
|
|
26246
|
-
transaction.instructions.push(new
|
|
26246
|
+
transaction.instructions.push(new TransactionInstruction44({
|
|
26247
26247
|
keys,
|
|
26248
26248
|
programId: message.accountKeys[instruction.programIdIndex],
|
|
26249
26249
|
data: bs58__default.default.decode(instruction.data)
|
|
@@ -26254,7 +26254,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
26254
26254
|
return transaction;
|
|
26255
26255
|
}
|
|
26256
26256
|
};
|
|
26257
|
-
var
|
|
26257
|
+
var TransactionMessage2 = class _TransactionMessage {
|
|
26258
26258
|
constructor(args) {
|
|
26259
26259
|
this.payerKey = void 0;
|
|
26260
26260
|
this.instructions = void 0;
|
|
@@ -26311,7 +26311,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
26311
26311
|
if (programId === void 0) {
|
|
26312
26312
|
throw new Error(`Failed to find program id for program id index ${compiledIx.programIdIndex}`);
|
|
26313
26313
|
}
|
|
26314
|
-
instructions.push(new
|
|
26314
|
+
instructions.push(new TransactionInstruction44({
|
|
26315
26315
|
programId,
|
|
26316
26316
|
data: toBuffer(compiledIx.data),
|
|
26317
26317
|
keys
|
|
@@ -26339,7 +26339,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
26339
26339
|
});
|
|
26340
26340
|
}
|
|
26341
26341
|
};
|
|
26342
|
-
var
|
|
26342
|
+
var VersionedTransaction4 = class _VersionedTransaction {
|
|
26343
26343
|
get version() {
|
|
26344
26344
|
return this.message.version;
|
|
26345
26345
|
}
|
|
@@ -26402,15 +26402,15 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
26402
26402
|
var DEFAULT_TICKS_PER_SLOT = 64;
|
|
26403
26403
|
var NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
|
|
26404
26404
|
var MS_PER_SLOT = 1e3 / NUM_SLOTS_PER_SECOND;
|
|
26405
|
-
var SYSVAR_CLOCK_PUBKEY2 = new
|
|
26406
|
-
var SYSVAR_EPOCH_SCHEDULE_PUBKEY = new
|
|
26407
|
-
var SYSVAR_INSTRUCTIONS_PUBKEY2 = new
|
|
26408
|
-
var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new
|
|
26409
|
-
var SYSVAR_RENT_PUBKEY5 = new
|
|
26410
|
-
var SYSVAR_REWARDS_PUBKEY = new
|
|
26411
|
-
var SYSVAR_SLOT_HASHES_PUBKEY = new
|
|
26412
|
-
var SYSVAR_SLOT_HISTORY_PUBKEY = new
|
|
26413
|
-
var SYSVAR_STAKE_HISTORY_PUBKEY = new
|
|
26405
|
+
var SYSVAR_CLOCK_PUBKEY2 = new PublicKey30("SysvarC1ock11111111111111111111111111111111");
|
|
26406
|
+
var SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey30("SysvarEpochSchedu1e111111111111111111111111");
|
|
26407
|
+
var SYSVAR_INSTRUCTIONS_PUBKEY2 = new PublicKey30("Sysvar1nstructions1111111111111111111111111");
|
|
26408
|
+
var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new PublicKey30("SysvarRecentB1ockHashes11111111111111111111");
|
|
26409
|
+
var SYSVAR_RENT_PUBKEY5 = new PublicKey30("SysvarRent111111111111111111111111111111111");
|
|
26410
|
+
var SYSVAR_REWARDS_PUBKEY = new PublicKey30("SysvarRewards111111111111111111111111111111");
|
|
26411
|
+
var SYSVAR_SLOT_HASHES_PUBKEY = new PublicKey30("SysvarS1otHashes111111111111111111111111111");
|
|
26412
|
+
var SYSVAR_SLOT_HISTORY_PUBKEY = new PublicKey30("SysvarS1otHistory11111111111111111111111111");
|
|
26413
|
+
var SYSVAR_STAKE_HISTORY_PUBKEY = new PublicKey30("SysvarStakeHistory1111111111111111111111111");
|
|
26414
26414
|
var SendTransactionError = class extends Error {
|
|
26415
26415
|
constructor({
|
|
26416
26416
|
action,
|
|
@@ -26601,8 +26601,8 @@ Message: ${transactionMessage}.
|
|
|
26601
26601
|
static fromAccountData(buffer2) {
|
|
26602
26602
|
const nonceAccount = NonceAccountLayout.decode(toBuffer(buffer2), 0);
|
|
26603
26603
|
return new _NonceAccount({
|
|
26604
|
-
authorizedPubkey: new
|
|
26605
|
-
nonce: new
|
|
26604
|
+
authorizedPubkey: new PublicKey30(nonceAccount.authorizedPubkey),
|
|
26605
|
+
nonce: new PublicKey30(nonceAccount.nonce).toString(),
|
|
26606
26606
|
feeCalculator: nonceAccount.feeCalculator
|
|
26607
26607
|
});
|
|
26608
26608
|
}
|
|
@@ -26664,7 +26664,7 @@ Message: ${transactionMessage}.
|
|
|
26664
26664
|
newAccountPubkey: instruction.keys[1].pubkey,
|
|
26665
26665
|
lamports,
|
|
26666
26666
|
space,
|
|
26667
|
-
programId: new
|
|
26667
|
+
programId: new PublicKey30(programId)
|
|
26668
26668
|
};
|
|
26669
26669
|
}
|
|
26670
26670
|
/**
|
|
@@ -26699,7 +26699,7 @@ Message: ${transactionMessage}.
|
|
|
26699
26699
|
toPubkey: instruction.keys[2].pubkey,
|
|
26700
26700
|
lamports,
|
|
26701
26701
|
seed,
|
|
26702
|
-
programId: new
|
|
26702
|
+
programId: new PublicKey30(programId)
|
|
26703
26703
|
};
|
|
26704
26704
|
}
|
|
26705
26705
|
/**
|
|
@@ -26730,10 +26730,10 @@ Message: ${transactionMessage}.
|
|
|
26730
26730
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed, instruction.data);
|
|
26731
26731
|
return {
|
|
26732
26732
|
accountPubkey: instruction.keys[0].pubkey,
|
|
26733
|
-
basePubkey: new
|
|
26733
|
+
basePubkey: new PublicKey30(base2),
|
|
26734
26734
|
seed,
|
|
26735
26735
|
space,
|
|
26736
|
-
programId: new
|
|
26736
|
+
programId: new PublicKey30(programId)
|
|
26737
26737
|
};
|
|
26738
26738
|
}
|
|
26739
26739
|
/**
|
|
@@ -26747,7 +26747,7 @@ Message: ${transactionMessage}.
|
|
|
26747
26747
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Assign, instruction.data);
|
|
26748
26748
|
return {
|
|
26749
26749
|
accountPubkey: instruction.keys[0].pubkey,
|
|
26750
|
-
programId: new
|
|
26750
|
+
programId: new PublicKey30(programId)
|
|
26751
26751
|
};
|
|
26752
26752
|
}
|
|
26753
26753
|
/**
|
|
@@ -26763,9 +26763,9 @@ Message: ${transactionMessage}.
|
|
|
26763
26763
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed, instruction.data);
|
|
26764
26764
|
return {
|
|
26765
26765
|
accountPubkey: instruction.keys[0].pubkey,
|
|
26766
|
-
basePubkey: new
|
|
26766
|
+
basePubkey: new PublicKey30(base2),
|
|
26767
26767
|
seed,
|
|
26768
|
-
programId: new
|
|
26768
|
+
programId: new PublicKey30(programId)
|
|
26769
26769
|
};
|
|
26770
26770
|
}
|
|
26771
26771
|
/**
|
|
@@ -26784,11 +26784,11 @@ Message: ${transactionMessage}.
|
|
|
26784
26784
|
return {
|
|
26785
26785
|
fromPubkey: instruction.keys[0].pubkey,
|
|
26786
26786
|
newAccountPubkey: instruction.keys[1].pubkey,
|
|
26787
|
-
basePubkey: new
|
|
26787
|
+
basePubkey: new PublicKey30(base2),
|
|
26788
26788
|
seed,
|
|
26789
26789
|
lamports,
|
|
26790
26790
|
space,
|
|
26791
|
-
programId: new
|
|
26791
|
+
programId: new PublicKey30(programId)
|
|
26792
26792
|
};
|
|
26793
26793
|
}
|
|
26794
26794
|
/**
|
|
@@ -26802,7 +26802,7 @@ Message: ${transactionMessage}.
|
|
|
26802
26802
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount, instruction.data);
|
|
26803
26803
|
return {
|
|
26804
26804
|
noncePubkey: instruction.keys[0].pubkey,
|
|
26805
|
-
authorizedPubkey: new
|
|
26805
|
+
authorizedPubkey: new PublicKey30(authorized2)
|
|
26806
26806
|
};
|
|
26807
26807
|
}
|
|
26808
26808
|
/**
|
|
@@ -26845,7 +26845,7 @@ Message: ${transactionMessage}.
|
|
|
26845
26845
|
return {
|
|
26846
26846
|
noncePubkey: instruction.keys[0].pubkey,
|
|
26847
26847
|
authorizedPubkey: instruction.keys[1].pubkey,
|
|
26848
|
-
newAuthorizedPubkey: new
|
|
26848
|
+
newAuthorizedPubkey: new PublicKey30(authorized2)
|
|
26849
26849
|
};
|
|
26850
26850
|
}
|
|
26851
26851
|
/**
|
|
@@ -26938,7 +26938,7 @@ Message: ${transactionMessage}.
|
|
|
26938
26938
|
space: params.space,
|
|
26939
26939
|
programId: toBuffer(params.programId.toBuffer())
|
|
26940
26940
|
});
|
|
26941
|
-
return new
|
|
26941
|
+
return new TransactionInstruction44({
|
|
26942
26942
|
keys: [{
|
|
26943
26943
|
pubkey: params.fromPubkey,
|
|
26944
26944
|
isSigner: true,
|
|
@@ -26993,7 +26993,7 @@ Message: ${transactionMessage}.
|
|
|
26993
26993
|
isWritable: true
|
|
26994
26994
|
}];
|
|
26995
26995
|
}
|
|
26996
|
-
return new
|
|
26996
|
+
return new TransactionInstruction44({
|
|
26997
26997
|
keys,
|
|
26998
26998
|
programId: this.programId,
|
|
26999
26999
|
data
|
|
@@ -27032,7 +27032,7 @@ Message: ${transactionMessage}.
|
|
|
27032
27032
|
isWritable: true
|
|
27033
27033
|
}];
|
|
27034
27034
|
}
|
|
27035
|
-
return new
|
|
27035
|
+
return new TransactionInstruction44({
|
|
27036
27036
|
keys,
|
|
27037
27037
|
programId: this.programId,
|
|
27038
27038
|
data
|
|
@@ -27067,7 +27067,7 @@ Message: ${transactionMessage}.
|
|
|
27067
27067
|
isWritable: false
|
|
27068
27068
|
});
|
|
27069
27069
|
}
|
|
27070
|
-
return new
|
|
27070
|
+
return new TransactionInstruction44({
|
|
27071
27071
|
keys,
|
|
27072
27072
|
programId: this.programId,
|
|
27073
27073
|
data
|
|
@@ -27129,7 +27129,7 @@ Message: ${transactionMessage}.
|
|
|
27129
27129
|
programId: this.programId,
|
|
27130
27130
|
data
|
|
27131
27131
|
};
|
|
27132
|
-
return new
|
|
27132
|
+
return new TransactionInstruction44(instructionData);
|
|
27133
27133
|
}
|
|
27134
27134
|
/**
|
|
27135
27135
|
* Generate an instruction to advance the nonce in a Nonce account
|
|
@@ -27154,7 +27154,7 @@ Message: ${transactionMessage}.
|
|
|
27154
27154
|
programId: this.programId,
|
|
27155
27155
|
data
|
|
27156
27156
|
};
|
|
27157
|
-
return new
|
|
27157
|
+
return new TransactionInstruction44(instructionData);
|
|
27158
27158
|
}
|
|
27159
27159
|
/**
|
|
27160
27160
|
* Generate a transaction instruction that withdraws lamports from a Nonce account
|
|
@@ -27164,7 +27164,7 @@ Message: ${transactionMessage}.
|
|
|
27164
27164
|
const data = encodeData(type, {
|
|
27165
27165
|
lamports: params.lamports
|
|
27166
27166
|
});
|
|
27167
|
-
return new
|
|
27167
|
+
return new TransactionInstruction44({
|
|
27168
27168
|
keys: [{
|
|
27169
27169
|
pubkey: params.noncePubkey,
|
|
27170
27170
|
isSigner: false,
|
|
@@ -27199,7 +27199,7 @@ Message: ${transactionMessage}.
|
|
|
27199
27199
|
const data = encodeData(type, {
|
|
27200
27200
|
authorized: toBuffer(params.newAuthorizedPubkey.toBuffer())
|
|
27201
27201
|
});
|
|
27202
|
-
return new
|
|
27202
|
+
return new TransactionInstruction44({
|
|
27203
27203
|
keys: [{
|
|
27204
27204
|
pubkey: params.noncePubkey,
|
|
27205
27205
|
isSigner: false,
|
|
@@ -27247,14 +27247,14 @@ Message: ${transactionMessage}.
|
|
|
27247
27247
|
isWritable: true
|
|
27248
27248
|
}];
|
|
27249
27249
|
}
|
|
27250
|
-
return new
|
|
27250
|
+
return new TransactionInstruction44({
|
|
27251
27251
|
keys,
|
|
27252
27252
|
programId: this.programId,
|
|
27253
27253
|
data
|
|
27254
27254
|
});
|
|
27255
27255
|
}
|
|
27256
27256
|
};
|
|
27257
|
-
SystemProgram14.programId = new
|
|
27257
|
+
SystemProgram14.programId = new PublicKey30("11111111111111111111111111111111");
|
|
27258
27258
|
var CHUNK_SIZE = PACKET_DATA_SIZE - 300;
|
|
27259
27259
|
var Loader = class _Loader {
|
|
27260
27260
|
/**
|
|
@@ -27421,7 +27421,7 @@ Message: ${transactionMessage}.
|
|
|
27421
27421
|
}
|
|
27422
27422
|
};
|
|
27423
27423
|
Loader.chunkSize = CHUNK_SIZE;
|
|
27424
|
-
var BPF_LOADER_PROGRAM_ID = new
|
|
27424
|
+
var BPF_LOADER_PROGRAM_ID = new PublicKey30("BPFLoader2111111111111111111111111111111111");
|
|
27425
27425
|
var BpfLoader = class {
|
|
27426
27426
|
/**
|
|
27427
27427
|
* Minimum number of signatures required to load a program not including
|
|
@@ -28193,7 +28193,7 @@ Message: ${transactionMessage}.
|
|
|
28193
28193
|
return decoded;
|
|
28194
28194
|
}
|
|
28195
28195
|
var LOOKUP_TABLE_META_SIZE = 56;
|
|
28196
|
-
var
|
|
28196
|
+
var AddressLookupTableAccount2 = class {
|
|
28197
28197
|
constructor(args) {
|
|
28198
28198
|
this.key = void 0;
|
|
28199
28199
|
this.state = void 0;
|
|
@@ -28217,8 +28217,8 @@ Message: ${transactionMessage}.
|
|
|
28217
28217
|
deactivationSlot: meta.deactivationSlot,
|
|
28218
28218
|
lastExtendedSlot: meta.lastExtendedSlot,
|
|
28219
28219
|
lastExtendedSlotStartIndex: meta.lastExtendedStartIndex,
|
|
28220
|
-
authority: meta.authority.length !== 0 ? new
|
|
28221
|
-
addresses: addresses.map((address) => new
|
|
28220
|
+
authority: meta.authority.length !== 0 ? new PublicKey30(meta.authority[0]) : void 0,
|
|
28221
|
+
addresses: addresses.map((address) => new PublicKey30(address))
|
|
28222
28222
|
};
|
|
28223
28223
|
}
|
|
28224
28224
|
};
|
|
@@ -28260,7 +28260,7 @@ Message: ${transactionMessage}.
|
|
|
28260
28260
|
);
|
|
28261
28261
|
return `${protocol}//${hostish}${websocketPort}${rest}`;
|
|
28262
28262
|
}
|
|
28263
|
-
var PublicKeyFromString = superstruct.coerce(superstruct.instance(
|
|
28263
|
+
var PublicKeyFromString = superstruct.coerce(superstruct.instance(PublicKey30), superstruct.string(), (value) => new PublicKey30(value));
|
|
28264
28264
|
var RawAccountDataResult = superstruct.tuple([superstruct.string(), superstruct.literal("base64")]);
|
|
28265
28265
|
var BufferFromRawAccountData = superstruct.coerce(superstruct.instance(buffer.Buffer), RawAccountDataResult, (value) => buffer.Buffer.from(value[0], "base64"));
|
|
28266
28266
|
var BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1e3;
|
|
@@ -28345,7 +28345,7 @@ Message: ${transactionMessage}.
|
|
|
28345
28345
|
if (version3 === 0) {
|
|
28346
28346
|
return new MessageV0({
|
|
28347
28347
|
header: response.header,
|
|
28348
|
-
staticAccountKeys: response.accountKeys.map((accountKey) => new
|
|
28348
|
+
staticAccountKeys: response.accountKeys.map((accountKey) => new PublicKey30(accountKey)),
|
|
28349
28349
|
recentBlockhash: response.recentBlockhash,
|
|
28350
28350
|
compiledInstructions: response.instructions.map((ix) => ({
|
|
28351
28351
|
programIdIndex: ix.programIdIndex,
|
|
@@ -29009,7 +29009,7 @@ Message: ${transactionMessage}.
|
|
|
29009
29009
|
var COMMON_HTTP_HEADERS = {
|
|
29010
29010
|
"solana-client": `js/${"1.0.0-maintenance"}`
|
|
29011
29011
|
};
|
|
29012
|
-
var
|
|
29012
|
+
var Connection13 = class {
|
|
29013
29013
|
/**
|
|
29014
29014
|
* Establish a JSON RPC connection
|
|
29015
29015
|
*
|
|
@@ -30742,9 +30742,9 @@ Message: ${transactionMessage}.
|
|
|
30742
30742
|
} = await this.getAccountInfoAndContext(accountKey, config);
|
|
30743
30743
|
let value = null;
|
|
30744
30744
|
if (accountInfo !== null) {
|
|
30745
|
-
value = new
|
|
30745
|
+
value = new AddressLookupTableAccount2({
|
|
30746
30746
|
key: accountKey,
|
|
30747
|
-
state:
|
|
30747
|
+
state: AddressLookupTableAccount2.deserialize(accountInfo.data)
|
|
30748
30748
|
});
|
|
30749
30749
|
}
|
|
30750
30750
|
return {
|
|
@@ -31710,7 +31710,7 @@ Message: ${transactionMessage}.
|
|
|
31710
31710
|
await this._unsubscribeClientSubscription(clientSubscriptionId, "root change");
|
|
31711
31711
|
}
|
|
31712
31712
|
};
|
|
31713
|
-
var
|
|
31713
|
+
var Keypair14 = class _Keypair {
|
|
31714
31714
|
/**
|
|
31715
31715
|
* Create a new keypair instance.
|
|
31716
31716
|
* Generate random keypair if no {@link Ed25519Keypair} is provided.
|
|
@@ -31785,7 +31785,7 @@ Message: ${transactionMessage}.
|
|
|
31785
31785
|
* @returns {PublicKey} PublicKey
|
|
31786
31786
|
*/
|
|
31787
31787
|
get publicKey() {
|
|
31788
|
-
return new
|
|
31788
|
+
return new PublicKey30(this._keypair.publicKey);
|
|
31789
31789
|
}
|
|
31790
31790
|
/**
|
|
31791
31791
|
* The raw secret key for this keypair
|
|
@@ -31863,7 +31863,7 @@ Message: ${transactionMessage}.
|
|
|
31863
31863
|
lookupTable: instruction.keys[0].pubkey,
|
|
31864
31864
|
authority: instruction.keys[1].pubkey,
|
|
31865
31865
|
payer: instruction.keys.length > 2 ? instruction.keys[2].pubkey : void 0,
|
|
31866
|
-
addresses: addresses.map((buffer2) => new
|
|
31866
|
+
addresses: addresses.map((buffer2) => new PublicKey30(buffer2))
|
|
31867
31867
|
};
|
|
31868
31868
|
}
|
|
31869
31869
|
static decodeCloseLookupTable(instruction) {
|
|
@@ -31915,7 +31915,7 @@ Message: ${transactionMessage}.
|
|
|
31915
31915
|
constructor() {
|
|
31916
31916
|
}
|
|
31917
31917
|
static createLookupTable(params) {
|
|
31918
|
-
const [lookupTableAddress, bumpSeed] =
|
|
31918
|
+
const [lookupTableAddress, bumpSeed] = PublicKey30.findProgramAddressSync([params.authority.toBuffer(), codecsNumbers.getU64Encoder().encode(params.recentSlot)], this.programId);
|
|
31919
31919
|
const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable;
|
|
31920
31920
|
const data = encodeData(type, {
|
|
31921
31921
|
recentSlot: BigInt(params.recentSlot),
|
|
@@ -31938,7 +31938,7 @@ Message: ${transactionMessage}.
|
|
|
31938
31938
|
isSigner: false,
|
|
31939
31939
|
isWritable: false
|
|
31940
31940
|
}];
|
|
31941
|
-
return [new
|
|
31941
|
+
return [new TransactionInstruction44({
|
|
31942
31942
|
programId: this.programId,
|
|
31943
31943
|
keys,
|
|
31944
31944
|
data
|
|
@@ -31956,7 +31956,7 @@ Message: ${transactionMessage}.
|
|
|
31956
31956
|
isSigner: true,
|
|
31957
31957
|
isWritable: false
|
|
31958
31958
|
}];
|
|
31959
|
-
return new
|
|
31959
|
+
return new TransactionInstruction44({
|
|
31960
31960
|
programId: this.programId,
|
|
31961
31961
|
keys,
|
|
31962
31962
|
data
|
|
@@ -31987,7 +31987,7 @@ Message: ${transactionMessage}.
|
|
|
31987
31987
|
isWritable: false
|
|
31988
31988
|
});
|
|
31989
31989
|
}
|
|
31990
|
-
return new
|
|
31990
|
+
return new TransactionInstruction44({
|
|
31991
31991
|
programId: this.programId,
|
|
31992
31992
|
keys,
|
|
31993
31993
|
data
|
|
@@ -32005,7 +32005,7 @@ Message: ${transactionMessage}.
|
|
|
32005
32005
|
isSigner: true,
|
|
32006
32006
|
isWritable: false
|
|
32007
32007
|
}];
|
|
32008
|
-
return new
|
|
32008
|
+
return new TransactionInstruction44({
|
|
32009
32009
|
programId: this.programId,
|
|
32010
32010
|
keys,
|
|
32011
32011
|
data
|
|
@@ -32027,14 +32027,14 @@ Message: ${transactionMessage}.
|
|
|
32027
32027
|
isSigner: false,
|
|
32028
32028
|
isWritable: true
|
|
32029
32029
|
}];
|
|
32030
|
-
return new
|
|
32030
|
+
return new TransactionInstruction44({
|
|
32031
32031
|
programId: this.programId,
|
|
32032
32032
|
keys,
|
|
32033
32033
|
data
|
|
32034
32034
|
});
|
|
32035
32035
|
}
|
|
32036
32036
|
};
|
|
32037
|
-
AddressLookupTableProgram.programId = new
|
|
32037
|
+
AddressLookupTableProgram.programId = new PublicKey30("AddressLookupTab1e1111111111111111111111111");
|
|
32038
32038
|
var ComputeBudgetInstruction = class {
|
|
32039
32039
|
/**
|
|
32040
32040
|
* @internal
|
|
@@ -32152,7 +32152,7 @@ Message: ${transactionMessage}.
|
|
|
32152
32152
|
static requestUnits(params) {
|
|
32153
32153
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits;
|
|
32154
32154
|
const data = encodeData(type, params);
|
|
32155
|
-
return new
|
|
32155
|
+
return new TransactionInstruction44({
|
|
32156
32156
|
keys: [],
|
|
32157
32157
|
programId: this.programId,
|
|
32158
32158
|
data
|
|
@@ -32161,7 +32161,7 @@ Message: ${transactionMessage}.
|
|
|
32161
32161
|
static requestHeapFrame(params) {
|
|
32162
32162
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame;
|
|
32163
32163
|
const data = encodeData(type, params);
|
|
32164
|
-
return new
|
|
32164
|
+
return new TransactionInstruction44({
|
|
32165
32165
|
keys: [],
|
|
32166
32166
|
programId: this.programId,
|
|
32167
32167
|
data
|
|
@@ -32170,7 +32170,7 @@ Message: ${transactionMessage}.
|
|
|
32170
32170
|
static setComputeUnitLimit(params) {
|
|
32171
32171
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit;
|
|
32172
32172
|
const data = encodeData(type, params);
|
|
32173
|
-
return new
|
|
32173
|
+
return new TransactionInstruction44({
|
|
32174
32174
|
keys: [],
|
|
32175
32175
|
programId: this.programId,
|
|
32176
32176
|
data
|
|
@@ -32181,14 +32181,14 @@ Message: ${transactionMessage}.
|
|
|
32181
32181
|
const data = encodeData(type, {
|
|
32182
32182
|
microLamports: BigInt(params.microLamports)
|
|
32183
32183
|
});
|
|
32184
|
-
return new
|
|
32184
|
+
return new TransactionInstruction44({
|
|
32185
32185
|
keys: [],
|
|
32186
32186
|
programId: this.programId,
|
|
32187
32187
|
data
|
|
32188
32188
|
});
|
|
32189
32189
|
}
|
|
32190
32190
|
};
|
|
32191
|
-
ComputeBudgetProgram.programId = new
|
|
32191
|
+
ComputeBudgetProgram.programId = new PublicKey30("ComputeBudget111111111111111111111111111111");
|
|
32192
32192
|
var PRIVATE_KEY_BYTES$1 = 64;
|
|
32193
32193
|
var PUBLIC_KEY_BYTES$1 = 32;
|
|
32194
32194
|
var SIGNATURE_BYTES = 64;
|
|
@@ -32236,7 +32236,7 @@ Message: ${transactionMessage}.
|
|
|
32236
32236
|
instructionData.fill(publicKey3, publicKeyOffset);
|
|
32237
32237
|
instructionData.fill(signature2, signatureOffset);
|
|
32238
32238
|
instructionData.fill(message, messageDataOffset);
|
|
32239
|
-
return new
|
|
32239
|
+
return new TransactionInstruction44({
|
|
32240
32240
|
keys: [],
|
|
32241
32241
|
programId: _Ed25519Program.programId,
|
|
32242
32242
|
data: instructionData
|
|
@@ -32254,7 +32254,7 @@ Message: ${transactionMessage}.
|
|
|
32254
32254
|
} = params;
|
|
32255
32255
|
assert(privateKey.length === PRIVATE_KEY_BYTES$1, `Private key must be ${PRIVATE_KEY_BYTES$1} bytes but received ${privateKey.length} bytes`);
|
|
32256
32256
|
try {
|
|
32257
|
-
const keypair =
|
|
32257
|
+
const keypair = Keypair14.fromSecretKey(privateKey);
|
|
32258
32258
|
const publicKey3 = keypair.publicKey.toBytes();
|
|
32259
32259
|
const signature2 = sign(message, keypair.secretKey);
|
|
32260
32260
|
return this.createInstructionWithPublicKey({
|
|
@@ -32268,7 +32268,7 @@ Message: ${transactionMessage}.
|
|
|
32268
32268
|
}
|
|
32269
32269
|
}
|
|
32270
32270
|
};
|
|
32271
|
-
Ed25519Program.programId = new
|
|
32271
|
+
Ed25519Program.programId = new PublicKey30("Ed25519SigVerify111111111111111111111111111");
|
|
32272
32272
|
var ecdsaSign = (msgHash, privKey) => {
|
|
32273
32273
|
const signature2 = secp256k1.secp256k1.sign(msgHash, privKey);
|
|
32274
32274
|
return [signature2.toCompactRawBytes(), signature2.recovery];
|
|
@@ -32364,7 +32364,7 @@ Message: ${transactionMessage}.
|
|
|
32364
32364
|
recoveryId
|
|
32365
32365
|
}, instructionData);
|
|
32366
32366
|
instructionData.fill(toBuffer(message), SECP256K1_INSTRUCTION_LAYOUT.span);
|
|
32367
|
-
return new
|
|
32367
|
+
return new TransactionInstruction44({
|
|
32368
32368
|
keys: [],
|
|
32369
32369
|
programId: _Secp256k1Program.programId,
|
|
32370
32370
|
data: instructionData
|
|
@@ -32402,9 +32402,9 @@ Message: ${transactionMessage}.
|
|
|
32402
32402
|
}
|
|
32403
32403
|
}
|
|
32404
32404
|
};
|
|
32405
|
-
Secp256k1Program.programId = new
|
|
32405
|
+
Secp256k1Program.programId = new PublicKey30("KeccakSecp256k11111111111111111111111111111");
|
|
32406
32406
|
var _Lockup;
|
|
32407
|
-
var STAKE_CONFIG_ID = new
|
|
32407
|
+
var STAKE_CONFIG_ID = new PublicKey30("StakeConfig11111111111111111111111111111111");
|
|
32408
32408
|
var Authorized = class {
|
|
32409
32409
|
/**
|
|
32410
32410
|
* Create a new Authorized object
|
|
@@ -32435,7 +32435,7 @@ Message: ${transactionMessage}.
|
|
|
32435
32435
|
*/
|
|
32436
32436
|
};
|
|
32437
32437
|
_Lockup = Lockup;
|
|
32438
|
-
Lockup.default = new _Lockup(0, 0,
|
|
32438
|
+
Lockup.default = new _Lockup(0, 0, PublicKey30.default);
|
|
32439
32439
|
var StakeInstruction = class {
|
|
32440
32440
|
/**
|
|
32441
32441
|
* @internal
|
|
@@ -32473,8 +32473,8 @@ Message: ${transactionMessage}.
|
|
|
32473
32473
|
} = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Initialize, instruction.data);
|
|
32474
32474
|
return {
|
|
32475
32475
|
stakePubkey: instruction.keys[0].pubkey,
|
|
32476
|
-
authorized: new Authorized(new
|
|
32477
|
-
lockup: new Lockup(lockup2.unixTimestamp, lockup2.epoch, new
|
|
32476
|
+
authorized: new Authorized(new PublicKey30(authorized2.staker), new PublicKey30(authorized2.withdrawer)),
|
|
32477
|
+
lockup: new Lockup(lockup2.unixTimestamp, lockup2.epoch, new PublicKey30(lockup2.custodian))
|
|
32478
32478
|
};
|
|
32479
32479
|
}
|
|
32480
32480
|
/**
|
|
@@ -32503,7 +32503,7 @@ Message: ${transactionMessage}.
|
|
|
32503
32503
|
const o = {
|
|
32504
32504
|
stakePubkey: instruction.keys[0].pubkey,
|
|
32505
32505
|
authorizedPubkey: instruction.keys[2].pubkey,
|
|
32506
|
-
newAuthorizedPubkey: new
|
|
32506
|
+
newAuthorizedPubkey: new PublicKey30(newAuthorized),
|
|
32507
32507
|
stakeAuthorizationType: {
|
|
32508
32508
|
index: stakeAuthorizationType
|
|
32509
32509
|
}
|
|
@@ -32529,8 +32529,8 @@ Message: ${transactionMessage}.
|
|
|
32529
32529
|
stakePubkey: instruction.keys[0].pubkey,
|
|
32530
32530
|
authorityBase: instruction.keys[1].pubkey,
|
|
32531
32531
|
authoritySeed,
|
|
32532
|
-
authorityOwner: new
|
|
32533
|
-
newAuthorizedPubkey: new
|
|
32532
|
+
authorityOwner: new PublicKey30(authorityOwner),
|
|
32533
|
+
newAuthorizedPubkey: new PublicKey30(newAuthorized),
|
|
32534
32534
|
stakeAuthorizationType: {
|
|
32535
32535
|
index: stakeAuthorizationType
|
|
32536
32536
|
}
|
|
@@ -32704,7 +32704,7 @@ Message: ${transactionMessage}.
|
|
|
32704
32704
|
programId: this.programId,
|
|
32705
32705
|
data
|
|
32706
32706
|
};
|
|
32707
|
-
return new
|
|
32707
|
+
return new TransactionInstruction44(instructionData);
|
|
32708
32708
|
}
|
|
32709
32709
|
/**
|
|
32710
32710
|
* Generate a Transaction that creates a new Stake account at
|
|
@@ -32902,7 +32902,7 @@ Message: ${transactionMessage}.
|
|
|
32902
32902
|
const data = encodeData(type, {
|
|
32903
32903
|
lamports
|
|
32904
32904
|
});
|
|
32905
|
-
return new
|
|
32905
|
+
return new TransactionInstruction44({
|
|
32906
32906
|
keys: [{
|
|
32907
32907
|
pubkey: stakePubkey,
|
|
32908
32908
|
isSigner: false,
|
|
@@ -33084,7 +33084,7 @@ Message: ${transactionMessage}.
|
|
|
33084
33084
|
});
|
|
33085
33085
|
}
|
|
33086
33086
|
};
|
|
33087
|
-
StakeProgram.programId = new
|
|
33087
|
+
StakeProgram.programId = new PublicKey30("Stake11111111111111111111111111111111111111");
|
|
33088
33088
|
StakeProgram.space = 200;
|
|
33089
33089
|
var VoteInit = class {
|
|
33090
33090
|
/** [0, 100] */
|
|
@@ -33136,7 +33136,7 @@ Message: ${transactionMessage}.
|
|
|
33136
33136
|
return {
|
|
33137
33137
|
votePubkey: instruction.keys[0].pubkey,
|
|
33138
33138
|
nodePubkey: instruction.keys[3].pubkey,
|
|
33139
|
-
voteInit: new VoteInit(new
|
|
33139
|
+
voteInit: new VoteInit(new PublicKey30(voteInit2.nodePubkey), new PublicKey30(voteInit2.authorizedVoter), new PublicKey30(voteInit2.authorizedWithdrawer), voteInit2.commission)
|
|
33140
33140
|
};
|
|
33141
33141
|
}
|
|
33142
33142
|
/**
|
|
@@ -33152,7 +33152,7 @@ Message: ${transactionMessage}.
|
|
|
33152
33152
|
return {
|
|
33153
33153
|
votePubkey: instruction.keys[0].pubkey,
|
|
33154
33154
|
authorizedPubkey: instruction.keys[2].pubkey,
|
|
33155
|
-
newAuthorizedPubkey: new
|
|
33155
|
+
newAuthorizedPubkey: new PublicKey30(newAuthorized),
|
|
33156
33156
|
voteAuthorizationType: {
|
|
33157
33157
|
index: voteAuthorizationType
|
|
33158
33158
|
}
|
|
@@ -33174,9 +33174,9 @@ Message: ${transactionMessage}.
|
|
|
33174
33174
|
} = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed, instruction.data);
|
|
33175
33175
|
return {
|
|
33176
33176
|
currentAuthorityDerivedKeyBasePubkey: instruction.keys[2].pubkey,
|
|
33177
|
-
currentAuthorityDerivedKeyOwnerPubkey: new
|
|
33177
|
+
currentAuthorityDerivedKeyOwnerPubkey: new PublicKey30(currentAuthorityDerivedKeyOwnerPubkey),
|
|
33178
33178
|
currentAuthorityDerivedKeySeed,
|
|
33179
|
-
newAuthorizedPubkey: new
|
|
33179
|
+
newAuthorizedPubkey: new PublicKey30(newAuthorized),
|
|
33180
33180
|
voteAuthorizationType: {
|
|
33181
33181
|
index: voteAuthorizationType
|
|
33182
33182
|
},
|
|
@@ -33294,7 +33294,7 @@ Message: ${transactionMessage}.
|
|
|
33294
33294
|
programId: this.programId,
|
|
33295
33295
|
data
|
|
33296
33296
|
};
|
|
33297
|
-
return new
|
|
33297
|
+
return new TransactionInstruction44(instructionData);
|
|
33298
33298
|
}
|
|
33299
33299
|
/**
|
|
33300
33300
|
* Generate a transaction that creates a new Vote account.
|
|
@@ -33467,9 +33467,9 @@ Message: ${transactionMessage}.
|
|
|
33467
33467
|
});
|
|
33468
33468
|
}
|
|
33469
33469
|
};
|
|
33470
|
-
VoteProgram.programId = new
|
|
33470
|
+
VoteProgram.programId = new PublicKey30("Vote111111111111111111111111111111111111111");
|
|
33471
33471
|
VoteProgram.space = 3762;
|
|
33472
|
-
var VALIDATOR_INFO_KEY = new
|
|
33472
|
+
var VALIDATOR_INFO_KEY = new PublicKey30("Va1idator1nfo111111111111111111111111111111");
|
|
33473
33473
|
var InfoString = superstruct.type({
|
|
33474
33474
|
name: superstruct.string(),
|
|
33475
33475
|
website: superstruct.optional(superstruct.string()),
|
|
@@ -33503,7 +33503,7 @@ Message: ${transactionMessage}.
|
|
|
33503
33503
|
if (configKeyCount !== 2) return null;
|
|
33504
33504
|
const configKeys = [];
|
|
33505
33505
|
for (let i = 0; i < 2; i++) {
|
|
33506
|
-
const publicKey3 = new
|
|
33506
|
+
const publicKey3 = new PublicKey30(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
33507
33507
|
const isSigner = guardedShift(byteArray) === 1;
|
|
33508
33508
|
configKeys.push({
|
|
33509
33509
|
publicKey: publicKey3,
|
|
@@ -33521,7 +33521,7 @@ Message: ${transactionMessage}.
|
|
|
33521
33521
|
return null;
|
|
33522
33522
|
}
|
|
33523
33523
|
};
|
|
33524
|
-
var VOTE_PROGRAM_ID = new
|
|
33524
|
+
var VOTE_PROGRAM_ID = new PublicKey30("Vote111111111111111111111111111111111111111");
|
|
33525
33525
|
var VoteAccountLayout = BufferLayout__namespace.struct([
|
|
33526
33526
|
publicKey2("nodePubkey"),
|
|
33527
33527
|
publicKey2("authorizedWithdrawer"),
|
|
@@ -33578,8 +33578,8 @@ Message: ${transactionMessage}.
|
|
|
33578
33578
|
rootSlot = null;
|
|
33579
33579
|
}
|
|
33580
33580
|
return new _VoteAccount({
|
|
33581
|
-
nodePubkey: new
|
|
33582
|
-
authorizedWithdrawer: new
|
|
33581
|
+
nodePubkey: new PublicKey30(va.nodePubkey),
|
|
33582
|
+
authorizedWithdrawer: new PublicKey30(va.authorizedWithdrawer),
|
|
33583
33583
|
commission: va.commission,
|
|
33584
33584
|
votes: va.votes,
|
|
33585
33585
|
rootSlot,
|
|
@@ -33596,7 +33596,7 @@ Message: ${transactionMessage}.
|
|
|
33596
33596
|
}) {
|
|
33597
33597
|
return {
|
|
33598
33598
|
epoch,
|
|
33599
|
-
authorizedVoter: new
|
|
33599
|
+
authorizedVoter: new PublicKey30(authorizedVoter)
|
|
33600
33600
|
};
|
|
33601
33601
|
}
|
|
33602
33602
|
function parsePriorVoters({
|
|
@@ -33605,7 +33605,7 @@ Message: ${transactionMessage}.
|
|
|
33605
33605
|
targetEpoch
|
|
33606
33606
|
}) {
|
|
33607
33607
|
return {
|
|
33608
|
-
authorizedPubkey: new
|
|
33608
|
+
authorizedPubkey: new PublicKey30(authorizedPubkey),
|
|
33609
33609
|
epochOfLastAuthorizedSwitch,
|
|
33610
33610
|
targetEpoch
|
|
33611
33611
|
};
|
|
@@ -33678,7 +33678,7 @@ Message: ${transactionMessage}.
|
|
|
33678
33678
|
}
|
|
33679
33679
|
var LAMPORTS_PER_SOL3 = 1e9;
|
|
33680
33680
|
exports2.Account = Account;
|
|
33681
|
-
exports2.AddressLookupTableAccount =
|
|
33681
|
+
exports2.AddressLookupTableAccount = AddressLookupTableAccount2;
|
|
33682
33682
|
exports2.AddressLookupTableInstruction = AddressLookupTableInstruction;
|
|
33683
33683
|
exports2.AddressLookupTableProgram = AddressLookupTableProgram;
|
|
33684
33684
|
exports2.Authorized = Authorized;
|
|
@@ -33689,12 +33689,12 @@ Message: ${transactionMessage}.
|
|
|
33689
33689
|
exports2.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS;
|
|
33690
33690
|
exports2.ComputeBudgetInstruction = ComputeBudgetInstruction;
|
|
33691
33691
|
exports2.ComputeBudgetProgram = ComputeBudgetProgram;
|
|
33692
|
-
exports2.Connection =
|
|
33692
|
+
exports2.Connection = Connection13;
|
|
33693
33693
|
exports2.Ed25519Program = Ed25519Program;
|
|
33694
33694
|
exports2.Enum = Enum;
|
|
33695
33695
|
exports2.EpochSchedule = EpochSchedule;
|
|
33696
33696
|
exports2.FeeCalculatorLayout = FeeCalculatorLayout;
|
|
33697
|
-
exports2.Keypair =
|
|
33697
|
+
exports2.Keypair = Keypair14;
|
|
33698
33698
|
exports2.LAMPORTS_PER_SOL = LAMPORTS_PER_SOL3;
|
|
33699
33699
|
exports2.LOOKUP_TABLE_INSTRUCTION_LAYOUTS = LOOKUP_TABLE_INSTRUCTION_LAYOUTS;
|
|
33700
33700
|
exports2.Loader = Loader;
|
|
@@ -33707,7 +33707,7 @@ Message: ${transactionMessage}.
|
|
|
33707
33707
|
exports2.NonceAccount = NonceAccount;
|
|
33708
33708
|
exports2.PACKET_DATA_SIZE = PACKET_DATA_SIZE;
|
|
33709
33709
|
exports2.PUBLIC_KEY_LENGTH = PUBLIC_KEY_LENGTH2;
|
|
33710
|
-
exports2.PublicKey =
|
|
33710
|
+
exports2.PublicKey = PublicKey30;
|
|
33711
33711
|
exports2.SIGNATURE_LENGTH_IN_BYTES = SIGNATURE_LENGTH_IN_BYTES;
|
|
33712
33712
|
exports2.SOLANA_SCHEMA = SOLANA_SCHEMA;
|
|
33713
33713
|
exports2.STAKE_CONFIG_ID = STAKE_CONFIG_ID;
|
|
@@ -33736,15 +33736,15 @@ Message: ${transactionMessage}.
|
|
|
33736
33736
|
exports2.TransactionExpiredBlockheightExceededError = TransactionExpiredBlockheightExceededError;
|
|
33737
33737
|
exports2.TransactionExpiredNonceInvalidError = TransactionExpiredNonceInvalidError;
|
|
33738
33738
|
exports2.TransactionExpiredTimeoutError = TransactionExpiredTimeoutError;
|
|
33739
|
-
exports2.TransactionInstruction =
|
|
33740
|
-
exports2.TransactionMessage =
|
|
33739
|
+
exports2.TransactionInstruction = TransactionInstruction44;
|
|
33740
|
+
exports2.TransactionMessage = TransactionMessage2;
|
|
33741
33741
|
exports2.TransactionStatus = TransactionStatus;
|
|
33742
33742
|
exports2.VALIDATOR_INFO_KEY = VALIDATOR_INFO_KEY;
|
|
33743
33743
|
exports2.VERSION_PREFIX_MASK = VERSION_PREFIX_MASK;
|
|
33744
33744
|
exports2.VOTE_PROGRAM_ID = VOTE_PROGRAM_ID;
|
|
33745
33745
|
exports2.ValidatorInfo = ValidatorInfo;
|
|
33746
33746
|
exports2.VersionedMessage = VersionedMessage;
|
|
33747
|
-
exports2.VersionedTransaction =
|
|
33747
|
+
exports2.VersionedTransaction = VersionedTransaction4;
|
|
33748
33748
|
exports2.VoteAccount = VoteAccount;
|
|
33749
33749
|
exports2.VoteAuthorizationLayout = VoteAuthorizationLayout;
|
|
33750
33750
|
exports2.VoteInit = VoteInit;
|
|
@@ -60368,7 +60368,7 @@ var require_dist3 = __commonJS({
|
|
|
60368
60368
|
});
|
|
60369
60369
|
|
|
60370
60370
|
// node_modules/nara-sdk/src/constants.ts
|
|
60371
|
-
var DEFAULT_RPC_URL, DEFAULT_QUEST_RELAY_URL, DEFAULT_QUEST_PROGRAM_ID, DEFAULT_SKILLS_PROGRAM_ID, DEFAULT_ZKID_PROGRAM_ID, DEFAULT_AGENT_REGISTRY_PROGRAM_ID;
|
|
60371
|
+
var DEFAULT_RPC_URL, DEFAULT_QUEST_RELAY_URL, DEFAULT_QUEST_PROGRAM_ID, DEFAULT_SKILLS_PROGRAM_ID, DEFAULT_ZKID_PROGRAM_ID, DEFAULT_AGENT_REGISTRY_PROGRAM_ID, DEFAULT_ALT_ADDRESS;
|
|
60372
60372
|
var init_constants2 = __esm({
|
|
60373
60373
|
"node_modules/nara-sdk/src/constants.ts"() {
|
|
60374
60374
|
DEFAULT_RPC_URL = process.env.RPC_URL || "https://mainnet-api.nara.build/";
|
|
@@ -60377,6 +60377,87 @@ var init_constants2 = __esm({
|
|
|
60377
60377
|
DEFAULT_SKILLS_PROGRAM_ID = process.env.SKILLS_PROGRAM_ID || "SkiLLHub11111111111111111111111111111111111";
|
|
60378
60378
|
DEFAULT_ZKID_PROGRAM_ID = process.env.ZKID_PROGRAM_ID || "ZKidentity111111111111111111111111111111111";
|
|
60379
60379
|
DEFAULT_AGENT_REGISTRY_PROGRAM_ID = process.env.AGENT_REGISTRY_PROGRAM_ID || "AgentRegistry111111111111111111111111111111";
|
|
60380
|
+
DEFAULT_ALT_ADDRESS = process.env.ALT_ADDRESS || "";
|
|
60381
|
+
}
|
|
60382
|
+
});
|
|
60383
|
+
|
|
60384
|
+
// node_modules/nara-sdk/src/tx.ts
|
|
60385
|
+
function getAltAddress() {
|
|
60386
|
+
return _overrideAltAddress ?? DEFAULT_ALT_ADDRESS;
|
|
60387
|
+
}
|
|
60388
|
+
async function loadAlt(connection) {
|
|
60389
|
+
const addr = getAltAddress();
|
|
60390
|
+
if (!addr) return null;
|
|
60391
|
+
if (_cachedAlt && _cachedAltAddress === addr) return _cachedAlt;
|
|
60392
|
+
const result = await connection.getAddressLookupTable(new import_web388.PublicKey(addr));
|
|
60393
|
+
if (!result.value) {
|
|
60394
|
+
throw new Error(`Address Lookup Table not found: ${addr}`);
|
|
60395
|
+
}
|
|
60396
|
+
_cachedAlt = result.value;
|
|
60397
|
+
_cachedAltAddress = addr;
|
|
60398
|
+
return _cachedAlt;
|
|
60399
|
+
}
|
|
60400
|
+
async function sendTx(connection, payer, instructions, signers, opts) {
|
|
60401
|
+
const alt = await loadAlt(connection);
|
|
60402
|
+
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
|
|
60403
|
+
let signature;
|
|
60404
|
+
if (alt) {
|
|
60405
|
+
const message = new import_web388.TransactionMessage({
|
|
60406
|
+
payerKey: payer.publicKey,
|
|
60407
|
+
recentBlockhash: blockhash,
|
|
60408
|
+
instructions
|
|
60409
|
+
}).compileToV0Message([alt]);
|
|
60410
|
+
const tx = new import_web388.VersionedTransaction(message);
|
|
60411
|
+
const allSigners = [payer, ...signers ?? []];
|
|
60412
|
+
const seen = /* @__PURE__ */ new Set();
|
|
60413
|
+
const uniqueSigners = allSigners.filter((s) => {
|
|
60414
|
+
const key = s.publicKey.toBase58();
|
|
60415
|
+
if (seen.has(key)) return false;
|
|
60416
|
+
seen.add(key);
|
|
60417
|
+
return true;
|
|
60418
|
+
});
|
|
60419
|
+
tx.sign(uniqueSigners);
|
|
60420
|
+
signature = await connection.sendRawTransaction(tx.serialize(), {
|
|
60421
|
+
skipPreflight: opts?.skipPreflight ?? false
|
|
60422
|
+
});
|
|
60423
|
+
} else {
|
|
60424
|
+
const tx = new import_web388.Transaction();
|
|
60425
|
+
tx.recentBlockhash = blockhash;
|
|
60426
|
+
tx.lastValidBlockHeight = lastValidBlockHeight;
|
|
60427
|
+
tx.feePayer = payer.publicKey;
|
|
60428
|
+
for (const ix of instructions) tx.add(ix);
|
|
60429
|
+
const allSigners = [payer, ...signers ?? []];
|
|
60430
|
+
const seen = /* @__PURE__ */ new Set();
|
|
60431
|
+
const uniqueSigners = allSigners.filter((s) => {
|
|
60432
|
+
const key = s.publicKey.toBase58();
|
|
60433
|
+
if (seen.has(key)) return false;
|
|
60434
|
+
seen.add(key);
|
|
60435
|
+
return true;
|
|
60436
|
+
});
|
|
60437
|
+
tx.sign(...uniqueSigners);
|
|
60438
|
+
signature = await connection.sendRawTransaction(tx.serialize(), {
|
|
60439
|
+
skipPreflight: opts?.skipPreflight ?? false
|
|
60440
|
+
});
|
|
60441
|
+
}
|
|
60442
|
+
const confirmation = await connection.confirmTransaction(
|
|
60443
|
+
{ signature, blockhash, lastValidBlockHeight },
|
|
60444
|
+
"confirmed"
|
|
60445
|
+
);
|
|
60446
|
+
if (confirmation.value.err) {
|
|
60447
|
+
throw new Error(
|
|
60448
|
+
`Transaction ${signature} failed: ${JSON.stringify(confirmation.value.err)}`
|
|
60449
|
+
);
|
|
60450
|
+
}
|
|
60451
|
+
return signature;
|
|
60452
|
+
}
|
|
60453
|
+
var import_web388, _cachedAlt, _cachedAltAddress, _overrideAltAddress;
|
|
60454
|
+
var init_tx = __esm({
|
|
60455
|
+
"node_modules/nara-sdk/src/tx.ts"() {
|
|
60456
|
+
import_web388 = __toESM(require_index_cjs(), 1);
|
|
60457
|
+
init_constants2();
|
|
60458
|
+
_cachedAlt = null;
|
|
60459
|
+
_cachedAltAddress = "";
|
|
60460
|
+
_overrideAltAddress = null;
|
|
60380
60461
|
}
|
|
60381
60462
|
});
|
|
60382
60463
|
|
|
@@ -79475,31 +79556,6 @@ __export(agent_registry_exports, {
|
|
|
79475
79556
|
updateRegisterFee: () => updateRegisterFee,
|
|
79476
79557
|
uploadMemory: () => uploadMemory
|
|
79477
79558
|
});
|
|
79478
|
-
async function sendAndConfirmTx(connection, tx, signers) {
|
|
79479
|
-
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
|
|
79480
|
-
tx.recentBlockhash = blockhash;
|
|
79481
|
-
tx.feePayer = signers[0].publicKey;
|
|
79482
|
-
tx.sign(...signers);
|
|
79483
|
-
const rawTx = tx.serialize();
|
|
79484
|
-
const sig = await connection.sendRawTransaction(rawTx, {
|
|
79485
|
-
skipPreflight: false
|
|
79486
|
-
});
|
|
79487
|
-
while (true) {
|
|
79488
|
-
const { value } = await connection.getSignatureStatuses([sig]);
|
|
79489
|
-
const status = value[0];
|
|
79490
|
-
if (status) {
|
|
79491
|
-
if (status.err) throw new Error(`Transaction failed: ${JSON.stringify(status.err)}`);
|
|
79492
|
-
if (status.confirmationStatus === "confirmed" || status.confirmationStatus === "finalized") {
|
|
79493
|
-
return sig;
|
|
79494
|
-
}
|
|
79495
|
-
}
|
|
79496
|
-
const currentHeight = await connection.getBlockHeight("confirmed");
|
|
79497
|
-
if (currentHeight > lastValidBlockHeight) {
|
|
79498
|
-
throw new Error(`Transaction expired (blockhash no longer valid): ${sig}`);
|
|
79499
|
-
}
|
|
79500
|
-
await new Promise((r) => setTimeout(r, 1e3));
|
|
79501
|
-
}
|
|
79502
|
-
}
|
|
79503
79559
|
function createProgram(connection, wallet, programId) {
|
|
79504
79560
|
const idl = nara_agent_registry_default;
|
|
79505
79561
|
const pid = programId ?? DEFAULT_AGENT_REGISTRY_PROGRAM_ID;
|
|
@@ -79511,49 +79567,49 @@ function createProgram(connection, wallet, programId) {
|
|
|
79511
79567
|
return new import_anchor.Program(idlWithPid, provider);
|
|
79512
79568
|
}
|
|
79513
79569
|
function getAgentPda(programId, agentId) {
|
|
79514
|
-
const [pda] =
|
|
79570
|
+
const [pda] = import_web389.PublicKey.findProgramAddressSync(
|
|
79515
79571
|
[Buffer.from("agent"), Buffer.from(agentId)],
|
|
79516
79572
|
programId
|
|
79517
79573
|
);
|
|
79518
79574
|
return pda;
|
|
79519
79575
|
}
|
|
79520
79576
|
function getConfigPda(programId) {
|
|
79521
|
-
const [pda] =
|
|
79577
|
+
const [pda] = import_web389.PublicKey.findProgramAddressSync(
|
|
79522
79578
|
[Buffer.from("config")],
|
|
79523
79579
|
programId
|
|
79524
79580
|
);
|
|
79525
79581
|
return pda;
|
|
79526
79582
|
}
|
|
79527
79583
|
function getBioPda(programId, agentPubkey) {
|
|
79528
|
-
const [pda] =
|
|
79584
|
+
const [pda] = import_web389.PublicKey.findProgramAddressSync(
|
|
79529
79585
|
[Buffer.from("bio"), agentPubkey.toBuffer()],
|
|
79530
79586
|
programId
|
|
79531
79587
|
);
|
|
79532
79588
|
return pda;
|
|
79533
79589
|
}
|
|
79534
79590
|
function getMetaPda(programId, agentPubkey) {
|
|
79535
|
-
const [pda] =
|
|
79591
|
+
const [pda] = import_web389.PublicKey.findProgramAddressSync(
|
|
79536
79592
|
[Buffer.from("meta"), agentPubkey.toBuffer()],
|
|
79537
79593
|
programId
|
|
79538
79594
|
);
|
|
79539
79595
|
return pda;
|
|
79540
79596
|
}
|
|
79541
79597
|
function getPointMintPda(programId) {
|
|
79542
|
-
const [pda] =
|
|
79598
|
+
const [pda] = import_web389.PublicKey.findProgramAddressSync(
|
|
79543
79599
|
[Buffer.from("point_mint")],
|
|
79544
79600
|
programId
|
|
79545
79601
|
);
|
|
79546
79602
|
return pda;
|
|
79547
79603
|
}
|
|
79548
79604
|
function getRefereeMintPda(programId) {
|
|
79549
|
-
const [pda] =
|
|
79605
|
+
const [pda] = import_web389.PublicKey.findProgramAddressSync(
|
|
79550
79606
|
[Buffer.from("referee_mint")],
|
|
79551
79607
|
programId
|
|
79552
79608
|
);
|
|
79553
79609
|
return pda;
|
|
79554
79610
|
}
|
|
79555
79611
|
function getRefereeActivityMintPda(programId) {
|
|
79556
|
-
const [pda] =
|
|
79612
|
+
const [pda] = import_web389.PublicKey.findProgramAddressSync(
|
|
79557
79613
|
[Buffer.from("referee_activity_mint")],
|
|
79558
79614
|
programId
|
|
79559
79615
|
);
|
|
@@ -79565,7 +79621,7 @@ async function resolveReferralAccounts(connection, referralAgentId, programId, p
|
|
|
79565
79621
|
if (!accountInfo) {
|
|
79566
79622
|
throw new Error(`Referral agent "${referralAgentId}" not found`);
|
|
79567
79623
|
}
|
|
79568
|
-
const referralAuthority = new
|
|
79624
|
+
const referralAuthority = new import_web389.PublicKey(accountInfo.data.subarray(8, 40));
|
|
79569
79625
|
const referralPointAccount = getAssociatedTokenAddressSync(
|
|
79570
79626
|
pointMint,
|
|
79571
79627
|
referralAuthority,
|
|
@@ -79577,11 +79633,11 @@ async function resolveReferralAccounts(connection, referralAgentId, programId, p
|
|
|
79577
79633
|
function parseAgentRecordData(data) {
|
|
79578
79634
|
const buf = Buffer.from(data);
|
|
79579
79635
|
let offset = 8;
|
|
79580
|
-
const authority = new
|
|
79636
|
+
const authority = new import_web389.PublicKey(buf.subarray(offset, offset + 32));
|
|
79581
79637
|
offset += 32;
|
|
79582
|
-
const pendingBuffer = new
|
|
79638
|
+
const pendingBuffer = new import_web389.PublicKey(buf.subarray(offset, offset + 32));
|
|
79583
79639
|
offset += 32;
|
|
79584
|
-
const memory = new
|
|
79640
|
+
const memory = new import_web389.PublicKey(buf.subarray(offset, offset + 32));
|
|
79585
79641
|
offset += 32;
|
|
79586
79642
|
const createdAt = Number(buf.readBigInt64LE(offset));
|
|
79587
79643
|
offset += 8;
|
|
@@ -79599,7 +79655,7 @@ function parseAgentRecordData(data) {
|
|
|
79599
79655
|
return {
|
|
79600
79656
|
authority,
|
|
79601
79657
|
agentId,
|
|
79602
|
-
pendingBuffer: pendingBuffer.equals(
|
|
79658
|
+
pendingBuffer: pendingBuffer.equals(import_web389.PublicKey.default) ? null : pendingBuffer,
|
|
79603
79659
|
memory,
|
|
79604
79660
|
version: version3,
|
|
79605
79661
|
referralId,
|
|
@@ -79613,7 +79669,7 @@ function deserializeRawString(data) {
|
|
|
79613
79669
|
return data.subarray(start, start + len).toString("utf-8");
|
|
79614
79670
|
}
|
|
79615
79671
|
async function getAgentRecord(connection, agentId, options) {
|
|
79616
|
-
const pid = new
|
|
79672
|
+
const pid = new import_web389.PublicKey(options?.programId ?? DEFAULT_AGENT_REGISTRY_PROGRAM_ID);
|
|
79617
79673
|
const agentPda = getAgentPda(pid, agentId);
|
|
79618
79674
|
const accountInfo = await connection.getAccountInfo(agentPda);
|
|
79619
79675
|
if (!accountInfo) {
|
|
@@ -79622,7 +79678,7 @@ async function getAgentRecord(connection, agentId, options) {
|
|
|
79622
79678
|
return parseAgentRecordData(accountInfo.data);
|
|
79623
79679
|
}
|
|
79624
79680
|
async function getAgentInfo(connection, agentId, options) {
|
|
79625
|
-
const pid = new
|
|
79681
|
+
const pid = new import_web389.PublicKey(options?.programId ?? DEFAULT_AGENT_REGISTRY_PROGRAM_ID);
|
|
79626
79682
|
const agentPda = getAgentPda(pid, agentId);
|
|
79627
79683
|
const accountInfo = await connection.getAccountInfo(agentPda);
|
|
79628
79684
|
if (!accountInfo) {
|
|
@@ -79647,7 +79703,7 @@ async function getAgentInfo(connection, agentId, options) {
|
|
|
79647
79703
|
}
|
|
79648
79704
|
async function getAgentMemory(connection, agentId, options) {
|
|
79649
79705
|
const record = await getAgentRecord(connection, agentId, options);
|
|
79650
|
-
if (record.memory.equals(
|
|
79706
|
+
if (record.memory.equals(import_web389.PublicKey.default)) {
|
|
79651
79707
|
return null;
|
|
79652
79708
|
}
|
|
79653
79709
|
const accountInfo = await connection.getAccountInfo(record.memory);
|
|
@@ -79655,7 +79711,7 @@ async function getAgentMemory(connection, agentId, options) {
|
|
|
79655
79711
|
return Buffer.from(accountInfo.data.slice(MEMORY_HEADER_SIZE));
|
|
79656
79712
|
}
|
|
79657
79713
|
async function getConfig(connection, options) {
|
|
79658
|
-
const pid = new
|
|
79714
|
+
const pid = new import_web389.PublicKey(options?.programId ?? DEFAULT_AGENT_REGISTRY_PROGRAM_ID);
|
|
79659
79715
|
const configPda = getConfigPda(pid);
|
|
79660
79716
|
const accountInfo = await connection.getAccountInfo(configPda);
|
|
79661
79717
|
if (!accountInfo) {
|
|
@@ -79663,15 +79719,15 @@ async function getConfig(connection, options) {
|
|
|
79663
79719
|
}
|
|
79664
79720
|
const buf = Buffer.from(accountInfo.data);
|
|
79665
79721
|
let offset = 8;
|
|
79666
|
-
const admin = new
|
|
79722
|
+
const admin = new import_web389.PublicKey(buf.subarray(offset, offset + 32));
|
|
79667
79723
|
offset += 32;
|
|
79668
|
-
const feeRecipient = new
|
|
79724
|
+
const feeRecipient = new import_web389.PublicKey(buf.subarray(offset, offset + 32));
|
|
79669
79725
|
offset += 32;
|
|
79670
|
-
const pointMint = new
|
|
79726
|
+
const pointMint = new import_web389.PublicKey(buf.subarray(offset, offset + 32));
|
|
79671
79727
|
offset += 32;
|
|
79672
|
-
const refereeMint = new
|
|
79728
|
+
const refereeMint = new import_web389.PublicKey(buf.subarray(offset, offset + 32));
|
|
79673
79729
|
offset += 32;
|
|
79674
|
-
const refereeActivityMint = new
|
|
79730
|
+
const refereeActivityMint = new import_web389.PublicKey(buf.subarray(offset, offset + 32));
|
|
79675
79731
|
offset += 32;
|
|
79676
79732
|
const registerFee = Number(buf.readBigUInt64LE(offset));
|
|
79677
79733
|
offset += 8;
|
|
@@ -79696,10 +79752,11 @@ async function registerAgent(connection, wallet, agentId, options) {
|
|
|
79696
79752
|
}
|
|
79697
79753
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
79698
79754
|
const config = await getConfig(connection, options);
|
|
79699
|
-
const
|
|
79755
|
+
const ix = await program3.methods.registerAgent(agentId).accounts({
|
|
79700
79756
|
authority: wallet.publicKey,
|
|
79701
79757
|
feeRecipient: config.feeRecipient
|
|
79702
|
-
}).
|
|
79758
|
+
}).instruction();
|
|
79759
|
+
const signature = await sendTx(connection, wallet, [ix]);
|
|
79703
79760
|
const agentPubkey = getAgentPda(program3.programId, agentId);
|
|
79704
79761
|
return { signature, agentPubkey };
|
|
79705
79762
|
}
|
|
@@ -79718,37 +79775,42 @@ async function registerAgentWithReferral(connection, wallet, agentId, referralAg
|
|
|
79718
79775
|
true,
|
|
79719
79776
|
TOKEN_2022_PROGRAM_ID
|
|
79720
79777
|
);
|
|
79721
|
-
const
|
|
79778
|
+
const ix = await program3.methods.registerAgentWithReferral(agentId).accounts({
|
|
79722
79779
|
authority: wallet.publicKey,
|
|
79723
79780
|
feeRecipient: config.feeRecipient,
|
|
79724
79781
|
referralAgent,
|
|
79725
79782
|
referralAuthority,
|
|
79726
79783
|
referralPointAccount,
|
|
79727
79784
|
referralRefereeAccount
|
|
79728
|
-
}).
|
|
79785
|
+
}).instruction();
|
|
79786
|
+
const signature = await sendTx(connection, wallet, [ix]);
|
|
79729
79787
|
const agentPubkey = getAgentPda(program3.programId, agentId);
|
|
79730
79788
|
return { signature, agentPubkey };
|
|
79731
79789
|
}
|
|
79732
79790
|
async function transferAgentAuthority(connection, wallet, agentId, newAuthority, options) {
|
|
79733
79791
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
79734
|
-
|
|
79792
|
+
const ix = await program3.methods.transferAuthority(agentId, newAuthority).accounts({ authority: wallet.publicKey }).instruction();
|
|
79793
|
+
return sendTx(connection, wallet, [ix]);
|
|
79735
79794
|
}
|
|
79736
79795
|
async function deleteAgent(connection, wallet, agentId, options) {
|
|
79737
79796
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
79738
79797
|
const record = await getAgentRecord(connection, agentId, options);
|
|
79739
|
-
const memoryAccount = record.memory.equals(
|
|
79740
|
-
|
|
79798
|
+
const memoryAccount = record.memory.equals(import_web389.PublicKey.default) ? wallet.publicKey : record.memory;
|
|
79799
|
+
const ix = await program3.methods.deleteAgent(agentId).accounts({
|
|
79741
79800
|
authority: wallet.publicKey,
|
|
79742
79801
|
memoryAccount
|
|
79743
|
-
}).
|
|
79802
|
+
}).instruction();
|
|
79803
|
+
return sendTx(connection, wallet, [ix]);
|
|
79744
79804
|
}
|
|
79745
79805
|
async function setBio(connection, wallet, agentId, bio, options) {
|
|
79746
79806
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
79747
|
-
|
|
79807
|
+
const ix = await program3.methods.setBio(agentId, bio).accounts({ authority: wallet.publicKey }).instruction();
|
|
79808
|
+
return sendTx(connection, wallet, [ix]);
|
|
79748
79809
|
}
|
|
79749
79810
|
async function setMetadata(connection, wallet, agentId, data, options) {
|
|
79750
79811
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
79751
|
-
|
|
79812
|
+
const ix = await program3.methods.setMetadata(agentId, data).accounts({ authority: wallet.publicKey }).instruction();
|
|
79813
|
+
return sendTx(connection, wallet, [ix]);
|
|
79752
79814
|
}
|
|
79753
79815
|
async function uploadMemory(connection, wallet, agentId, data, options, mode = "auto") {
|
|
79754
79816
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
@@ -79756,76 +79818,77 @@ async function uploadMemory(connection, wallet, agentId, data, options, mode = "
|
|
|
79756
79818
|
const totalLen = data.length;
|
|
79757
79819
|
const record = await getAgentRecord(connection, agentId, options);
|
|
79758
79820
|
const existingMemory = record.memory;
|
|
79759
|
-
const hasMemory = !existingMemory.equals(
|
|
79821
|
+
const hasMemory = !existingMemory.equals(import_web389.PublicKey.default);
|
|
79760
79822
|
let resolvedMode;
|
|
79761
79823
|
if (mode === "auto") {
|
|
79762
79824
|
resolvedMode = hasMemory ? "update" : "new";
|
|
79763
79825
|
} else {
|
|
79764
79826
|
resolvedMode = mode;
|
|
79765
79827
|
}
|
|
79766
|
-
const bufferKeypair =
|
|
79828
|
+
const bufferKeypair = import_web389.Keypair.generate();
|
|
79767
79829
|
const bufferSize = BUFFER_HEADER_SIZE + totalLen;
|
|
79768
79830
|
const bufferRent = await connection.getMinimumBalanceForRentExemption(bufferSize);
|
|
79769
|
-
const
|
|
79770
|
-
|
|
79771
|
-
|
|
79772
|
-
|
|
79773
|
-
|
|
79774
|
-
|
|
79775
|
-
|
|
79776
|
-
|
|
79777
|
-
)
|
|
79778
|
-
await sendAndConfirmTx(connection, createBufferTx, [wallet, bufferKeypair]);
|
|
79779
|
-
await program3.methods.initBuffer(agentId, totalLen).accounts({
|
|
79831
|
+
const createBufferIx = import_web389.SystemProgram.createAccount({
|
|
79832
|
+
fromPubkey: wallet.publicKey,
|
|
79833
|
+
newAccountPubkey: bufferKeypair.publicKey,
|
|
79834
|
+
lamports: bufferRent,
|
|
79835
|
+
space: bufferSize,
|
|
79836
|
+
programId: program3.programId
|
|
79837
|
+
});
|
|
79838
|
+
await sendTx(connection, wallet, [createBufferIx], [bufferKeypair]);
|
|
79839
|
+
const initBufferIx = await program3.methods.initBuffer(agentId, totalLen).accounts({
|
|
79780
79840
|
authority: wallet.publicKey,
|
|
79781
79841
|
buffer: bufferKeypair.publicKey
|
|
79782
|
-
}).
|
|
79842
|
+
}).instruction();
|
|
79843
|
+
await sendTx(connection, wallet, [initBufferIx]);
|
|
79783
79844
|
const totalChunks = Math.ceil(totalLen / chunkSize);
|
|
79784
79845
|
let offset = 0;
|
|
79785
79846
|
let chunkIndex = 0;
|
|
79786
79847
|
while (offset < totalLen) {
|
|
79787
79848
|
const chunk = Buffer.from(data.slice(offset, offset + chunkSize));
|
|
79788
|
-
const
|
|
79849
|
+
const writeIx = await program3.methods.writeToBuffer(agentId, offset, chunk).accounts({
|
|
79789
79850
|
authority: wallet.publicKey,
|
|
79790
79851
|
buffer: bufferKeypair.publicKey
|
|
79791
|
-
}).
|
|
79852
|
+
}).instruction();
|
|
79853
|
+
const writeSig = await sendTx(connection, wallet, [writeIx]);
|
|
79792
79854
|
offset += chunk.length;
|
|
79793
79855
|
chunkIndex++;
|
|
79794
79856
|
options?.onProgress?.(chunkIndex, totalChunks, writeSig);
|
|
79795
79857
|
}
|
|
79796
79858
|
if (resolvedMode === "append") {
|
|
79797
|
-
|
|
79859
|
+
const appendIx = await program3.methods.finalizeMemoryAppend(agentId).accounts({
|
|
79798
79860
|
authority: wallet.publicKey,
|
|
79799
79861
|
buffer: bufferKeypair.publicKey,
|
|
79800
79862
|
memory: existingMemory
|
|
79801
|
-
}).
|
|
79863
|
+
}).instruction();
|
|
79864
|
+
return sendTx(connection, wallet, [appendIx]);
|
|
79802
79865
|
}
|
|
79803
|
-
const memoryKeypair =
|
|
79866
|
+
const memoryKeypair = import_web389.Keypair.generate();
|
|
79804
79867
|
const memorySize = MEMORY_HEADER_SIZE + totalLen;
|
|
79805
79868
|
const memoryRent = await connection.getMinimumBalanceForRentExemption(memorySize);
|
|
79806
|
-
const
|
|
79807
|
-
|
|
79808
|
-
|
|
79809
|
-
|
|
79810
|
-
|
|
79811
|
-
|
|
79812
|
-
|
|
79813
|
-
|
|
79814
|
-
);
|
|
79815
|
-
await sendAndConfirmTx(connection, createMemoryTx, [wallet, memoryKeypair]);
|
|
79869
|
+
const createMemoryIx = import_web389.SystemProgram.createAccount({
|
|
79870
|
+
fromPubkey: wallet.publicKey,
|
|
79871
|
+
newAccountPubkey: memoryKeypair.publicKey,
|
|
79872
|
+
lamports: memoryRent,
|
|
79873
|
+
space: memorySize,
|
|
79874
|
+
programId: program3.programId
|
|
79875
|
+
});
|
|
79876
|
+
await sendTx(connection, wallet, [createMemoryIx], [memoryKeypair]);
|
|
79816
79877
|
if (resolvedMode === "update") {
|
|
79817
|
-
|
|
79878
|
+
const updateIx = await program3.methods.finalizeMemoryUpdate(agentId).accounts({
|
|
79818
79879
|
authority: wallet.publicKey,
|
|
79819
79880
|
buffer: bufferKeypair.publicKey,
|
|
79820
79881
|
newMemory: memoryKeypair.publicKey,
|
|
79821
79882
|
oldMemory: existingMemory
|
|
79822
|
-
}).
|
|
79883
|
+
}).instruction();
|
|
79884
|
+
return sendTx(connection, wallet, [updateIx]);
|
|
79823
79885
|
} else {
|
|
79824
|
-
|
|
79886
|
+
const newIx = await program3.methods.finalizeMemoryNew(agentId).accounts({
|
|
79825
79887
|
authority: wallet.publicKey,
|
|
79826
79888
|
buffer: bufferKeypair.publicKey,
|
|
79827
79889
|
newMemory: memoryKeypair.publicKey
|
|
79828
|
-
}).
|
|
79890
|
+
}).instruction();
|
|
79891
|
+
return sendTx(connection, wallet, [newIx]);
|
|
79829
79892
|
}
|
|
79830
79893
|
}
|
|
79831
79894
|
async function closeBuffer(connection, wallet, agentId, options) {
|
|
@@ -79834,7 +79897,8 @@ async function closeBuffer(connection, wallet, agentId, options) {
|
|
|
79834
79897
|
if (!record.pendingBuffer) {
|
|
79835
79898
|
throw new Error(`Agent "${agentId}" has no pending buffer`);
|
|
79836
79899
|
}
|
|
79837
|
-
|
|
79900
|
+
const ix = await program3.methods.closeBuffer(agentId).accounts({ authority: wallet.publicKey, buffer: record.pendingBuffer }).instruction();
|
|
79901
|
+
return sendTx(connection, wallet, [ix]);
|
|
79838
79902
|
}
|
|
79839
79903
|
async function logActivity(connection, wallet, agentId, model, activity, log, options) {
|
|
79840
79904
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
@@ -79845,11 +79909,12 @@ async function logActivity(connection, wallet, agentId, model, activity, log, op
|
|
|
79845
79909
|
true,
|
|
79846
79910
|
TOKEN_2022_PROGRAM_ID
|
|
79847
79911
|
);
|
|
79848
|
-
|
|
79912
|
+
const ix = await program3.methods.logActivity(agentId, model, activity, log).accounts({
|
|
79849
79913
|
authority: wallet.publicKey,
|
|
79850
79914
|
authorityPointAccount,
|
|
79851
|
-
instructions:
|
|
79852
|
-
}).
|
|
79915
|
+
instructions: import_web389.SYSVAR_INSTRUCTIONS_PUBKEY
|
|
79916
|
+
}).instruction();
|
|
79917
|
+
return sendTx(connection, wallet, [ix]);
|
|
79853
79918
|
}
|
|
79854
79919
|
async function logActivityWithReferral(connection, wallet, agentId, model, activity, log, referralAgentId, options) {
|
|
79855
79920
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
@@ -79868,18 +79933,19 @@ async function logActivityWithReferral(connection, wallet, agentId, model, activ
|
|
|
79868
79933
|
true,
|
|
79869
79934
|
TOKEN_2022_PROGRAM_ID
|
|
79870
79935
|
);
|
|
79871
|
-
|
|
79936
|
+
const ix = await program3.methods.logActivityWithReferral(agentId, model, activity, log).accounts({
|
|
79872
79937
|
authority: wallet.publicKey,
|
|
79873
79938
|
authorityPointAccount,
|
|
79874
79939
|
referralAgent,
|
|
79875
79940
|
referralAuthority,
|
|
79876
79941
|
referralPointAccount,
|
|
79877
79942
|
referralRefereeActivityAccount,
|
|
79878
|
-
instructions:
|
|
79879
|
-
}).
|
|
79943
|
+
instructions: import_web389.SYSVAR_INSTRUCTIONS_PUBKEY
|
|
79944
|
+
}).instruction();
|
|
79945
|
+
return sendTx(connection, wallet, [ix]);
|
|
79880
79946
|
}
|
|
79881
79947
|
async function makeLogActivityIx(connection, authority, agentId, model, activity, log, options) {
|
|
79882
|
-
const program3 = createProgram(connection,
|
|
79948
|
+
const program3 = createProgram(connection, import_web389.Keypair.generate(), options?.programId);
|
|
79883
79949
|
const pointMint = getPointMintPda(program3.programId);
|
|
79884
79950
|
const authorityPointAccount = getAssociatedTokenAddressSync(
|
|
79885
79951
|
pointMint,
|
|
@@ -79890,11 +79956,11 @@ async function makeLogActivityIx(connection, authority, agentId, model, activity
|
|
|
79890
79956
|
return program3.methods.logActivity(agentId, model, activity, log).accounts({
|
|
79891
79957
|
authority,
|
|
79892
79958
|
authorityPointAccount,
|
|
79893
|
-
instructions:
|
|
79959
|
+
instructions: import_web389.SYSVAR_INSTRUCTIONS_PUBKEY
|
|
79894
79960
|
}).instruction();
|
|
79895
79961
|
}
|
|
79896
79962
|
async function makeLogActivityWithReferralIx(connection, authority, agentId, model, activity, log, referralAgentId, options) {
|
|
79897
|
-
const program3 = createProgram(connection,
|
|
79963
|
+
const program3 = createProgram(connection, import_web389.Keypair.generate(), options?.programId);
|
|
79898
79964
|
const pointMint = getPointMintPda(program3.programId);
|
|
79899
79965
|
const authorityPointAccount = getAssociatedTokenAddressSync(
|
|
79900
79966
|
pointMint,
|
|
@@ -79917,7 +79983,7 @@ async function makeLogActivityWithReferralIx(connection, authority, agentId, mod
|
|
|
79917
79983
|
referralAuthority,
|
|
79918
79984
|
referralPointAccount,
|
|
79919
79985
|
referralRefereeActivityAccount,
|
|
79920
|
-
instructions:
|
|
79986
|
+
instructions: import_web389.SYSVAR_INSTRUCTIONS_PUBKEY
|
|
79921
79987
|
}).instruction();
|
|
79922
79988
|
}
|
|
79923
79989
|
async function setReferral(connection, wallet, agentId, referralAgentId, options) {
|
|
@@ -79927,7 +79993,7 @@ async function setReferral(connection, wallet, agentId, referralAgentId, options
|
|
|
79927
79993
|
if (!accountInfo) {
|
|
79928
79994
|
throw new Error(`Referral agent "${referralAgentId}" not found`);
|
|
79929
79995
|
}
|
|
79930
|
-
const referralAuthority = new
|
|
79996
|
+
const referralAuthority = new import_web389.PublicKey(accountInfo.data.subarray(8, 40));
|
|
79931
79997
|
const refereeMint = getRefereeMintPda(program3.programId);
|
|
79932
79998
|
const referralRefereeAccount = getAssociatedTokenAddressSync(
|
|
79933
79999
|
refereeMint,
|
|
@@ -79935,57 +80001,66 @@ async function setReferral(connection, wallet, agentId, referralAgentId, options
|
|
|
79935
80001
|
true,
|
|
79936
80002
|
TOKEN_2022_PROGRAM_ID
|
|
79937
80003
|
);
|
|
79938
|
-
|
|
80004
|
+
const ix = await program3.methods.setReferral(agentId).accounts({
|
|
79939
80005
|
authority: wallet.publicKey,
|
|
79940
80006
|
referralAgent,
|
|
79941
80007
|
referralAuthority,
|
|
79942
80008
|
referralRefereeAccount
|
|
79943
|
-
}).
|
|
80009
|
+
}).instruction();
|
|
80010
|
+
return sendTx(connection, wallet, [ix]);
|
|
79944
80011
|
}
|
|
79945
80012
|
async function initConfig(connection, wallet, options) {
|
|
79946
80013
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
79947
|
-
|
|
80014
|
+
const ix = await program3.methods.initConfig().accounts({ admin: wallet.publicKey }).instruction();
|
|
80015
|
+
return sendTx(connection, wallet, [ix]);
|
|
79948
80016
|
}
|
|
79949
80017
|
async function updateAdmin(connection, wallet, newAdmin, options) {
|
|
79950
80018
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
79951
|
-
|
|
80019
|
+
const ix = await program3.methods.updateAdmin(newAdmin).accounts({ admin: wallet.publicKey }).instruction();
|
|
80020
|
+
return sendTx(connection, wallet, [ix]);
|
|
79952
80021
|
}
|
|
79953
80022
|
async function updateFeeRecipient(connection, wallet, newRecipient, options) {
|
|
79954
80023
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
79955
|
-
|
|
80024
|
+
const ix = await program3.methods.updateFeeRecipient(newRecipient).accounts({ admin: wallet.publicKey }).instruction();
|
|
80025
|
+
return sendTx(connection, wallet, [ix]);
|
|
79956
80026
|
}
|
|
79957
80027
|
async function updateRegisterFee(connection, wallet, newFee, options) {
|
|
79958
80028
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
79959
80029
|
const fee = typeof newFee === "number" ? new anchor.BN(newFee) : newFee;
|
|
79960
|
-
|
|
80030
|
+
const ix = await program3.methods.updateRegisterFee(fee).accounts({ admin: wallet.publicKey }).instruction();
|
|
80031
|
+
return sendTx(connection, wallet, [ix]);
|
|
79961
80032
|
}
|
|
79962
80033
|
async function updatePointsConfig(connection, wallet, pointsSelf, pointsReferral, options) {
|
|
79963
80034
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
79964
80035
|
const ps = typeof pointsSelf === "number" ? new anchor.BN(pointsSelf) : pointsSelf;
|
|
79965
80036
|
const pr = typeof pointsReferral === "number" ? new anchor.BN(pointsReferral) : pointsReferral;
|
|
79966
|
-
|
|
80037
|
+
const ix = await program3.methods.updatePointsConfig(ps, pr).accounts({ admin: wallet.publicKey }).instruction();
|
|
80038
|
+
return sendTx(connection, wallet, [ix]);
|
|
79967
80039
|
}
|
|
79968
80040
|
async function updateReferralConfig(connection, wallet, referralRegisterFee, referralFeeShare, referralRegisterPoints, options) {
|
|
79969
80041
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
79970
80042
|
const fee = typeof referralRegisterFee === "number" ? new anchor.BN(referralRegisterFee) : referralRegisterFee;
|
|
79971
80043
|
const share = typeof referralFeeShare === "number" ? new anchor.BN(referralFeeShare) : referralFeeShare;
|
|
79972
80044
|
const pts = typeof referralRegisterPoints === "number" ? new anchor.BN(referralRegisterPoints) : referralRegisterPoints;
|
|
79973
|
-
|
|
80045
|
+
const ix = await program3.methods.updateReferralConfig(fee, share, pts).accounts({ admin: wallet.publicKey }).instruction();
|
|
80046
|
+
return sendTx(connection, wallet, [ix]);
|
|
79974
80047
|
}
|
|
79975
80048
|
async function updateActivityConfig(connection, wallet, activityReward, referralActivityReward, options) {
|
|
79976
80049
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
79977
80050
|
const ar = typeof activityReward === "number" ? new anchor.BN(activityReward) : activityReward;
|
|
79978
80051
|
const rar = typeof referralActivityReward === "number" ? new anchor.BN(referralActivityReward) : referralActivityReward;
|
|
79979
|
-
|
|
80052
|
+
const ix = await program3.methods.updateActivityConfig(ar, rar).accounts({ admin: wallet.publicKey }).instruction();
|
|
80053
|
+
return sendTx(connection, wallet, [ix]);
|
|
79980
80054
|
}
|
|
79981
|
-
var
|
|
80055
|
+
var import_web389, anchor, import_anchor, DEFAULT_CHUNK_SIZE, BUFFER_HEADER_SIZE, MEMORY_HEADER_SIZE, BIO_META_HEADER_SIZE;
|
|
79982
80056
|
var init_agent_registry = __esm({
|
|
79983
80057
|
"node_modules/nara-sdk/src/agent_registry.ts"() {
|
|
79984
|
-
|
|
80058
|
+
import_web389 = __toESM(require_index_cjs(), 1);
|
|
79985
80059
|
anchor = __toESM(require_cjs(), 1);
|
|
79986
80060
|
import_anchor = __toESM(require_cjs(), 1);
|
|
79987
80061
|
init_esm2();
|
|
79988
80062
|
init_constants2();
|
|
80063
|
+
init_tx();
|
|
79989
80064
|
init_nara_agent_registry();
|
|
79990
80065
|
DEFAULT_CHUNK_SIZE = 800;
|
|
79991
80066
|
BUFFER_HEADER_SIZE = 144;
|
|
@@ -124265,10 +124340,10 @@ var {
|
|
|
124265
124340
|
} = import_index.default;
|
|
124266
124341
|
|
|
124267
124342
|
// src/cli/index.ts
|
|
124268
|
-
var
|
|
124343
|
+
var import_web3103 = __toESM(require_index_cjs(), 1);
|
|
124269
124344
|
|
|
124270
124345
|
// src/cli/commands/wallet.ts
|
|
124271
|
-
var
|
|
124346
|
+
var import_web397 = __toESM(require_index_cjs(), 1);
|
|
124272
124347
|
init_esm2();
|
|
124273
124348
|
var bip39 = __toESM(require_src3(), 1);
|
|
124274
124349
|
var import_ed25519_hd_key = __toESM(require_dist3(), 1);
|
|
@@ -124428,13 +124503,16 @@ var NaraSDK = class {
|
|
|
124428
124503
|
|
|
124429
124504
|
// node_modules/nara-sdk/index.ts
|
|
124430
124505
|
init_constants2();
|
|
124506
|
+
init_tx();
|
|
124431
124507
|
|
|
124432
124508
|
// node_modules/nara-sdk/src/quest.ts
|
|
124433
|
-
var
|
|
124509
|
+
var import_web390 = __toESM(require_index_cjs(), 1);
|
|
124510
|
+
init_esm2();
|
|
124434
124511
|
var anchor2 = __toESM(require_cjs(), 1);
|
|
124435
124512
|
var import_anchor2 = __toESM(require_cjs(), 1);
|
|
124436
124513
|
var import_bn = __toESM(require_bn(), 1);
|
|
124437
124514
|
init_constants2();
|
|
124515
|
+
init_tx();
|
|
124438
124516
|
|
|
124439
124517
|
// node_modules/nara-sdk/src/idls/nara_quest.json
|
|
124440
124518
|
var nara_quest_default = {
|
|
@@ -124806,40 +124884,112 @@ var nara_quest_default = {
|
|
|
124806
124884
|
}
|
|
124807
124885
|
},
|
|
124808
124886
|
{
|
|
124809
|
-
name: "
|
|
124887
|
+
name: "stake_token_account",
|
|
124810
124888
|
writable: true,
|
|
124811
124889
|
pda: {
|
|
124812
124890
|
seeds: [
|
|
124891
|
+
{
|
|
124892
|
+
kind: "account",
|
|
124893
|
+
path: "stake_record"
|
|
124894
|
+
},
|
|
124813
124895
|
{
|
|
124814
124896
|
kind: "const",
|
|
124815
124897
|
value: [
|
|
124816
|
-
|
|
124817
|
-
|
|
124818
|
-
|
|
124819
|
-
|
|
124820
|
-
|
|
124821
|
-
95,
|
|
124822
|
-
115,
|
|
124823
|
-
116,
|
|
124824
|
-
97,
|
|
124825
|
-
107,
|
|
124898
|
+
6,
|
|
124899
|
+
221,
|
|
124900
|
+
246,
|
|
124901
|
+
225,
|
|
124902
|
+
215,
|
|
124826
124903
|
101,
|
|
124904
|
+
161,
|
|
124905
|
+
147,
|
|
124906
|
+
217,
|
|
124907
|
+
203,
|
|
124908
|
+
225,
|
|
124909
|
+
70,
|
|
124910
|
+
206,
|
|
124911
|
+
235,
|
|
124912
|
+
121,
|
|
124913
|
+
172,
|
|
124914
|
+
28,
|
|
124915
|
+
180,
|
|
124916
|
+
133,
|
|
124917
|
+
237,
|
|
124827
124918
|
95,
|
|
124828
|
-
|
|
124829
|
-
|
|
124830
|
-
|
|
124831
|
-
|
|
124832
|
-
|
|
124919
|
+
91,
|
|
124920
|
+
55,
|
|
124921
|
+
145,
|
|
124922
|
+
58,
|
|
124923
|
+
140,
|
|
124924
|
+
245,
|
|
124925
|
+
133,
|
|
124926
|
+
126,
|
|
124927
|
+
255,
|
|
124928
|
+
0,
|
|
124929
|
+
169
|
|
124833
124930
|
]
|
|
124931
|
+
},
|
|
124932
|
+
{
|
|
124933
|
+
kind: "account",
|
|
124934
|
+
path: "wsol_mint"
|
|
124834
124935
|
}
|
|
124835
|
-
]
|
|
124936
|
+
],
|
|
124937
|
+
program: {
|
|
124938
|
+
kind: "const",
|
|
124939
|
+
value: [
|
|
124940
|
+
140,
|
|
124941
|
+
151,
|
|
124942
|
+
37,
|
|
124943
|
+
143,
|
|
124944
|
+
78,
|
|
124945
|
+
36,
|
|
124946
|
+
137,
|
|
124947
|
+
241,
|
|
124948
|
+
187,
|
|
124949
|
+
61,
|
|
124950
|
+
16,
|
|
124951
|
+
41,
|
|
124952
|
+
20,
|
|
124953
|
+
142,
|
|
124954
|
+
13,
|
|
124955
|
+
131,
|
|
124956
|
+
11,
|
|
124957
|
+
90,
|
|
124958
|
+
19,
|
|
124959
|
+
153,
|
|
124960
|
+
218,
|
|
124961
|
+
255,
|
|
124962
|
+
16,
|
|
124963
|
+
132,
|
|
124964
|
+
4,
|
|
124965
|
+
142,
|
|
124966
|
+
123,
|
|
124967
|
+
216,
|
|
124968
|
+
219,
|
|
124969
|
+
233,
|
|
124970
|
+
248,
|
|
124971
|
+
89
|
|
124972
|
+
]
|
|
124973
|
+
}
|
|
124836
124974
|
}
|
|
124837
124975
|
},
|
|
124976
|
+
{
|
|
124977
|
+
name: "wsol_mint",
|
|
124978
|
+
address: "So11111111111111111111111111111111111111112"
|
|
124979
|
+
},
|
|
124838
124980
|
{
|
|
124839
124981
|
name: "user",
|
|
124840
124982
|
writable: true,
|
|
124841
124983
|
signer: true
|
|
124842
124984
|
},
|
|
124985
|
+
{
|
|
124986
|
+
name: "token_program",
|
|
124987
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
124988
|
+
},
|
|
124989
|
+
{
|
|
124990
|
+
name: "associated_token_program",
|
|
124991
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
124992
|
+
},
|
|
124843
124993
|
{
|
|
124844
124994
|
name: "system_program",
|
|
124845
124995
|
address: "11111111111111111111111111111111"
|
|
@@ -124945,6 +125095,100 @@ var nara_quest_default = {
|
|
|
124945
125095
|
]
|
|
124946
125096
|
}
|
|
124947
125097
|
},
|
|
125098
|
+
{
|
|
125099
|
+
name: "stake_token_account",
|
|
125100
|
+
writable: true,
|
|
125101
|
+
pda: {
|
|
125102
|
+
seeds: [
|
|
125103
|
+
{
|
|
125104
|
+
kind: "account",
|
|
125105
|
+
path: "stake_record"
|
|
125106
|
+
},
|
|
125107
|
+
{
|
|
125108
|
+
kind: "const",
|
|
125109
|
+
value: [
|
|
125110
|
+
6,
|
|
125111
|
+
221,
|
|
125112
|
+
246,
|
|
125113
|
+
225,
|
|
125114
|
+
215,
|
|
125115
|
+
101,
|
|
125116
|
+
161,
|
|
125117
|
+
147,
|
|
125118
|
+
217,
|
|
125119
|
+
203,
|
|
125120
|
+
225,
|
|
125121
|
+
70,
|
|
125122
|
+
206,
|
|
125123
|
+
235,
|
|
125124
|
+
121,
|
|
125125
|
+
172,
|
|
125126
|
+
28,
|
|
125127
|
+
180,
|
|
125128
|
+
133,
|
|
125129
|
+
237,
|
|
125130
|
+
95,
|
|
125131
|
+
91,
|
|
125132
|
+
55,
|
|
125133
|
+
145,
|
|
125134
|
+
58,
|
|
125135
|
+
140,
|
|
125136
|
+
245,
|
|
125137
|
+
133,
|
|
125138
|
+
126,
|
|
125139
|
+
255,
|
|
125140
|
+
0,
|
|
125141
|
+
169
|
|
125142
|
+
]
|
|
125143
|
+
},
|
|
125144
|
+
{
|
|
125145
|
+
kind: "account",
|
|
125146
|
+
path: "wsol_mint"
|
|
125147
|
+
}
|
|
125148
|
+
],
|
|
125149
|
+
program: {
|
|
125150
|
+
kind: "const",
|
|
125151
|
+
value: [
|
|
125152
|
+
140,
|
|
125153
|
+
151,
|
|
125154
|
+
37,
|
|
125155
|
+
143,
|
|
125156
|
+
78,
|
|
125157
|
+
36,
|
|
125158
|
+
137,
|
|
125159
|
+
241,
|
|
125160
|
+
187,
|
|
125161
|
+
61,
|
|
125162
|
+
16,
|
|
125163
|
+
41,
|
|
125164
|
+
20,
|
|
125165
|
+
142,
|
|
125166
|
+
13,
|
|
125167
|
+
131,
|
|
125168
|
+
11,
|
|
125169
|
+
90,
|
|
125170
|
+
19,
|
|
125171
|
+
153,
|
|
125172
|
+
218,
|
|
125173
|
+
255,
|
|
125174
|
+
16,
|
|
125175
|
+
132,
|
|
125176
|
+
4,
|
|
125177
|
+
142,
|
|
125178
|
+
123,
|
|
125179
|
+
216,
|
|
125180
|
+
219,
|
|
125181
|
+
233,
|
|
125182
|
+
248,
|
|
125183
|
+
89
|
|
125184
|
+
]
|
|
125185
|
+
}
|
|
125186
|
+
}
|
|
125187
|
+
},
|
|
125188
|
+
{
|
|
125189
|
+
name: "wsol_mint",
|
|
125190
|
+
address: "So11111111111111111111111111111111111111112"
|
|
125191
|
+
},
|
|
124948
125192
|
{
|
|
124949
125193
|
name: "vault",
|
|
124950
125194
|
writable: true,
|
|
@@ -124978,6 +125222,14 @@ var nara_quest_default = {
|
|
|
124978
125222
|
writable: true,
|
|
124979
125223
|
signer: true
|
|
124980
125224
|
},
|
|
125225
|
+
{
|
|
125226
|
+
name: "token_program",
|
|
125227
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
125228
|
+
},
|
|
125229
|
+
{
|
|
125230
|
+
name: "associated_token_program",
|
|
125231
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
125232
|
+
},
|
|
124981
125233
|
{
|
|
124982
125234
|
name: "system_program",
|
|
124983
125235
|
address: "11111111111111111111111111111111"
|
|
@@ -125135,40 +125387,202 @@ var nara_quest_default = {
|
|
|
125135
125387
|
}
|
|
125136
125388
|
},
|
|
125137
125389
|
{
|
|
125138
|
-
name: "
|
|
125390
|
+
name: "stake_token_account",
|
|
125139
125391
|
writable: true,
|
|
125140
125392
|
pda: {
|
|
125141
125393
|
seeds: [
|
|
125394
|
+
{
|
|
125395
|
+
kind: "account",
|
|
125396
|
+
path: "stake_record"
|
|
125397
|
+
},
|
|
125142
125398
|
{
|
|
125143
125399
|
kind: "const",
|
|
125144
125400
|
value: [
|
|
125145
|
-
|
|
125146
|
-
|
|
125401
|
+
6,
|
|
125402
|
+
221,
|
|
125403
|
+
246,
|
|
125404
|
+
225,
|
|
125405
|
+
215,
|
|
125147
125406
|
101,
|
|
125148
|
-
|
|
125149
|
-
|
|
125407
|
+
161,
|
|
125408
|
+
147,
|
|
125409
|
+
217,
|
|
125410
|
+
203,
|
|
125411
|
+
225,
|
|
125412
|
+
70,
|
|
125413
|
+
206,
|
|
125414
|
+
235,
|
|
125415
|
+
121,
|
|
125416
|
+
172,
|
|
125417
|
+
28,
|
|
125418
|
+
180,
|
|
125419
|
+
133,
|
|
125420
|
+
237,
|
|
125150
125421
|
95,
|
|
125151
|
-
|
|
125152
|
-
|
|
125153
|
-
|
|
125154
|
-
|
|
125422
|
+
91,
|
|
125423
|
+
55,
|
|
125424
|
+
145,
|
|
125425
|
+
58,
|
|
125426
|
+
140,
|
|
125427
|
+
245,
|
|
125428
|
+
133,
|
|
125429
|
+
126,
|
|
125430
|
+
255,
|
|
125431
|
+
0,
|
|
125432
|
+
169
|
|
125433
|
+
]
|
|
125434
|
+
},
|
|
125435
|
+
{
|
|
125436
|
+
kind: "account",
|
|
125437
|
+
path: "wsol_mint"
|
|
125438
|
+
}
|
|
125439
|
+
],
|
|
125440
|
+
program: {
|
|
125441
|
+
kind: "const",
|
|
125442
|
+
value: [
|
|
125443
|
+
140,
|
|
125444
|
+
151,
|
|
125445
|
+
37,
|
|
125446
|
+
143,
|
|
125447
|
+
78,
|
|
125448
|
+
36,
|
|
125449
|
+
137,
|
|
125450
|
+
241,
|
|
125451
|
+
187,
|
|
125452
|
+
61,
|
|
125453
|
+
16,
|
|
125454
|
+
41,
|
|
125455
|
+
20,
|
|
125456
|
+
142,
|
|
125457
|
+
13,
|
|
125458
|
+
131,
|
|
125459
|
+
11,
|
|
125460
|
+
90,
|
|
125461
|
+
19,
|
|
125462
|
+
153,
|
|
125463
|
+
218,
|
|
125464
|
+
255,
|
|
125465
|
+
16,
|
|
125466
|
+
132,
|
|
125467
|
+
4,
|
|
125468
|
+
142,
|
|
125469
|
+
123,
|
|
125470
|
+
216,
|
|
125471
|
+
219,
|
|
125472
|
+
233,
|
|
125473
|
+
248,
|
|
125474
|
+
89
|
|
125475
|
+
]
|
|
125476
|
+
}
|
|
125477
|
+
}
|
|
125478
|
+
},
|
|
125479
|
+
{
|
|
125480
|
+
name: "user_token_account",
|
|
125481
|
+
writable: true,
|
|
125482
|
+
pda: {
|
|
125483
|
+
seeds: [
|
|
125484
|
+
{
|
|
125485
|
+
kind: "account",
|
|
125486
|
+
path: "user"
|
|
125487
|
+
},
|
|
125488
|
+
{
|
|
125489
|
+
kind: "const",
|
|
125490
|
+
value: [
|
|
125491
|
+
6,
|
|
125492
|
+
221,
|
|
125493
|
+
246,
|
|
125494
|
+
225,
|
|
125495
|
+
215,
|
|
125155
125496
|
101,
|
|
125497
|
+
161,
|
|
125498
|
+
147,
|
|
125499
|
+
217,
|
|
125500
|
+
203,
|
|
125501
|
+
225,
|
|
125502
|
+
70,
|
|
125503
|
+
206,
|
|
125504
|
+
235,
|
|
125505
|
+
121,
|
|
125506
|
+
172,
|
|
125507
|
+
28,
|
|
125508
|
+
180,
|
|
125509
|
+
133,
|
|
125510
|
+
237,
|
|
125156
125511
|
95,
|
|
125157
|
-
|
|
125158
|
-
|
|
125159
|
-
|
|
125160
|
-
|
|
125161
|
-
|
|
125512
|
+
91,
|
|
125513
|
+
55,
|
|
125514
|
+
145,
|
|
125515
|
+
58,
|
|
125516
|
+
140,
|
|
125517
|
+
245,
|
|
125518
|
+
133,
|
|
125519
|
+
126,
|
|
125520
|
+
255,
|
|
125521
|
+
0,
|
|
125522
|
+
169
|
|
125162
125523
|
]
|
|
125524
|
+
},
|
|
125525
|
+
{
|
|
125526
|
+
kind: "account",
|
|
125527
|
+
path: "wsol_mint"
|
|
125163
125528
|
}
|
|
125164
|
-
]
|
|
125529
|
+
],
|
|
125530
|
+
program: {
|
|
125531
|
+
kind: "const",
|
|
125532
|
+
value: [
|
|
125533
|
+
140,
|
|
125534
|
+
151,
|
|
125535
|
+
37,
|
|
125536
|
+
143,
|
|
125537
|
+
78,
|
|
125538
|
+
36,
|
|
125539
|
+
137,
|
|
125540
|
+
241,
|
|
125541
|
+
187,
|
|
125542
|
+
61,
|
|
125543
|
+
16,
|
|
125544
|
+
41,
|
|
125545
|
+
20,
|
|
125546
|
+
142,
|
|
125547
|
+
13,
|
|
125548
|
+
131,
|
|
125549
|
+
11,
|
|
125550
|
+
90,
|
|
125551
|
+
19,
|
|
125552
|
+
153,
|
|
125553
|
+
218,
|
|
125554
|
+
255,
|
|
125555
|
+
16,
|
|
125556
|
+
132,
|
|
125557
|
+
4,
|
|
125558
|
+
142,
|
|
125559
|
+
123,
|
|
125560
|
+
216,
|
|
125561
|
+
219,
|
|
125562
|
+
233,
|
|
125563
|
+
248,
|
|
125564
|
+
89
|
|
125565
|
+
]
|
|
125566
|
+
}
|
|
125165
125567
|
}
|
|
125166
125568
|
},
|
|
125569
|
+
{
|
|
125570
|
+
name: "wsol_mint",
|
|
125571
|
+
address: "So11111111111111111111111111111111111111112"
|
|
125572
|
+
},
|
|
125167
125573
|
{
|
|
125168
125574
|
name: "user",
|
|
125169
125575
|
writable: true,
|
|
125170
125576
|
signer: true
|
|
125171
125577
|
},
|
|
125578
|
+
{
|
|
125579
|
+
name: "token_program",
|
|
125580
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
125581
|
+
},
|
|
125582
|
+
{
|
|
125583
|
+
name: "associated_token_program",
|
|
125584
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
125585
|
+
},
|
|
125172
125586
|
{
|
|
125173
125587
|
name: "system_program",
|
|
125174
125588
|
address: "11111111111111111111111111111111"
|
|
@@ -125446,10 +125860,6 @@ var nara_quest_default = {
|
|
|
125446
125860
|
type: {
|
|
125447
125861
|
kind: "struct",
|
|
125448
125862
|
fields: [
|
|
125449
|
-
{
|
|
125450
|
-
name: "amount",
|
|
125451
|
-
type: "u64"
|
|
125452
|
-
},
|
|
125453
125863
|
{
|
|
125454
125864
|
name: "stake_round",
|
|
125455
125865
|
type: "u64"
|
|
@@ -125590,28 +126000,32 @@ function createProgram2(connection, wallet, programId) {
|
|
|
125590
126000
|
return new import_anchor2.Program(idlWithPid, provider);
|
|
125591
126001
|
}
|
|
125592
126002
|
function getPoolPda(programId) {
|
|
125593
|
-
const [pda] =
|
|
126003
|
+
const [pda] = import_web390.PublicKey.findProgramAddressSync(
|
|
125594
126004
|
[new TextEncoder().encode("quest_pool")],
|
|
125595
126005
|
programId
|
|
125596
126006
|
);
|
|
125597
126007
|
return pda;
|
|
125598
126008
|
}
|
|
125599
126009
|
function getWinnerRecordPda(programId, user) {
|
|
125600
|
-
const [pda] =
|
|
126010
|
+
const [pda] = import_web390.PublicKey.findProgramAddressSync(
|
|
125601
126011
|
[new TextEncoder().encode("quest_winner"), user.toBytes()],
|
|
125602
126012
|
programId
|
|
125603
126013
|
);
|
|
125604
126014
|
return pda;
|
|
125605
126015
|
}
|
|
125606
126016
|
function getStakeRecordPda(programId, user) {
|
|
125607
|
-
const [pda] =
|
|
126017
|
+
const [pda] = import_web390.PublicKey.findProgramAddressSync(
|
|
125608
126018
|
[new TextEncoder().encode("quest_stake"), user.toBytes()],
|
|
125609
126019
|
programId
|
|
125610
126020
|
);
|
|
125611
126021
|
return pda;
|
|
125612
126022
|
}
|
|
126023
|
+
var WSOL_MINT = new import_web390.PublicKey("So11111111111111111111111111111111111111112");
|
|
126024
|
+
function getStakeTokenAccount(stakeRecordPda) {
|
|
126025
|
+
return getAssociatedTokenAddressSync(WSOL_MINT, stakeRecordPda, true);
|
|
126026
|
+
}
|
|
125613
126027
|
async function getQuestInfo(connection, wallet, options) {
|
|
125614
|
-
const kp = wallet ??
|
|
126028
|
+
const kp = wallet ?? import_web390.Keypair.generate();
|
|
125615
126029
|
const program3 = createProgram2(connection, kp, options?.programId);
|
|
125616
126030
|
const poolPda = getPoolPda(program3.programId);
|
|
125617
126031
|
const pool = await program3.account.pool.fetch(poolPda);
|
|
@@ -125624,8 +126038,8 @@ async function getQuestInfo(connection, wallet, options) {
|
|
|
125624
126038
|
round: pool.round.toString(),
|
|
125625
126039
|
question: pool.question,
|
|
125626
126040
|
answerHash: Array.from(pool.answerHash),
|
|
125627
|
-
rewardPerWinner: pool.rewardPerWinner.toNumber() /
|
|
125628
|
-
totalReward: pool.rewardAmount.toNumber() /
|
|
126041
|
+
rewardPerWinner: pool.rewardPerWinner.toNumber() / import_web390.LAMPORTS_PER_SOL,
|
|
126042
|
+
totalReward: pool.rewardAmount.toNumber() / import_web390.LAMPORTS_PER_SOL,
|
|
125629
126043
|
rewardCount: pool.rewardCount,
|
|
125630
126044
|
winnerCount: pool.winnerCount,
|
|
125631
126045
|
remainingSlots: Math.max(0, pool.rewardCount - pool.winnerCount),
|
|
@@ -125633,8 +126047,8 @@ async function getQuestInfo(connection, wallet, options) {
|
|
|
125633
126047
|
deadline,
|
|
125634
126048
|
timeRemaining: secsLeft,
|
|
125635
126049
|
expired: secsLeft <= 0,
|
|
125636
|
-
stakeRequirement: Number(pool.stakeRequirement.toString()) /
|
|
125637
|
-
minWinnerStake: Number(pool.minWinnerStake.toString()) /
|
|
126050
|
+
stakeRequirement: Number(pool.stakeRequirement.toString()) / import_web390.LAMPORTS_PER_SOL,
|
|
126051
|
+
minWinnerStake: Number(pool.minWinnerStake.toString()) / import_web390.LAMPORTS_PER_SOL
|
|
125638
126052
|
};
|
|
125639
126053
|
}
|
|
125640
126054
|
async function hasAnswered(connection, wallet, options) {
|
|
@@ -125688,52 +126102,42 @@ async function submitAnswer(connection, wallet, proof, agent = "", model = "", o
|
|
|
125688
126102
|
const current = stakeInfo?.amount ?? 0;
|
|
125689
126103
|
const deficit = required - current;
|
|
125690
126104
|
if (deficit > 0) {
|
|
125691
|
-
stakeLamports = new import_bn.default(Math.round(deficit *
|
|
126105
|
+
stakeLamports = new import_bn.default(Math.round(deficit * import_web390.LAMPORTS_PER_SOL));
|
|
125692
126106
|
} else {
|
|
125693
126107
|
stakeLamports = new import_bn.default(0);
|
|
125694
126108
|
}
|
|
125695
126109
|
} else {
|
|
125696
|
-
stakeLamports = new import_bn.default(Math.round(options.stake *
|
|
126110
|
+
stakeLamports = new import_bn.default(Math.round(options.stake * import_web390.LAMPORTS_PER_SOL));
|
|
125697
126111
|
}
|
|
125698
126112
|
if (!stakeLamports.isZero()) {
|
|
125699
126113
|
stakeIx = await program3.methods.stake(stakeLamports).accounts({ user: wallet.publicKey }).instruction();
|
|
125700
126114
|
}
|
|
125701
126115
|
}
|
|
125702
|
-
|
|
125703
|
-
|
|
125704
|
-
|
|
125705
|
-
|
|
125706
|
-
|
|
125707
|
-
|
|
125708
|
-
|
|
125709
|
-
|
|
125710
|
-
|
|
125711
|
-
|
|
125712
|
-
|
|
125713
|
-
|
|
125714
|
-
|
|
125715
|
-
|
|
125716
|
-
|
|
125717
|
-
|
|
125718
|
-
|
|
125719
|
-
|
|
125720
|
-
|
|
125721
|
-
|
|
125722
|
-
|
|
125723
|
-
|
|
125724
|
-
|
|
125725
|
-
tx.add(logIx);
|
|
125726
|
-
}
|
|
125727
|
-
tx.feePayer = wallet.publicKey;
|
|
125728
|
-
tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
|
|
125729
|
-
tx.sign(wallet);
|
|
125730
|
-
const signature2 = await connection.sendRawTransaction(tx.serialize(), {
|
|
125731
|
-
skipPreflight: true
|
|
125732
|
-
});
|
|
125733
|
-
await connection.confirmTransaction(signature2, "confirmed");
|
|
125734
|
-
return { signature: signature2 };
|
|
126116
|
+
const submitIx = await program3.methods.submitAnswer(proof.proofA, proof.proofB, proof.proofC, agent, model).accounts({ user: wallet.publicKey, payer: wallet.publicKey }).instruction();
|
|
126117
|
+
const ixs = [];
|
|
126118
|
+
if (stakeIx) ixs.push(stakeIx);
|
|
126119
|
+
ixs.push(submitIx);
|
|
126120
|
+
if (activityLog) {
|
|
126121
|
+
const { makeLogActivityIx: makeLogActivityIx2, makeLogActivityWithReferralIx: makeLogActivityWithReferralIx2 } = await Promise.resolve().then(() => (init_agent_registry(), agent_registry_exports));
|
|
126122
|
+
const logIx = activityLog.referralAgentId ? await makeLogActivityWithReferralIx2(
|
|
126123
|
+
connection,
|
|
126124
|
+
wallet.publicKey,
|
|
126125
|
+
activityLog.agentId,
|
|
126126
|
+
activityLog.model,
|
|
126127
|
+
activityLog.activity,
|
|
126128
|
+
activityLog.log,
|
|
126129
|
+
activityLog.referralAgentId
|
|
126130
|
+
) : await makeLogActivityIx2(
|
|
126131
|
+
connection,
|
|
126132
|
+
wallet.publicKey,
|
|
126133
|
+
activityLog.agentId,
|
|
126134
|
+
activityLog.model,
|
|
126135
|
+
activityLog.activity,
|
|
126136
|
+
activityLog.log
|
|
126137
|
+
);
|
|
126138
|
+
ixs.push(logIx);
|
|
125735
126139
|
}
|
|
125736
|
-
const signature = await
|
|
126140
|
+
const signature = await sendTx(connection, wallet, ixs, [], { skipPreflight: true });
|
|
125737
126141
|
return { signature };
|
|
125738
126142
|
}
|
|
125739
126143
|
async function submitAnswerViaRelay(relayUrl, userPubkey, proof, agent = "", model = "") {
|
|
@@ -125787,28 +126191,37 @@ async function parseQuestReward(connection, txSignature, retries = 10) {
|
|
|
125787
126191
|
return {
|
|
125788
126192
|
rewarded: rewardLamports > 0,
|
|
125789
126193
|
rewardLamports,
|
|
125790
|
-
rewardNso: rewardLamports /
|
|
126194
|
+
rewardNso: rewardLamports / import_web390.LAMPORTS_PER_SOL,
|
|
125791
126195
|
winner
|
|
125792
126196
|
};
|
|
125793
126197
|
}
|
|
125794
126198
|
async function stake(connection, wallet, amount, options) {
|
|
125795
126199
|
const program3 = createProgram2(connection, wallet, options?.programId);
|
|
125796
|
-
const lamports = new import_bn.default(Math.round(amount *
|
|
125797
|
-
|
|
126200
|
+
const lamports = new import_bn.default(Math.round(amount * import_web390.LAMPORTS_PER_SOL));
|
|
126201
|
+
const ix = await program3.methods.stake(lamports).accounts({ user: wallet.publicKey }).instruction();
|
|
126202
|
+
return sendTx(connection, wallet, [ix]);
|
|
125798
126203
|
}
|
|
125799
126204
|
async function unstake(connection, wallet, amount, options) {
|
|
125800
126205
|
const program3 = createProgram2(connection, wallet, options?.programId);
|
|
125801
|
-
const lamports = new import_bn.default(Math.round(amount *
|
|
125802
|
-
|
|
126206
|
+
const lamports = new import_bn.default(Math.round(amount * import_web390.LAMPORTS_PER_SOL));
|
|
126207
|
+
const ix = await program3.methods.unstake(lamports).accounts({ user: wallet.publicKey }).instruction();
|
|
126208
|
+
return sendTx(connection, wallet, [ix]);
|
|
125803
126209
|
}
|
|
125804
126210
|
async function getStakeInfo(connection, user, options) {
|
|
125805
|
-
const kp =
|
|
126211
|
+
const kp = import_web390.Keypair.generate();
|
|
125806
126212
|
const program3 = createProgram2(connection, kp, options?.programId);
|
|
125807
126213
|
const stakeRecordPda = getStakeRecordPda(program3.programId, user);
|
|
125808
126214
|
try {
|
|
125809
126215
|
const record = await program3.account.stakeRecord.fetch(stakeRecordPda);
|
|
126216
|
+
const stakeTokenAccount = getStakeTokenAccount(stakeRecordPda);
|
|
126217
|
+
let amount = 0;
|
|
126218
|
+
try {
|
|
126219
|
+
const balance = await connection.getTokenAccountBalance(stakeTokenAccount);
|
|
126220
|
+
amount = Number(balance.value.amount) / import_web390.LAMPORTS_PER_SOL;
|
|
126221
|
+
} catch {
|
|
126222
|
+
}
|
|
125810
126223
|
return {
|
|
125811
|
-
amount
|
|
126224
|
+
amount,
|
|
125812
126225
|
stakeRound: record.stakeRound.toNumber()
|
|
125813
126226
|
};
|
|
125814
126227
|
} catch {
|
|
@@ -125817,7 +126230,7 @@ async function getStakeInfo(connection, user, options) {
|
|
|
125817
126230
|
}
|
|
125818
126231
|
|
|
125819
126232
|
// node_modules/nara-sdk/src/skills.ts
|
|
125820
|
-
var
|
|
126233
|
+
var import_web391 = __toESM(require_index_cjs(), 1);
|
|
125821
126234
|
var anchor3 = __toESM(require_cjs(), 1);
|
|
125822
126235
|
var import_anchor3 = __toESM(require_cjs(), 1);
|
|
125823
126236
|
init_constants2();
|
|
@@ -127172,34 +127585,10 @@ var nara_skills_hub_default = {
|
|
|
127172
127585
|
};
|
|
127173
127586
|
|
|
127174
127587
|
// node_modules/nara-sdk/src/skills.ts
|
|
127588
|
+
init_tx();
|
|
127175
127589
|
var DEFAULT_CHUNK_SIZE2 = 800;
|
|
127176
127590
|
var BUFFER_HEADER_SIZE2 = 144;
|
|
127177
127591
|
var CONTENT_HEADER_SIZE = 104;
|
|
127178
|
-
async function sendAndConfirmTx2(connection, tx, signers) {
|
|
127179
|
-
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
|
|
127180
|
-
tx.recentBlockhash = blockhash;
|
|
127181
|
-
tx.feePayer = signers[0].publicKey;
|
|
127182
|
-
tx.sign(...signers);
|
|
127183
|
-
const rawTx = tx.serialize();
|
|
127184
|
-
const sig = await connection.sendRawTransaction(rawTx, {
|
|
127185
|
-
skipPreflight: false
|
|
127186
|
-
});
|
|
127187
|
-
while (true) {
|
|
127188
|
-
const { value } = await connection.getSignatureStatuses([sig]);
|
|
127189
|
-
const status = value[0];
|
|
127190
|
-
if (status) {
|
|
127191
|
-
if (status.err) throw new Error(`Transaction failed: ${JSON.stringify(status.err)}`);
|
|
127192
|
-
if (status.confirmationStatus === "confirmed" || status.confirmationStatus === "finalized") {
|
|
127193
|
-
return sig;
|
|
127194
|
-
}
|
|
127195
|
-
}
|
|
127196
|
-
const currentHeight = await connection.getBlockHeight("confirmed");
|
|
127197
|
-
if (currentHeight > lastValidBlockHeight) {
|
|
127198
|
-
throw new Error(`Transaction expired (blockhash no longer valid): ${sig}`);
|
|
127199
|
-
}
|
|
127200
|
-
await new Promise((r) => setTimeout(r, 1e3));
|
|
127201
|
-
}
|
|
127202
|
-
}
|
|
127203
127592
|
function createProgram3(connection, wallet, programId) {
|
|
127204
127593
|
const idl = nara_skills_hub_default;
|
|
127205
127594
|
const pid = programId ?? DEFAULT_SKILLS_PROGRAM_ID;
|
|
@@ -127211,28 +127600,28 @@ function createProgram3(connection, wallet, programId) {
|
|
|
127211
127600
|
return new import_anchor3.Program(idlWithPid, provider);
|
|
127212
127601
|
}
|
|
127213
127602
|
function getSkillPda(programId, name) {
|
|
127214
|
-
const [pda] =
|
|
127603
|
+
const [pda] = import_web391.PublicKey.findProgramAddressSync(
|
|
127215
127604
|
[Buffer.from("skill"), Buffer.from(name)],
|
|
127216
127605
|
programId
|
|
127217
127606
|
);
|
|
127218
127607
|
return pda;
|
|
127219
127608
|
}
|
|
127220
127609
|
function getConfigPda2(programId) {
|
|
127221
|
-
const [pda] =
|
|
127610
|
+
const [pda] = import_web391.PublicKey.findProgramAddressSync(
|
|
127222
127611
|
[Buffer.from("config")],
|
|
127223
127612
|
programId
|
|
127224
127613
|
);
|
|
127225
127614
|
return pda;
|
|
127226
127615
|
}
|
|
127227
127616
|
function getDescPda(programId, skillPubkey) {
|
|
127228
|
-
const [pda] =
|
|
127617
|
+
const [pda] = import_web391.PublicKey.findProgramAddressSync(
|
|
127229
127618
|
[Buffer.from("desc"), skillPubkey.toBuffer()],
|
|
127230
127619
|
programId
|
|
127231
127620
|
);
|
|
127232
127621
|
return pda;
|
|
127233
127622
|
}
|
|
127234
127623
|
function getMetaPda2(programId, skillPubkey) {
|
|
127235
|
-
const [pda] =
|
|
127624
|
+
const [pda] = import_web391.PublicKey.findProgramAddressSync(
|
|
127236
127625
|
[Buffer.from("meta"), skillPubkey.toBuffer()],
|
|
127237
127626
|
programId
|
|
127238
127627
|
);
|
|
@@ -127241,11 +127630,11 @@ function getMetaPda2(programId, skillPubkey) {
|
|
|
127241
127630
|
function parseSkillRecordData(data) {
|
|
127242
127631
|
const buf = Buffer.from(data);
|
|
127243
127632
|
let offset = 8;
|
|
127244
|
-
const authority = new
|
|
127633
|
+
const authority = new import_web391.PublicKey(buf.subarray(offset, offset + 32));
|
|
127245
127634
|
offset += 32;
|
|
127246
|
-
const content = new
|
|
127635
|
+
const content = new import_web391.PublicKey(buf.subarray(offset, offset + 32));
|
|
127247
127636
|
offset += 32;
|
|
127248
|
-
const pendingBuffer = new
|
|
127637
|
+
const pendingBuffer = new import_web391.PublicKey(buf.subarray(offset, offset + 32));
|
|
127249
127638
|
offset += 32;
|
|
127250
127639
|
const createdAt = Number(buf.readBigInt64LE(offset));
|
|
127251
127640
|
offset += 8;
|
|
@@ -127264,7 +127653,7 @@ function parseSkillRecordData(data) {
|
|
|
127264
127653
|
authority,
|
|
127265
127654
|
name,
|
|
127266
127655
|
author,
|
|
127267
|
-
pendingBuffer: pendingBuffer.equals(
|
|
127656
|
+
pendingBuffer: pendingBuffer.equals(import_web391.PublicKey.default) ? null : pendingBuffer,
|
|
127268
127657
|
content,
|
|
127269
127658
|
version: version3,
|
|
127270
127659
|
createdAt,
|
|
@@ -127288,20 +127677,21 @@ async function registerSkill(connection, wallet, name, author, options) {
|
|
|
127288
127677
|
const configInfo = await connection.getAccountInfo(configPda);
|
|
127289
127678
|
if (!configInfo) throw new Error("Skills program config not initialized");
|
|
127290
127679
|
const configBuf = Buffer.from(configInfo.data);
|
|
127291
|
-
const feeRecipient = new
|
|
127292
|
-
const
|
|
127680
|
+
const feeRecipient = new import_web391.PublicKey(configBuf.subarray(48, 80));
|
|
127681
|
+
const ix = await program3.methods.registerSkill(name, author).accounts({
|
|
127293
127682
|
authority: wallet.publicKey,
|
|
127294
127683
|
feeRecipient
|
|
127295
|
-
}).
|
|
127684
|
+
}).instruction();
|
|
127685
|
+
const signature = await sendTx(connection, wallet, [ix]);
|
|
127296
127686
|
const skillPubkey = getSkillPda(program3.programId, name);
|
|
127297
127687
|
return { signature, skillPubkey };
|
|
127298
127688
|
}
|
|
127299
127689
|
async function getSkillRecord(connection, name, options) {
|
|
127300
|
-
const pid = new
|
|
127690
|
+
const pid = new import_web391.PublicKey(options?.programId ?? DEFAULT_SKILLS_PROGRAM_ID);
|
|
127301
127691
|
return fetchSkillRecord(connection, name, pid);
|
|
127302
127692
|
}
|
|
127303
127693
|
async function getSkillInfo(connection, name, options) {
|
|
127304
|
-
const pid = new
|
|
127694
|
+
const pid = new import_web391.PublicKey(options?.programId ?? DEFAULT_SKILLS_PROGRAM_ID);
|
|
127305
127695
|
const skillPda = getSkillPda(pid, name);
|
|
127306
127696
|
const accountInfo = await connection.getAccountInfo(skillPda);
|
|
127307
127697
|
if (!accountInfo) {
|
|
@@ -127333,9 +127723,9 @@ async function getSkillInfo(connection, name, options) {
|
|
|
127333
127723
|
return { record, description, metadata };
|
|
127334
127724
|
}
|
|
127335
127725
|
async function getSkillContent(connection, name, options) {
|
|
127336
|
-
const pid = new
|
|
127726
|
+
const pid = new import_web391.PublicKey(options?.programId ?? DEFAULT_SKILLS_PROGRAM_ID);
|
|
127337
127727
|
const record = await fetchSkillRecord(connection, name, pid);
|
|
127338
|
-
if (record.content.equals(
|
|
127728
|
+
if (record.content.equals(import_web391.PublicKey.default)) {
|
|
127339
127729
|
return null;
|
|
127340
127730
|
}
|
|
127341
127731
|
const accountInfo = await connection.getAccountInfo(record.content);
|
|
@@ -127344,15 +127734,18 @@ async function getSkillContent(connection, name, options) {
|
|
|
127344
127734
|
}
|
|
127345
127735
|
async function setDescription(connection, wallet, name, description, options) {
|
|
127346
127736
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
127347
|
-
|
|
127737
|
+
const ix = await program3.methods.setDescription(name, description).accounts({ authority: wallet.publicKey }).instruction();
|
|
127738
|
+
return sendTx(connection, wallet, [ix]);
|
|
127348
127739
|
}
|
|
127349
127740
|
async function updateMetadata(connection, wallet, name, data, options) {
|
|
127350
127741
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
127351
|
-
|
|
127742
|
+
const ix = await program3.methods.updateMetadata(name, data).accounts({ authority: wallet.publicKey }).instruction();
|
|
127743
|
+
return sendTx(connection, wallet, [ix]);
|
|
127352
127744
|
}
|
|
127353
127745
|
async function transferAuthority(connection, wallet, name, newAuthority, options) {
|
|
127354
127746
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
127355
|
-
|
|
127747
|
+
const ix = await program3.methods.transferAuthority(name, newAuthority).accounts({ authority: wallet.publicKey }).instruction();
|
|
127748
|
+
return sendTx(connection, wallet, [ix]);
|
|
127356
127749
|
}
|
|
127357
127750
|
async function closeBuffer2(connection, wallet, name, options) {
|
|
127358
127751
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
@@ -127360,16 +127753,18 @@ async function closeBuffer2(connection, wallet, name, options) {
|
|
|
127360
127753
|
if (!record.pendingBuffer) {
|
|
127361
127754
|
throw new Error(`Skill "${name}" has no pending buffer`);
|
|
127362
127755
|
}
|
|
127363
|
-
|
|
127756
|
+
const ix = await program3.methods.closeBuffer(name).accounts({ authority: wallet.publicKey, buffer: record.pendingBuffer }).instruction();
|
|
127757
|
+
return sendTx(connection, wallet, [ix]);
|
|
127364
127758
|
}
|
|
127365
127759
|
async function deleteSkill(connection, wallet, name, options) {
|
|
127366
127760
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
127367
127761
|
const record = await fetchSkillRecord(connection, name, program3.programId);
|
|
127368
|
-
const contentAccount = record.content.equals(
|
|
127369
|
-
|
|
127762
|
+
const contentAccount = record.content.equals(import_web391.PublicKey.default) ? wallet.publicKey : record.content;
|
|
127763
|
+
const ix = await program3.methods.deleteSkill(name).accounts({
|
|
127370
127764
|
authority: wallet.publicKey,
|
|
127371
127765
|
contentAccount
|
|
127372
|
-
}).
|
|
127766
|
+
}).instruction();
|
|
127767
|
+
return sendTx(connection, wallet, [ix]);
|
|
127373
127768
|
}
|
|
127374
127769
|
async function uploadSkillContent(connection, wallet, name, content, options) {
|
|
127375
127770
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
@@ -127377,74 +127772,75 @@ async function uploadSkillContent(connection, wallet, name, content, options) {
|
|
|
127377
127772
|
const totalLen = content.length;
|
|
127378
127773
|
const record = await fetchSkillRecord(connection, name, program3.programId);
|
|
127379
127774
|
const existingContent = record.content;
|
|
127380
|
-
const isUpdate = !existingContent.equals(
|
|
127381
|
-
const bufferKeypair =
|
|
127775
|
+
const isUpdate = !existingContent.equals(import_web391.PublicKey.default);
|
|
127776
|
+
const bufferKeypair = import_web391.Keypair.generate();
|
|
127382
127777
|
const bufferSize = BUFFER_HEADER_SIZE2 + totalLen;
|
|
127383
127778
|
const bufferRent = await connection.getMinimumBalanceForRentExemption(bufferSize);
|
|
127384
|
-
const
|
|
127385
|
-
|
|
127386
|
-
|
|
127387
|
-
|
|
127388
|
-
|
|
127389
|
-
|
|
127390
|
-
|
|
127391
|
-
|
|
127392
|
-
)
|
|
127393
|
-
await sendAndConfirmTx2(connection, createBufferTx, [wallet, bufferKeypair]);
|
|
127394
|
-
await program3.methods.initBuffer(name, totalLen).accounts({
|
|
127779
|
+
const createBufferIx = import_web391.SystemProgram.createAccount({
|
|
127780
|
+
fromPubkey: wallet.publicKey,
|
|
127781
|
+
newAccountPubkey: bufferKeypair.publicKey,
|
|
127782
|
+
lamports: bufferRent,
|
|
127783
|
+
space: bufferSize,
|
|
127784
|
+
programId: program3.programId
|
|
127785
|
+
});
|
|
127786
|
+
await sendTx(connection, wallet, [createBufferIx], [bufferKeypair]);
|
|
127787
|
+
const initBufferIx = await program3.methods.initBuffer(name, totalLen).accounts({
|
|
127395
127788
|
authority: wallet.publicKey,
|
|
127396
127789
|
buffer: bufferKeypair.publicKey
|
|
127397
|
-
}).
|
|
127790
|
+
}).instruction();
|
|
127791
|
+
await sendTx(connection, wallet, [initBufferIx]);
|
|
127398
127792
|
const totalChunks = Math.ceil(totalLen / chunkSize);
|
|
127399
127793
|
let offset = 0;
|
|
127400
127794
|
let chunkIndex = 0;
|
|
127401
127795
|
while (offset < totalLen) {
|
|
127402
127796
|
const chunk = Buffer.from(content.slice(offset, offset + chunkSize));
|
|
127403
|
-
const
|
|
127797
|
+
const writeIx = await program3.methods.writeToBuffer(name, offset, chunk).accounts({
|
|
127404
127798
|
authority: wallet.publicKey,
|
|
127405
127799
|
buffer: bufferKeypair.publicKey
|
|
127406
|
-
}).
|
|
127800
|
+
}).instruction();
|
|
127801
|
+
const writeSig = await sendTx(connection, wallet, [writeIx]);
|
|
127407
127802
|
offset += chunk.length;
|
|
127408
127803
|
chunkIndex++;
|
|
127409
127804
|
options?.onProgress?.(chunkIndex, totalChunks, writeSig);
|
|
127410
127805
|
}
|
|
127411
|
-
const contentKeypair =
|
|
127806
|
+
const contentKeypair = import_web391.Keypair.generate();
|
|
127412
127807
|
const contentSize = CONTENT_HEADER_SIZE + totalLen;
|
|
127413
127808
|
const contentRent = await connection.getMinimumBalanceForRentExemption(contentSize);
|
|
127414
|
-
const
|
|
127415
|
-
|
|
127416
|
-
|
|
127417
|
-
|
|
127418
|
-
|
|
127419
|
-
|
|
127420
|
-
|
|
127421
|
-
|
|
127422
|
-
);
|
|
127423
|
-
await sendAndConfirmTx2(connection, createContentTx, [wallet, contentKeypair]);
|
|
127809
|
+
const createContentIx = import_web391.SystemProgram.createAccount({
|
|
127810
|
+
fromPubkey: wallet.publicKey,
|
|
127811
|
+
newAccountPubkey: contentKeypair.publicKey,
|
|
127812
|
+
lamports: contentRent,
|
|
127813
|
+
space: contentSize,
|
|
127814
|
+
programId: program3.programId
|
|
127815
|
+
});
|
|
127816
|
+
await sendTx(connection, wallet, [createContentIx], [contentKeypair]);
|
|
127424
127817
|
if (isUpdate) {
|
|
127425
|
-
|
|
127818
|
+
const finalizeIx = await program3.methods.finalizeSkillUpdate(name).accounts({
|
|
127426
127819
|
authority: wallet.publicKey,
|
|
127427
127820
|
buffer: bufferKeypair.publicKey,
|
|
127428
127821
|
newContent: contentKeypair.publicKey,
|
|
127429
127822
|
oldContent: existingContent
|
|
127430
|
-
}).
|
|
127823
|
+
}).instruction();
|
|
127824
|
+
return sendTx(connection, wallet, [finalizeIx]);
|
|
127431
127825
|
} else {
|
|
127432
|
-
|
|
127826
|
+
const finalizeIx = await program3.methods.finalizeSkillNew(name).accounts({
|
|
127433
127827
|
authority: wallet.publicKey,
|
|
127434
127828
|
buffer: bufferKeypair.publicKey,
|
|
127435
127829
|
newContent: contentKeypair.publicKey
|
|
127436
|
-
}).
|
|
127830
|
+
}).instruction();
|
|
127831
|
+
return sendTx(connection, wallet, [finalizeIx]);
|
|
127437
127832
|
}
|
|
127438
127833
|
}
|
|
127439
127834
|
|
|
127440
127835
|
// node_modules/nara-sdk/src/zkid.ts
|
|
127441
|
-
var
|
|
127836
|
+
var import_web392 = __toESM(require_index_cjs(), 1);
|
|
127442
127837
|
var anchor4 = __toESM(require_cjs(), 1);
|
|
127443
127838
|
var import_anchor4 = __toESM(require_cjs(), 1);
|
|
127444
127839
|
init_main3();
|
|
127445
127840
|
var import_tweetnacl = __toESM(require_nacl_fast(), 1);
|
|
127446
127841
|
var import_bn2 = __toESM(require_bn(), 1);
|
|
127447
127842
|
init_constants2();
|
|
127843
|
+
init_tx();
|
|
127448
127844
|
|
|
127449
127845
|
// node_modules/nara-sdk/src/idls/nara_zk.json
|
|
127450
127846
|
var nara_zk_default = {
|
|
@@ -128700,28 +129096,28 @@ function createReadProgram(connection, programId) {
|
|
|
128700
129096
|
const idlWithPid = { ...idl, address: pid };
|
|
128701
129097
|
const provider = new import_anchor4.AnchorProvider(
|
|
128702
129098
|
connection,
|
|
128703
|
-
new import_anchor4.Wallet(
|
|
129099
|
+
new import_anchor4.Wallet(import_web392.Keypair.generate()),
|
|
128704
129100
|
{ commitment: "confirmed" }
|
|
128705
129101
|
);
|
|
128706
129102
|
return new import_anchor4.Program(idlWithPid, provider);
|
|
128707
129103
|
}
|
|
128708
129104
|
function findZkIdPda(nameHashBuf, programId) {
|
|
128709
|
-
return
|
|
129105
|
+
return import_web392.PublicKey.findProgramAddressSync(
|
|
128710
129106
|
[new TextEncoder().encode("zk_id"), nameHashBuf],
|
|
128711
129107
|
programId
|
|
128712
129108
|
);
|
|
128713
129109
|
}
|
|
128714
129110
|
function findInboxPda(nameHashBuf, programId) {
|
|
128715
|
-
return
|
|
129111
|
+
return import_web392.PublicKey.findProgramAddressSync(
|
|
128716
129112
|
[new TextEncoder().encode("inbox"), nameHashBuf],
|
|
128717
129113
|
programId
|
|
128718
129114
|
);
|
|
128719
129115
|
}
|
|
128720
129116
|
function findConfigPda(programId) {
|
|
128721
|
-
return
|
|
129117
|
+
return import_web392.PublicKey.findProgramAddressSync([new TextEncoder().encode("config")], programId);
|
|
128722
129118
|
}
|
|
128723
129119
|
function findNullifierPda(denomination, nullifierHash, programId) {
|
|
128724
|
-
return
|
|
129120
|
+
return import_web392.PublicKey.findProgramAddressSync(
|
|
128725
129121
|
[new TextEncoder().encode("nullifier"), denomBuf(denomination), nullifierHash],
|
|
128726
129122
|
programId
|
|
128727
129123
|
);
|
|
@@ -128738,14 +129134,14 @@ function isValidRecipient(pubkey) {
|
|
|
128738
129134
|
}
|
|
128739
129135
|
function generateValidRecipient() {
|
|
128740
129136
|
for (let i = 0; i < 1e3; i++) {
|
|
128741
|
-
const kp =
|
|
129137
|
+
const kp = import_web392.Keypair.generate();
|
|
128742
129138
|
if (isValidRecipient(kp.publicKey)) return kp;
|
|
128743
129139
|
}
|
|
128744
129140
|
throw new Error("Could not generate valid recipient after 1000 tries");
|
|
128745
129141
|
}
|
|
128746
129142
|
async function getZkIdInfo(connection, name, options) {
|
|
128747
129143
|
const program3 = createReadProgram(connection, options?.programId);
|
|
128748
|
-
const programId = new
|
|
129144
|
+
const programId = new import_web392.PublicKey(options?.programId ?? DEFAULT_ZKID_PROGRAM_ID);
|
|
128749
129145
|
const [zkIdPda] = findZkIdPda(await computeNameHash(name), programId);
|
|
128750
129146
|
try {
|
|
128751
129147
|
const data = await program3.account.zkIdAccount.fetch(zkIdPda);
|
|
@@ -128761,25 +129157,27 @@ async function getZkIdInfo(connection, name, options) {
|
|
|
128761
129157
|
}
|
|
128762
129158
|
async function createZkId(connection, payer, name, idSecret, options) {
|
|
128763
129159
|
const program3 = createProgram4(connection, payer, options?.programId);
|
|
128764
|
-
const programId = new
|
|
129160
|
+
const programId = new import_web392.PublicKey(options?.programId ?? DEFAULT_ZKID_PROGRAM_ID);
|
|
128765
129161
|
const nameHashBuf = await computeNameHash(name);
|
|
128766
129162
|
const idCommitment = await poseidonHash([idSecret]);
|
|
128767
129163
|
const idCommitmentBuf = bigIntToBytes32BE(idCommitment);
|
|
128768
129164
|
const [configPda] = findConfigPda(programId);
|
|
128769
129165
|
const config = await program3.account.configAccount.fetch(configPda);
|
|
128770
|
-
|
|
129166
|
+
const ix = await program3.methods.register(toBytes32(nameHashBuf), toBytes32(idCommitmentBuf)).accounts({
|
|
128771
129167
|
payer: payer.publicKey,
|
|
128772
129168
|
feeRecipient: config.feeRecipient
|
|
128773
|
-
}).
|
|
129169
|
+
}).instruction();
|
|
129170
|
+
return sendTx(connection, payer, [ix]);
|
|
128774
129171
|
}
|
|
128775
129172
|
async function deposit(connection, payer, name, denomination, options) {
|
|
128776
129173
|
const program3 = createProgram4(connection, payer, options?.programId);
|
|
128777
129174
|
const nameHashBuf = await computeNameHash(name);
|
|
128778
|
-
|
|
129175
|
+
const ix = await program3.methods.deposit(toBytes32(nameHashBuf), denomination).accounts({ depositor: payer.publicKey }).instruction();
|
|
129176
|
+
return sendTx(connection, payer, [ix]);
|
|
128779
129177
|
}
|
|
128780
129178
|
async function scanClaimableDeposits(connection, name, idSecret, options) {
|
|
128781
129179
|
const program3 = createReadProgram(connection, options?.programId);
|
|
128782
|
-
const programId = new
|
|
129180
|
+
const programId = new import_web392.PublicKey(options?.programId ?? DEFAULT_ZKID_PROGRAM_ID);
|
|
128783
129181
|
const nameHashBuf = await computeNameHash(name);
|
|
128784
129182
|
const [zkIdPda] = findZkIdPda(nameHashBuf, programId);
|
|
128785
129183
|
const [inboxPda] = findInboxPda(nameHashBuf, programId);
|
|
@@ -128822,9 +129220,9 @@ async function withdraw(connection, payer, name, idSecret, depositInfo, recipien
|
|
|
128822
129220
|
);
|
|
128823
129221
|
}
|
|
128824
129222
|
const program3 = createProgram4(connection, payer, options?.programId);
|
|
128825
|
-
const programId = new
|
|
129223
|
+
const programId = new import_web392.PublicKey(options?.programId ?? DEFAULT_ZKID_PROGRAM_ID);
|
|
128826
129224
|
const denominationBN = new import_bn2.default(depositInfo.denomination.toString());
|
|
128827
|
-
const [treePda] =
|
|
129225
|
+
const [treePda] = import_web392.PublicKey.findProgramAddressSync(
|
|
128828
129226
|
[new TextEncoder().encode("tree"), denomBuf(denominationBN)],
|
|
128829
129227
|
programId
|
|
128830
129228
|
);
|
|
@@ -128863,7 +129261,7 @@ async function withdraw(connection, payer, name, idSecret, depositInfo, recipien
|
|
|
128863
129261
|
}
|
|
128864
129262
|
const { proof } = await silentProve2(input, wasmSource, zkeySource);
|
|
128865
129263
|
const packedProof = packProof(proof);
|
|
128866
|
-
|
|
129264
|
+
const ix = await program3.methods.withdraw(
|
|
128867
129265
|
Buffer.from(packedProof),
|
|
128868
129266
|
toBytes32(root),
|
|
128869
129267
|
toBytes32(nullifierHashBuf),
|
|
@@ -128872,7 +129270,8 @@ async function withdraw(connection, payer, name, idSecret, depositInfo, recipien
|
|
|
128872
129270
|
).accounts({
|
|
128873
129271
|
payer: payer.publicKey,
|
|
128874
129272
|
recipient
|
|
128875
|
-
}).
|
|
129273
|
+
}).instruction();
|
|
129274
|
+
return sendTx(connection, payer, [ix]);
|
|
128876
129275
|
}
|
|
128877
129276
|
async function computeIdCommitment(keypair, name) {
|
|
128878
129277
|
const idSecret = await deriveIdSecret(keypair, name);
|
|
@@ -128882,7 +129281,7 @@ async function computeIdCommitment(keypair, name) {
|
|
|
128882
129281
|
async function transferZkIdByCommitment(connection, payer, name, currentIdSecret, newIdCommitment, options) {
|
|
128883
129282
|
const program3 = createProgram4(connection, payer, options?.programId);
|
|
128884
129283
|
const nameHashBuf = await computeNameHash(name);
|
|
128885
|
-
const [zkIdPda] = findZkIdPda(nameHashBuf, new
|
|
129284
|
+
const [zkIdPda] = findZkIdPda(nameHashBuf, new import_web392.PublicKey(options?.programId ?? DEFAULT_ZKID_PROGRAM_ID));
|
|
128886
129285
|
const zkId = await program3.account.zkIdAccount.fetch(zkIdPda);
|
|
128887
129286
|
const currentCommitmentField = bytes32ToBigInt(
|
|
128888
129287
|
new Uint8Array(zkId.idCommitment)
|
|
@@ -128901,20 +129300,21 @@ async function transferZkIdByCommitment(connection, payer, name, currentIdSecret
|
|
|
128901
129300
|
}
|
|
128902
129301
|
const { proof } = await silentProve2(input, wasmSource, zkeySource);
|
|
128903
129302
|
const packedProof = packProof(proof);
|
|
128904
|
-
|
|
129303
|
+
const ix = await program3.methods.transferZkId(
|
|
128905
129304
|
toBytes32(nameHashBuf),
|
|
128906
129305
|
toBytes32(newCommitmentBuf),
|
|
128907
129306
|
Buffer.from(packedProof)
|
|
128908
|
-
).accounts({ payer: payer.publicKey }).
|
|
129307
|
+
).accounts({ payer: payer.publicKey }).instruction();
|
|
129308
|
+
return sendTx(connection, payer, [ix]);
|
|
128909
129309
|
}
|
|
128910
129310
|
|
|
128911
129311
|
// node_modules/nara-sdk/index.ts
|
|
128912
129312
|
init_agent_registry();
|
|
128913
|
-
var
|
|
129313
|
+
var import_web393 = __toESM(require_index_cjs(), 1);
|
|
128914
129314
|
var import_bn3 = __toESM(require_bn(), 1);
|
|
128915
129315
|
|
|
128916
129316
|
// src/cli/utils/wallet.ts
|
|
128917
|
-
var
|
|
129317
|
+
var import_web394 = __toESM(require_index_cjs(), 1);
|
|
128918
129318
|
var import_node_path2 = require("node:path");
|
|
128919
129319
|
var import_node_os2 = require("node:os");
|
|
128920
129320
|
|
|
@@ -129030,9 +129430,9 @@ async function loadWallet(walletPath) {
|
|
|
129030
129430
|
const file = await fs.readFile(path, "utf-8");
|
|
129031
129431
|
const data = JSON.parse(file);
|
|
129032
129432
|
if (Array.isArray(data)) {
|
|
129033
|
-
return
|
|
129433
|
+
return import_web394.Keypair.fromSecretKey(new Uint8Array(data));
|
|
129034
129434
|
} else if (data.secretKey) {
|
|
129035
|
-
return
|
|
129435
|
+
return import_web394.Keypair.fromSecretKey(new Uint8Array(data.secretKey));
|
|
129036
129436
|
} else {
|
|
129037
129437
|
throw new Error(
|
|
129038
129438
|
"Invalid wallet file format. Expected array or object with secretKey field."
|
|
@@ -129058,10 +129458,10 @@ function getRpcUrl(rpcUrl) {
|
|
|
129058
129458
|
}
|
|
129059
129459
|
|
|
129060
129460
|
// src/cli/utils/validation.ts
|
|
129061
|
-
var
|
|
129461
|
+
var import_web395 = __toESM(require_index_cjs(), 1);
|
|
129062
129462
|
function validatePublicKey(address) {
|
|
129063
129463
|
try {
|
|
129064
|
-
return new
|
|
129464
|
+
return new import_web395.PublicKey(address);
|
|
129065
129465
|
} catch (error) {
|
|
129066
129466
|
throw new Error(`Invalid Solana address: ${address}`);
|
|
129067
129467
|
}
|
|
@@ -129086,7 +129486,7 @@ function validateName(value, label) {
|
|
|
129086
129486
|
}
|
|
129087
129487
|
|
|
129088
129488
|
// src/cli/utils/transaction.ts
|
|
129089
|
-
var
|
|
129489
|
+
var import_web396 = __toESM(require_index_cjs(), 1);
|
|
129090
129490
|
|
|
129091
129491
|
// src/cli/utils/output.ts
|
|
129092
129492
|
function formatOutput(data, jsonMode = false) {
|
|
@@ -129171,7 +129571,7 @@ async function signAndSendTransaction(sdk, transaction, signers) {
|
|
|
129171
129571
|
try {
|
|
129172
129572
|
printInfo("Signing transaction...");
|
|
129173
129573
|
let signature;
|
|
129174
|
-
if (transaction instanceof
|
|
129574
|
+
if (transaction instanceof import_web396.VersionedTransaction) {
|
|
129175
129575
|
transaction.sign(signers);
|
|
129176
129576
|
printInfo("Sending transaction...");
|
|
129177
129577
|
signature = await connection.sendTransaction(transaction, {
|
|
@@ -129271,7 +129671,7 @@ async function handleWalletBalance(address, options) {
|
|
|
129271
129671
|
}
|
|
129272
129672
|
printInfo(`Checking balance for: ${pubkey.toBase58()}`);
|
|
129273
129673
|
const balance = await connection.getBalance(pubkey);
|
|
129274
|
-
const balanceSOL = balance /
|
|
129674
|
+
const balanceSOL = balance / import_web397.LAMPORTS_PER_SOL;
|
|
129275
129675
|
if (options.json) {
|
|
129276
129676
|
const output = {
|
|
129277
129677
|
address: pubkey.toBase58(),
|
|
@@ -129398,7 +129798,7 @@ Transaction: ${signature}`);
|
|
|
129398
129798
|
console.log(`Time: ${date.toISOString()}`);
|
|
129399
129799
|
}
|
|
129400
129800
|
if (output.fee) {
|
|
129401
|
-
console.log(`Fee: ${output.fee /
|
|
129801
|
+
console.log(`Fee: ${output.fee / import_web397.LAMPORTS_PER_SOL} NARA`);
|
|
129402
129802
|
}
|
|
129403
129803
|
if (output.error) {
|
|
129404
129804
|
console.log(`Error: ${JSON.stringify(output.error)}`);
|
|
@@ -129416,7 +129816,7 @@ async function handleTransferSol(to, amount, options) {
|
|
|
129416
129816
|
printInfo(`From: ${wallet.publicKey.toBase58()}`);
|
|
129417
129817
|
const recipient = validatePublicKey(to);
|
|
129418
129818
|
const amountSOL = validatePositiveNumber(amount, "amount");
|
|
129419
|
-
const lamports = Math.floor(amountSOL *
|
|
129819
|
+
const lamports = Math.floor(amountSOL * import_web397.LAMPORTS_PER_SOL);
|
|
129420
129820
|
printInfo(`To: ${recipient.toBase58()}`);
|
|
129421
129821
|
printInfo(`Amount: ${amountSOL} NARA`);
|
|
129422
129822
|
const sdk = new NaraSDK({
|
|
@@ -129424,12 +129824,12 @@ async function handleTransferSol(to, amount, options) {
|
|
|
129424
129824
|
commitment: "confirmed"
|
|
129425
129825
|
});
|
|
129426
129826
|
const connection = sdk.getConnection();
|
|
129427
|
-
const transferInstruction =
|
|
129827
|
+
const transferInstruction = import_web397.SystemProgram.transfer({
|
|
129428
129828
|
fromPubkey: wallet.publicKey,
|
|
129429
129829
|
toPubkey: recipient,
|
|
129430
129830
|
lamports
|
|
129431
129831
|
});
|
|
129432
|
-
const transaction = new
|
|
129832
|
+
const transaction = new import_web397.Transaction().add(transferInstruction);
|
|
129433
129833
|
const { blockhash } = await connection.getLatestBlockhash("confirmed");
|
|
129434
129834
|
transaction.recentBlockhash = blockhash;
|
|
129435
129835
|
transaction.feePayer = wallet.publicKey;
|
|
@@ -129492,7 +129892,7 @@ async function handleTransferToken(tokenAddress, to, amount, options) {
|
|
|
129492
129892
|
[],
|
|
129493
129893
|
TOKEN_PROGRAM_ID
|
|
129494
129894
|
);
|
|
129495
|
-
const transaction = new
|
|
129895
|
+
const transaction = new import_web397.Transaction().add(transferInstruction);
|
|
129496
129896
|
const { blockhash } = await connection.getLatestBlockhash("confirmed");
|
|
129497
129897
|
transaction.recentBlockhash = blockhash;
|
|
129498
129898
|
transaction.feePayer = wallet.publicKey;
|
|
@@ -129537,7 +129937,7 @@ async function handleWalletCreate(options) {
|
|
|
129537
129937
|
const mnemonic = bip39.generateMnemonic(128);
|
|
129538
129938
|
const seed = await bip39.mnemonicToSeed(mnemonic);
|
|
129539
129939
|
const derivedSeed = (0, import_ed25519_hd_key.derivePath)("m/44'/501'/0'/0'", seed.toString("hex")).key;
|
|
129540
|
-
const keypair =
|
|
129940
|
+
const keypair = import_web397.Keypair.fromSeed(derivedSeed);
|
|
129541
129941
|
const dir = outputPath.substring(0, outputPath.lastIndexOf("/"));
|
|
129542
129942
|
await (0, import_promises.mkdir)(dir, { recursive: true });
|
|
129543
129943
|
const walletData = Array.from(keypair.secretKey);
|
|
@@ -129573,16 +129973,16 @@ async function handleWalletImport(options) {
|
|
|
129573
129973
|
}
|
|
129574
129974
|
const seed = await bip39.mnemonicToSeed(mnemonic);
|
|
129575
129975
|
const derivedSeed = (0, import_ed25519_hd_key.derivePath)("m/44'/501'/0'/0'", seed.toString("hex")).key;
|
|
129576
|
-
keypair =
|
|
129976
|
+
keypair = import_web397.Keypair.fromSeed(derivedSeed);
|
|
129577
129977
|
printInfo("Importing wallet from mnemonic...");
|
|
129578
129978
|
} else if (options.privateKey) {
|
|
129579
129979
|
const privateKey = options.privateKey.trim();
|
|
129580
129980
|
try {
|
|
129581
129981
|
if (privateKey.startsWith("[")) {
|
|
129582
129982
|
const data = JSON.parse(privateKey);
|
|
129583
|
-
keypair =
|
|
129983
|
+
keypair = import_web397.Keypair.fromSecretKey(new Uint8Array(data));
|
|
129584
129984
|
} else {
|
|
129585
|
-
keypair =
|
|
129985
|
+
keypair = import_web397.Keypair.fromSecretKey(esm_default2.decode(privateKey));
|
|
129586
129986
|
}
|
|
129587
129987
|
printInfo("Importing wallet from private key...");
|
|
129588
129988
|
} catch (error) {
|
|
@@ -129611,7 +130011,7 @@ async function handleWalletAddress(options) {
|
|
|
129611
130011
|
}
|
|
129612
130012
|
|
|
129613
130013
|
// src/cli/commands/quest.ts
|
|
129614
|
-
var
|
|
130014
|
+
var import_web398 = __toESM(require_index_cjs(), 1);
|
|
129615
130015
|
var DEFAULT_QUEST_RELAY_URL2 = process.env.QUEST_RELAY_URL || "https://quest-api.nara.build/";
|
|
129616
130016
|
var QUEST_ERRORS = {
|
|
129617
130017
|
6e3: "unauthorized",
|
|
@@ -129644,12 +130044,12 @@ function formatTimeRemaining(seconds) {
|
|
|
129644
130044
|
}
|
|
129645
130045
|
async function handleQuestGet(options) {
|
|
129646
130046
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
129647
|
-
const connection = new
|
|
130047
|
+
const connection = new import_web398.Connection(rpcUrl, "confirmed");
|
|
129648
130048
|
let wallet;
|
|
129649
130049
|
try {
|
|
129650
130050
|
wallet = await loadWallet(options.wallet);
|
|
129651
130051
|
} catch {
|
|
129652
|
-
wallet =
|
|
130052
|
+
wallet = import_web398.Keypair.generate();
|
|
129653
130053
|
}
|
|
129654
130054
|
let quest;
|
|
129655
130055
|
try {
|
|
@@ -129706,7 +130106,7 @@ async function handleQuestGet(options) {
|
|
|
129706
130106
|
}
|
|
129707
130107
|
async function handleQuestAnswer(answer, options) {
|
|
129708
130108
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
129709
|
-
const connection = new
|
|
130109
|
+
const connection = new import_web398.Connection(rpcUrl, "confirmed");
|
|
129710
130110
|
const wallet = await loadWallet(options.wallet);
|
|
129711
130111
|
const networkConfig = loadNetworkConfig(rpcUrl);
|
|
129712
130112
|
const configAgentId = networkConfig.agent_ids[0];
|
|
@@ -129786,7 +130186,7 @@ async function handleQuestAnswer(answer, options) {
|
|
|
129786
130186
|
}
|
|
129787
130187
|
async function handleQuestStake(amount, options) {
|
|
129788
130188
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
129789
|
-
const connection = new
|
|
130189
|
+
const connection = new import_web398.Connection(rpcUrl, "confirmed");
|
|
129790
130190
|
const wallet = await loadWallet(options.wallet);
|
|
129791
130191
|
const n = parseFloat(amount);
|
|
129792
130192
|
if (isNaN(n) || n <= 0) {
|
|
@@ -129804,7 +130204,7 @@ async function handleQuestStake(amount, options) {
|
|
|
129804
130204
|
}
|
|
129805
130205
|
async function handleQuestUnstake(amount, options) {
|
|
129806
130206
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
129807
|
-
const connection = new
|
|
130207
|
+
const connection = new import_web398.Connection(rpcUrl, "confirmed");
|
|
129808
130208
|
const wallet = await loadWallet(options.wallet);
|
|
129809
130209
|
const n = parseFloat(amount);
|
|
129810
130210
|
if (isNaN(n) || n <= 0) {
|
|
@@ -129822,7 +130222,7 @@ async function handleQuestUnstake(amount, options) {
|
|
|
129822
130222
|
}
|
|
129823
130223
|
async function handleQuestStakeInfo(options) {
|
|
129824
130224
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
129825
|
-
const connection = new
|
|
130225
|
+
const connection = new import_web398.Connection(rpcUrl, "confirmed");
|
|
129826
130226
|
const wallet = await loadWallet(options.wallet);
|
|
129827
130227
|
const stakeInfo = await getStakeInfo(connection, wallet.publicKey);
|
|
129828
130228
|
if (!stakeInfo) {
|
|
@@ -129960,7 +130360,7 @@ function registerQuestCommands(program3) {
|
|
|
129960
130360
|
}
|
|
129961
130361
|
|
|
129962
130362
|
// src/cli/commands/skills.ts
|
|
129963
|
-
var
|
|
130363
|
+
var import_web3100 = __toESM(require_index_cjs(), 1);
|
|
129964
130364
|
var import_promises3 = require("node:fs/promises");
|
|
129965
130365
|
|
|
129966
130366
|
// node_modules/@clack/core/dist/index.mjs
|
|
@@ -131025,7 +131425,7 @@ var import_promises2 = require("node:fs/promises");
|
|
|
131025
131425
|
var import_node_fs2 = require("node:fs");
|
|
131026
131426
|
var import_node_path4 = require("node:path");
|
|
131027
131427
|
var import_node_os4 = require("node:os");
|
|
131028
|
-
var
|
|
131428
|
+
var import_web399 = __toESM(require_index_cjs(), 1);
|
|
131029
131429
|
var home = (0, import_node_os4.homedir)();
|
|
131030
131430
|
var xdgConfig = process.env.XDG_CONFIG_HOME || (0, import_node_path4.join)(home, ".config");
|
|
131031
131431
|
var claudeHome = process.env.CLAUDE_CONFIG_DIR?.trim() || (0, import_node_path4.join)(home, ".claude");
|
|
@@ -131338,7 +131738,7 @@ function shortenPath(fullPath, cwd) {
|
|
|
131338
131738
|
}
|
|
131339
131739
|
async function handleSkillsAdd(name, options) {
|
|
131340
131740
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131341
|
-
const connection = new
|
|
131741
|
+
const connection = new import_web399.Connection(rpcUrl, "confirmed");
|
|
131342
131742
|
const cwd = process.cwd();
|
|
131343
131743
|
const nonInteractive = options.json || options.yes || !process.stdin.isTTY;
|
|
131344
131744
|
if (!options.json) {
|
|
@@ -131546,7 +131946,7 @@ async function handleSkillsList(options) {
|
|
|
131546
131946
|
}
|
|
131547
131947
|
async function handleSkillsCheck(options) {
|
|
131548
131948
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131549
|
-
const connection = new
|
|
131949
|
+
const connection = new import_web399.Connection(rpcUrl, "confirmed");
|
|
131550
131950
|
const cwd = process.cwd();
|
|
131551
131951
|
const isGlobal = options.global ?? false;
|
|
131552
131952
|
const lock = await readLock(isGlobal, cwd);
|
|
@@ -131599,7 +131999,7 @@ async function handleSkillsCheck(options) {
|
|
|
131599
131999
|
}
|
|
131600
132000
|
async function handleSkillsUpdate(names, options) {
|
|
131601
132001
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131602
|
-
const connection = new
|
|
132002
|
+
const connection = new import_web399.Connection(rpcUrl, "confirmed");
|
|
131603
132003
|
const cwd = process.cwd();
|
|
131604
132004
|
const isGlobal = options.global ?? false;
|
|
131605
132005
|
const lock = await readLock(isGlobal, cwd);
|
|
@@ -131671,7 +132071,7 @@ Updated ${updated.length} skill(s)`));
|
|
|
131671
132071
|
async function handleSkillsRegister(name, author, options) {
|
|
131672
132072
|
validateName(name, "Skill name");
|
|
131673
132073
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131674
|
-
const connection = new
|
|
132074
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131675
132075
|
const wallet = await loadWallet(options.wallet);
|
|
131676
132076
|
printInfo(`Registering skill "${name}" by "${author}"...`);
|
|
131677
132077
|
const { signature, skillPubkey } = await registerSkill(connection, wallet, name, author);
|
|
@@ -131685,7 +132085,7 @@ async function handleSkillsRegister(name, author, options) {
|
|
|
131685
132085
|
}
|
|
131686
132086
|
async function handleSkillsGet(name, options) {
|
|
131687
132087
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131688
|
-
const connection = new
|
|
132088
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131689
132089
|
const info = await getSkillInfo(connection, name);
|
|
131690
132090
|
const data = {
|
|
131691
132091
|
name: info.record.name,
|
|
@@ -131714,7 +132114,7 @@ async function handleSkillsGet(name, options) {
|
|
|
131714
132114
|
}
|
|
131715
132115
|
async function handleSkillsContent(name, options) {
|
|
131716
132116
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131717
|
-
const connection = new
|
|
132117
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131718
132118
|
const content = await getSkillContent(connection, name);
|
|
131719
132119
|
if (!content) {
|
|
131720
132120
|
if (options.json) {
|
|
@@ -131737,7 +132137,7 @@ async function handleSkillsContent(name, options) {
|
|
|
131737
132137
|
}
|
|
131738
132138
|
async function handleSkillsSetDescription(name, description, options) {
|
|
131739
132139
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131740
|
-
const connection = new
|
|
132140
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131741
132141
|
const wallet = await loadWallet(options.wallet);
|
|
131742
132142
|
printInfo(`Setting description for skill "${name}"...`);
|
|
131743
132143
|
const signature = await setDescription(connection, wallet, name, description);
|
|
@@ -131755,7 +132155,7 @@ async function handleSkillsSetMetadata(name, json, options) {
|
|
|
131755
132155
|
throw new Error("Invalid JSON provided for metadata");
|
|
131756
132156
|
}
|
|
131757
132157
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131758
|
-
const connection = new
|
|
132158
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131759
132159
|
const wallet = await loadWallet(options.wallet);
|
|
131760
132160
|
printInfo(`Setting metadata for skill "${name}"...`);
|
|
131761
132161
|
const signature = await updateMetadata(connection, wallet, name, json);
|
|
@@ -131768,7 +132168,7 @@ async function handleSkillsSetMetadata(name, json, options) {
|
|
|
131768
132168
|
}
|
|
131769
132169
|
async function handleSkillsUpload(name, filePath, options) {
|
|
131770
132170
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131771
|
-
const connection = new
|
|
132171
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131772
132172
|
const wallet = await loadWallet(options.wallet);
|
|
131773
132173
|
const content = await (0, import_promises3.readFile)(filePath);
|
|
131774
132174
|
printInfo(`Uploading ${content.length} bytes to skill "${name}"...`);
|
|
@@ -131787,12 +132187,12 @@ async function handleSkillsUpload(name, filePath, options) {
|
|
|
131787
132187
|
async function handleSkillsTransfer(name, newAuthority, options) {
|
|
131788
132188
|
let newPubkey;
|
|
131789
132189
|
try {
|
|
131790
|
-
newPubkey = new
|
|
132190
|
+
newPubkey = new import_web3100.PublicKey(newAuthority);
|
|
131791
132191
|
} catch {
|
|
131792
132192
|
throw new Error(`Invalid public key: ${newAuthority}`);
|
|
131793
132193
|
}
|
|
131794
132194
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131795
|
-
const connection = new
|
|
132195
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131796
132196
|
const wallet = await loadWallet(options.wallet);
|
|
131797
132197
|
printInfo(`Transferring authority of skill "${name}" to ${newPubkey.toBase58()}...`);
|
|
131798
132198
|
const signature = await transferAuthority(connection, wallet, name, newPubkey);
|
|
@@ -131805,7 +132205,7 @@ async function handleSkillsTransfer(name, newAuthority, options) {
|
|
|
131805
132205
|
}
|
|
131806
132206
|
async function handleSkillsCloseBuffer(name, options) {
|
|
131807
132207
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131808
|
-
const connection = new
|
|
132208
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131809
132209
|
const wallet = await loadWallet(options.wallet);
|
|
131810
132210
|
printInfo(`Closing pending buffer for skill "${name}"...`);
|
|
131811
132211
|
const signature = await closeBuffer2(connection, wallet, name);
|
|
@@ -131833,7 +132233,7 @@ async function handleSkillsDelete(name, options) {
|
|
|
131833
132233
|
}
|
|
131834
132234
|
}
|
|
131835
132235
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131836
|
-
const connection = new
|
|
132236
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131837
132237
|
const wallet = await loadWallet(options.wallet);
|
|
131838
132238
|
if (!options.json) printInfo(`Deleting skill "${name}"...`);
|
|
131839
132239
|
const signature = await deleteSkill(connection, wallet, name);
|
|
@@ -131975,7 +132375,7 @@ function registerSkillsCommands(program3) {
|
|
|
131975
132375
|
}
|
|
131976
132376
|
|
|
131977
132377
|
// src/cli/commands/zkid.ts
|
|
131978
|
-
var
|
|
132378
|
+
var import_web3101 = __toESM(require_index_cjs(), 1);
|
|
131979
132379
|
var import_bn4 = __toESM(require_bn(), 1);
|
|
131980
132380
|
var VALID_AMOUNTS = [1, 10, 100, 1e3, 1e4, 1e5];
|
|
131981
132381
|
var DENOM_MAP = {
|
|
@@ -131997,7 +132397,7 @@ function parseDenomination(amount) {
|
|
|
131997
132397
|
}
|
|
131998
132398
|
async function handleZkIdCreate(name, options) {
|
|
131999
132399
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132000
|
-
const connection = new
|
|
132400
|
+
const connection = new import_web3101.Connection(rpcUrl, "confirmed");
|
|
132001
132401
|
const wallet = await loadWallet(options.wallet);
|
|
132002
132402
|
if (!options.json) printInfo(`Deriving idSecret for "${name}"...`);
|
|
132003
132403
|
const idSecret = await deriveIdSecret(wallet, name);
|
|
@@ -132018,7 +132418,7 @@ async function handleZkIdCreate(name, options) {
|
|
|
132018
132418
|
}
|
|
132019
132419
|
async function handleZkIdInfo(name, options) {
|
|
132020
132420
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132021
|
-
const connection = new
|
|
132421
|
+
const connection = new import_web3101.Connection(rpcUrl, "confirmed");
|
|
132022
132422
|
const info = await getZkIdInfo(connection, name);
|
|
132023
132423
|
if (!info) {
|
|
132024
132424
|
if (options.json) {
|
|
@@ -132048,7 +132448,7 @@ async function handleZkIdInfo(name, options) {
|
|
|
132048
132448
|
async function handleZkIdDeposit(name, amount, options) {
|
|
132049
132449
|
const denomination = parseDenomination(amount);
|
|
132050
132450
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132051
|
-
const connection = new
|
|
132451
|
+
const connection = new import_web3101.Connection(rpcUrl, "confirmed");
|
|
132052
132452
|
const wallet = await loadWallet(options.wallet);
|
|
132053
132453
|
if (!options.json) printInfo(`Depositing ${amount} NARA into ZK ID "${name}"...`);
|
|
132054
132454
|
const signature = await deposit(connection, wallet, name, denomination);
|
|
@@ -132061,7 +132461,7 @@ async function handleZkIdDeposit(name, amount, options) {
|
|
|
132061
132461
|
}
|
|
132062
132462
|
async function handleZkIdScan(name, options) {
|
|
132063
132463
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132064
|
-
const connection = new
|
|
132464
|
+
const connection = new import_web3101.Connection(rpcUrl, "confirmed");
|
|
132065
132465
|
const wallet = await loadWallet(options.wallet);
|
|
132066
132466
|
let names;
|
|
132067
132467
|
if (name) {
|
|
@@ -132129,7 +132529,7 @@ async function handleZkIdWithdraw(name, options) {
|
|
|
132129
132529
|
let recipient;
|
|
132130
132530
|
if (options.recipient) {
|
|
132131
132531
|
try {
|
|
132132
|
-
recipient = new
|
|
132532
|
+
recipient = new import_web3101.PublicKey(options.recipient);
|
|
132133
132533
|
} catch {
|
|
132134
132534
|
throw new Error(`Invalid recipient address: ${options.recipient}`);
|
|
132135
132535
|
}
|
|
@@ -132140,7 +132540,7 @@ async function handleZkIdWithdraw(name, options) {
|
|
|
132140
132540
|
}
|
|
132141
132541
|
}
|
|
132142
132542
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132143
|
-
const connection = new
|
|
132543
|
+
const connection = new import_web3101.Connection(rpcUrl, "confirmed");
|
|
132144
132544
|
const wallet = await loadWallet(options.wallet);
|
|
132145
132545
|
if (!options.json) printInfo(`Scanning deposits for "${name}"...`);
|
|
132146
132546
|
const idSecret = await deriveIdSecret(wallet, name);
|
|
@@ -132206,7 +132606,7 @@ async function handleZkIdTransfer(name, newIdCommitmentHex, options) {
|
|
|
132206
132606
|
throw new Error(`Invalid id-commitment: ${e3.message}`);
|
|
132207
132607
|
}
|
|
132208
132608
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132209
|
-
const connection = new
|
|
132609
|
+
const connection = new import_web3101.Connection(rpcUrl, "confirmed");
|
|
132210
132610
|
const wallet = await loadWallet(options.wallet);
|
|
132211
132611
|
if (!options.json) printInfo(`Generating ownership proof for "${name}"...`);
|
|
132212
132612
|
const currentIdSecret = await deriveIdSecret(wallet, name);
|
|
@@ -132294,12 +132694,12 @@ function registerZkIdCommands(program3) {
|
|
|
132294
132694
|
}
|
|
132295
132695
|
|
|
132296
132696
|
// src/cli/commands/agent.ts
|
|
132297
|
-
var
|
|
132697
|
+
var import_web3102 = __toESM(require_index_cjs(), 1);
|
|
132298
132698
|
var import_node_fs3 = require("node:fs");
|
|
132299
132699
|
async function handleAgentRegister(agentId, options) {
|
|
132300
132700
|
validateName(agentId, "Agent ID");
|
|
132301
132701
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132302
|
-
const connection = new
|
|
132702
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132303
132703
|
const wallet = await loadWallet(options.wallet);
|
|
132304
132704
|
if (!options.json) printInfo(`Registering agent "${agentId}"...`);
|
|
132305
132705
|
const result = options.referral ? await registerAgentWithReferral(connection, wallet, agentId, options.referral) : await registerAgent(connection, wallet, agentId);
|
|
@@ -132315,7 +132715,7 @@ async function handleAgentRegister(agentId, options) {
|
|
|
132315
132715
|
}
|
|
132316
132716
|
async function handleAgentGet(agentId, options) {
|
|
132317
132717
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132318
|
-
const connection = new
|
|
132718
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132319
132719
|
const info = await getAgentInfo(connection, agentId);
|
|
132320
132720
|
const data = {
|
|
132321
132721
|
agentId: info.record.agentId,
|
|
@@ -132342,7 +132742,7 @@ async function handleAgentGet(agentId, options) {
|
|
|
132342
132742
|
}
|
|
132343
132743
|
async function handleAgentSetBio(agentId, bio, options) {
|
|
132344
132744
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132345
|
-
const connection = new
|
|
132745
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132346
132746
|
const wallet = await loadWallet(options.wallet);
|
|
132347
132747
|
if (!options.json) printInfo(`Setting bio for "${agentId}"...`);
|
|
132348
132748
|
const signature = await setBio(connection, wallet, agentId, bio);
|
|
@@ -132360,7 +132760,7 @@ async function handleAgentSetMetadata(agentId, jsonStr, options) {
|
|
|
132360
132760
|
throw new Error(`Invalid JSON: ${jsonStr}`);
|
|
132361
132761
|
}
|
|
132362
132762
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132363
|
-
const connection = new
|
|
132763
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132364
132764
|
const wallet = await loadWallet(options.wallet);
|
|
132365
132765
|
if (!options.json) printInfo(`Setting metadata for "${agentId}"...`);
|
|
132366
132766
|
const signature = await setMetadata(connection, wallet, agentId, jsonStr);
|
|
@@ -132379,7 +132779,7 @@ async function handleAgentUploadMemory(agentId, filePath, options) {
|
|
|
132379
132779
|
throw new Error(`Failed to read file "${filePath}": ${err.message}`);
|
|
132380
132780
|
}
|
|
132381
132781
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132382
|
-
const connection = new
|
|
132782
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132383
132783
|
const wallet = await loadWallet(options.wallet);
|
|
132384
132784
|
if (!options.json) printInfo(`Uploading memory for "${agentId}" (${data.length} bytes)...`);
|
|
132385
132785
|
const signature = await uploadMemory(connection, wallet, agentId, data, {
|
|
@@ -132396,7 +132796,7 @@ async function handleAgentUploadMemory(agentId, filePath, options) {
|
|
|
132396
132796
|
}
|
|
132397
132797
|
async function handleAgentMemory(agentId, options) {
|
|
132398
132798
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132399
|
-
const connection = new
|
|
132799
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132400
132800
|
const memory = await getAgentMemory(connection, agentId);
|
|
132401
132801
|
if (!memory) {
|
|
132402
132802
|
if (options.json) {
|
|
@@ -132415,12 +132815,12 @@ async function handleAgentMemory(agentId, options) {
|
|
|
132415
132815
|
async function handleAgentTransfer(agentId, newAuthority, options) {
|
|
132416
132816
|
let newAuth;
|
|
132417
132817
|
try {
|
|
132418
|
-
newAuth = new
|
|
132818
|
+
newAuth = new import_web3102.PublicKey(newAuthority);
|
|
132419
132819
|
} catch {
|
|
132420
132820
|
throw new Error(`Invalid public key: ${newAuthority}`);
|
|
132421
132821
|
}
|
|
132422
132822
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132423
|
-
const connection = new
|
|
132823
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132424
132824
|
const wallet = await loadWallet(options.wallet);
|
|
132425
132825
|
if (!options.json) printInfo(`Transferring agent "${agentId}" authority...`);
|
|
132426
132826
|
const signature = await transferAgentAuthority(connection, wallet, agentId, newAuth);
|
|
@@ -132434,7 +132834,7 @@ async function handleAgentTransfer(agentId, newAuthority, options) {
|
|
|
132434
132834
|
}
|
|
132435
132835
|
async function handleAgentCloseBuffer(agentId, options) {
|
|
132436
132836
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132437
|
-
const connection = new
|
|
132837
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132438
132838
|
const wallet = await loadWallet(options.wallet);
|
|
132439
132839
|
if (!options.json) printInfo(`Closing buffer for "${agentId}"...`);
|
|
132440
132840
|
const signature = await closeBuffer(connection, wallet, agentId);
|
|
@@ -132447,7 +132847,7 @@ async function handleAgentCloseBuffer(agentId, options) {
|
|
|
132447
132847
|
}
|
|
132448
132848
|
async function handleAgentDelete(agentId, options) {
|
|
132449
132849
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132450
|
-
const connection = new
|
|
132850
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132451
132851
|
const wallet = await loadWallet(options.wallet);
|
|
132452
132852
|
if (!options.json) printInfo(`Deleting agent "${agentId}"...`);
|
|
132453
132853
|
const signature = await deleteAgent(connection, wallet, agentId);
|
|
@@ -132460,7 +132860,7 @@ async function handleAgentDelete(agentId, options) {
|
|
|
132460
132860
|
}
|
|
132461
132861
|
async function handleAgentSetReferral(agentId, referralAgentId, options) {
|
|
132462
132862
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132463
|
-
const connection = new
|
|
132863
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132464
132864
|
const wallet = await loadWallet(options.wallet);
|
|
132465
132865
|
if (!options.json) printInfo(`Setting referral for "${agentId}" to "${referralAgentId}"...`);
|
|
132466
132866
|
const signature = await setReferral(connection, wallet, agentId, referralAgentId);
|
|
@@ -132473,7 +132873,7 @@ async function handleAgentSetReferral(agentId, referralAgentId, options) {
|
|
|
132473
132873
|
}
|
|
132474
132874
|
async function handleAgentLog(agentId, activity, log, options) {
|
|
132475
132875
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132476
|
-
const connection = new
|
|
132876
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132477
132877
|
const wallet = await loadWallet(options.wallet);
|
|
132478
132878
|
const model = options.model ?? "";
|
|
132479
132879
|
const referral = options.referral;
|
|
@@ -132774,11 +133174,11 @@ function registerCommands(program3) {
|
|
|
132774
133174
|
const buf = Buffer.from(base64Tx, "base64");
|
|
132775
133175
|
let tx;
|
|
132776
133176
|
try {
|
|
132777
|
-
tx =
|
|
133177
|
+
tx = import_web3103.VersionedTransaction.deserialize(new Uint8Array(buf));
|
|
132778
133178
|
} catch {
|
|
132779
|
-
tx =
|
|
133179
|
+
tx = import_web3103.Transaction.from(buf);
|
|
132780
133180
|
}
|
|
132781
|
-
if (tx instanceof
|
|
133181
|
+
if (tx instanceof import_web3103.VersionedTransaction) {
|
|
132782
133182
|
tx.sign([wallet]);
|
|
132783
133183
|
} else {
|
|
132784
133184
|
tx.sign(wallet);
|
|
@@ -132789,7 +133189,7 @@ function registerCommands(program3) {
|
|
|
132789
133189
|
const connection = sdk.getConnection();
|
|
132790
133190
|
printInfo("Sending transaction...");
|
|
132791
133191
|
let signature;
|
|
132792
|
-
if (tx instanceof
|
|
133192
|
+
if (tx instanceof import_web3103.VersionedTransaction) {
|
|
132793
133193
|
signature = await connection.sendTransaction(tx, { maxRetries: 3 });
|
|
132794
133194
|
} else {
|
|
132795
133195
|
signature = await connection.sendRawTransaction(tx.serialize(), { skipPreflight: true });
|
|
@@ -132803,7 +133203,7 @@ function registerCommands(program3) {
|
|
|
132803
133203
|
console.log(`Signature: ${signature}`);
|
|
132804
133204
|
}
|
|
132805
133205
|
} else {
|
|
132806
|
-
const serialized = tx instanceof
|
|
133206
|
+
const serialized = tx instanceof import_web3103.VersionedTransaction ? Buffer.from(tx.serialize()).toString("base64") : Buffer.from(tx.serialize()).toString("base64");
|
|
132807
133207
|
if (opts.json) {
|
|
132808
133208
|
console.log(JSON.stringify({ transaction: serialized }, null, 2));
|
|
132809
133209
|
} else {
|
|
@@ -132818,7 +133218,7 @@ function registerCommands(program3) {
|
|
|
132818
133218
|
}
|
|
132819
133219
|
|
|
132820
133220
|
// bin/nara-cli.ts
|
|
132821
|
-
var version2 = true ? "1.0.
|
|
133221
|
+
var version2 = true ? "1.0.44" : "dev";
|
|
132822
133222
|
var program2 = new Command();
|
|
132823
133223
|
program2.name("naracli").description("CLI for the Nara chain (Solana-compatible)").version(version2);
|
|
132824
133224
|
program2.option("-r, --rpc-url <url>", "RPC endpoint URL").option("-w, --wallet <path>", "Path to wallet keypair JSON file").option("-j, --json", "Output in JSON format");
|