naracli 1.0.40 → 1.0.45
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 +891 -480
- 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"
|
|
@@ -125496,7 +125906,14 @@ var BN254_FIELD = 21888242871839275222246405745257275088696311157297823662689037
|
|
|
125496
125906
|
async function resolveDefaultZkPaths() {
|
|
125497
125907
|
const { fileURLToPath } = await import("url");
|
|
125498
125908
|
const { dirname: dirname2, join: join5 } = await import("path");
|
|
125499
|
-
|
|
125909
|
+
let dir;
|
|
125910
|
+
if (import_meta.url) {
|
|
125911
|
+
dir = dirname2(fileURLToPath(import_meta.url));
|
|
125912
|
+
} else {
|
|
125913
|
+
const { createRequire } = await import("module");
|
|
125914
|
+
const req = createRequire(process.cwd() + "/");
|
|
125915
|
+
dir = dirname2(req.resolve("nara-sdk/package.json")) + "/src";
|
|
125916
|
+
}
|
|
125500
125917
|
return {
|
|
125501
125918
|
wasm: join5(dir, "zk", "answer_proof.wasm"),
|
|
125502
125919
|
zkey: join5(dir, "zk", "answer_proof_final.zkey")
|
|
@@ -125590,28 +126007,32 @@ function createProgram2(connection, wallet, programId) {
|
|
|
125590
126007
|
return new import_anchor2.Program(idlWithPid, provider);
|
|
125591
126008
|
}
|
|
125592
126009
|
function getPoolPda(programId) {
|
|
125593
|
-
const [pda] =
|
|
126010
|
+
const [pda] = import_web390.PublicKey.findProgramAddressSync(
|
|
125594
126011
|
[new TextEncoder().encode("quest_pool")],
|
|
125595
126012
|
programId
|
|
125596
126013
|
);
|
|
125597
126014
|
return pda;
|
|
125598
126015
|
}
|
|
125599
126016
|
function getWinnerRecordPda(programId, user) {
|
|
125600
|
-
const [pda] =
|
|
126017
|
+
const [pda] = import_web390.PublicKey.findProgramAddressSync(
|
|
125601
126018
|
[new TextEncoder().encode("quest_winner"), user.toBytes()],
|
|
125602
126019
|
programId
|
|
125603
126020
|
);
|
|
125604
126021
|
return pda;
|
|
125605
126022
|
}
|
|
125606
126023
|
function getStakeRecordPda(programId, user) {
|
|
125607
|
-
const [pda] =
|
|
126024
|
+
const [pda] = import_web390.PublicKey.findProgramAddressSync(
|
|
125608
126025
|
[new TextEncoder().encode("quest_stake"), user.toBytes()],
|
|
125609
126026
|
programId
|
|
125610
126027
|
);
|
|
125611
126028
|
return pda;
|
|
125612
126029
|
}
|
|
126030
|
+
var WSOL_MINT = new import_web390.PublicKey("So11111111111111111111111111111111111111112");
|
|
126031
|
+
function getStakeTokenAccount(stakeRecordPda) {
|
|
126032
|
+
return getAssociatedTokenAddressSync(WSOL_MINT, stakeRecordPda, true);
|
|
126033
|
+
}
|
|
125613
126034
|
async function getQuestInfo(connection, wallet, options) {
|
|
125614
|
-
const kp = wallet ??
|
|
126035
|
+
const kp = wallet ?? import_web390.Keypair.generate();
|
|
125615
126036
|
const program3 = createProgram2(connection, kp, options?.programId);
|
|
125616
126037
|
const poolPda = getPoolPda(program3.programId);
|
|
125617
126038
|
const pool = await program3.account.pool.fetch(poolPda);
|
|
@@ -125624,8 +126045,8 @@ async function getQuestInfo(connection, wallet, options) {
|
|
|
125624
126045
|
round: pool.round.toString(),
|
|
125625
126046
|
question: pool.question,
|
|
125626
126047
|
answerHash: Array.from(pool.answerHash),
|
|
125627
|
-
rewardPerWinner: pool.rewardPerWinner.toNumber() /
|
|
125628
|
-
totalReward: pool.rewardAmount.toNumber() /
|
|
126048
|
+
rewardPerWinner: pool.rewardPerWinner.toNumber() / import_web390.LAMPORTS_PER_SOL,
|
|
126049
|
+
totalReward: pool.rewardAmount.toNumber() / import_web390.LAMPORTS_PER_SOL,
|
|
125629
126050
|
rewardCount: pool.rewardCount,
|
|
125630
126051
|
winnerCount: pool.winnerCount,
|
|
125631
126052
|
remainingSlots: Math.max(0, pool.rewardCount - pool.winnerCount),
|
|
@@ -125633,8 +126054,8 @@ async function getQuestInfo(connection, wallet, options) {
|
|
|
125633
126054
|
deadline,
|
|
125634
126055
|
timeRemaining: secsLeft,
|
|
125635
126056
|
expired: secsLeft <= 0,
|
|
125636
|
-
stakeRequirement: Number(pool.stakeRequirement.toString()) /
|
|
125637
|
-
minWinnerStake: Number(pool.minWinnerStake.toString()) /
|
|
126057
|
+
stakeRequirement: Number(pool.stakeRequirement.toString()) / import_web390.LAMPORTS_PER_SOL,
|
|
126058
|
+
minWinnerStake: Number(pool.minWinnerStake.toString()) / import_web390.LAMPORTS_PER_SOL
|
|
125638
126059
|
};
|
|
125639
126060
|
}
|
|
125640
126061
|
async function hasAnswered(connection, wallet, options) {
|
|
@@ -125688,52 +126109,46 @@ async function submitAnswer(connection, wallet, proof, agent = "", model = "", o
|
|
|
125688
126109
|
const current = stakeInfo?.amount ?? 0;
|
|
125689
126110
|
const deficit = required - current;
|
|
125690
126111
|
if (deficit > 0) {
|
|
125691
|
-
stakeLamports = new import_bn.default(Math.round(deficit *
|
|
126112
|
+
stakeLamports = new import_bn.default(Math.round(deficit * import_web390.LAMPORTS_PER_SOL));
|
|
125692
126113
|
} else {
|
|
125693
126114
|
stakeLamports = new import_bn.default(0);
|
|
125694
126115
|
}
|
|
125695
126116
|
} else {
|
|
125696
|
-
stakeLamports = new import_bn.default(Math.round(options.stake *
|
|
126117
|
+
stakeLamports = new import_bn.default(Math.round(options.stake * import_web390.LAMPORTS_PER_SOL));
|
|
125697
126118
|
}
|
|
125698
126119
|
if (!stakeLamports.isZero()) {
|
|
125699
126120
|
stakeIx = await program3.methods.stake(stakeLamports).accounts({ user: wallet.publicKey }).instruction();
|
|
125700
126121
|
}
|
|
125701
126122
|
}
|
|
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 };
|
|
126123
|
+
const submitIx = await program3.methods.submitAnswer(proof.proofA, proof.proofB, proof.proofC, agent, model).accounts({ user: wallet.publicKey, payer: wallet.publicKey }).instruction();
|
|
126124
|
+
const ixs = [];
|
|
126125
|
+
if (stakeIx) ixs.push(stakeIx);
|
|
126126
|
+
ixs.push(submitIx);
|
|
126127
|
+
if (activityLog) {
|
|
126128
|
+
const { makeLogActivityIx: makeLogActivityIx2, makeLogActivityWithReferralIx: makeLogActivityWithReferralIx2 } = await Promise.resolve().then(() => (init_agent_registry(), agent_registry_exports));
|
|
126129
|
+
const logIx = activityLog.referralAgentId ? await makeLogActivityWithReferralIx2(
|
|
126130
|
+
connection,
|
|
126131
|
+
wallet.publicKey,
|
|
126132
|
+
activityLog.agentId,
|
|
126133
|
+
activityLog.model,
|
|
126134
|
+
activityLog.activity,
|
|
126135
|
+
activityLog.log,
|
|
126136
|
+
activityLog.referralAgentId
|
|
126137
|
+
) : await makeLogActivityIx2(
|
|
126138
|
+
connection,
|
|
126139
|
+
wallet.publicKey,
|
|
126140
|
+
activityLog.agentId,
|
|
126141
|
+
activityLog.model,
|
|
126142
|
+
activityLog.activity,
|
|
126143
|
+
activityLog.log
|
|
126144
|
+
);
|
|
126145
|
+
ixs.push(logIx);
|
|
125735
126146
|
}
|
|
125736
|
-
const signature = await
|
|
126147
|
+
const signature = await sendTx(connection, wallet, ixs, [], {
|
|
126148
|
+
skipPreflight: true,
|
|
126149
|
+
computeUnitLimit: 5e5,
|
|
126150
|
+
computeUnitPrice: "auto"
|
|
126151
|
+
});
|
|
125737
126152
|
return { signature };
|
|
125738
126153
|
}
|
|
125739
126154
|
async function submitAnswerViaRelay(relayUrl, userPubkey, proof, agent = "", model = "") {
|
|
@@ -125787,28 +126202,37 @@ async function parseQuestReward(connection, txSignature, retries = 10) {
|
|
|
125787
126202
|
return {
|
|
125788
126203
|
rewarded: rewardLamports > 0,
|
|
125789
126204
|
rewardLamports,
|
|
125790
|
-
rewardNso: rewardLamports /
|
|
126205
|
+
rewardNso: rewardLamports / import_web390.LAMPORTS_PER_SOL,
|
|
125791
126206
|
winner
|
|
125792
126207
|
};
|
|
125793
126208
|
}
|
|
125794
126209
|
async function stake(connection, wallet, amount, options) {
|
|
125795
126210
|
const program3 = createProgram2(connection, wallet, options?.programId);
|
|
125796
|
-
const lamports = new import_bn.default(Math.round(amount *
|
|
125797
|
-
|
|
126211
|
+
const lamports = new import_bn.default(Math.round(amount * import_web390.LAMPORTS_PER_SOL));
|
|
126212
|
+
const ix = await program3.methods.stake(lamports).accounts({ user: wallet.publicKey }).instruction();
|
|
126213
|
+
return sendTx(connection, wallet, [ix]);
|
|
125798
126214
|
}
|
|
125799
126215
|
async function unstake(connection, wallet, amount, options) {
|
|
125800
126216
|
const program3 = createProgram2(connection, wallet, options?.programId);
|
|
125801
|
-
const lamports = new import_bn.default(Math.round(amount *
|
|
125802
|
-
|
|
126217
|
+
const lamports = new import_bn.default(Math.round(amount * import_web390.LAMPORTS_PER_SOL));
|
|
126218
|
+
const ix = await program3.methods.unstake(lamports).accounts({ user: wallet.publicKey }).instruction();
|
|
126219
|
+
return sendTx(connection, wallet, [ix]);
|
|
125803
126220
|
}
|
|
125804
126221
|
async function getStakeInfo(connection, user, options) {
|
|
125805
|
-
const kp =
|
|
126222
|
+
const kp = import_web390.Keypair.generate();
|
|
125806
126223
|
const program3 = createProgram2(connection, kp, options?.programId);
|
|
125807
126224
|
const stakeRecordPda = getStakeRecordPda(program3.programId, user);
|
|
125808
126225
|
try {
|
|
125809
126226
|
const record = await program3.account.stakeRecord.fetch(stakeRecordPda);
|
|
126227
|
+
const stakeTokenAccount = getStakeTokenAccount(stakeRecordPda);
|
|
126228
|
+
let amount = 0;
|
|
126229
|
+
try {
|
|
126230
|
+
const balance = await connection.getTokenAccountBalance(stakeTokenAccount);
|
|
126231
|
+
amount = Number(balance.value.amount) / import_web390.LAMPORTS_PER_SOL;
|
|
126232
|
+
} catch {
|
|
126233
|
+
}
|
|
125810
126234
|
return {
|
|
125811
|
-
amount
|
|
126235
|
+
amount,
|
|
125812
126236
|
stakeRound: record.stakeRound.toNumber()
|
|
125813
126237
|
};
|
|
125814
126238
|
} catch {
|
|
@@ -125817,7 +126241,7 @@ async function getStakeInfo(connection, user, options) {
|
|
|
125817
126241
|
}
|
|
125818
126242
|
|
|
125819
126243
|
// node_modules/nara-sdk/src/skills.ts
|
|
125820
|
-
var
|
|
126244
|
+
var import_web391 = __toESM(require_index_cjs(), 1);
|
|
125821
126245
|
var anchor3 = __toESM(require_cjs(), 1);
|
|
125822
126246
|
var import_anchor3 = __toESM(require_cjs(), 1);
|
|
125823
126247
|
init_constants2();
|
|
@@ -127172,34 +127596,10 @@ var nara_skills_hub_default = {
|
|
|
127172
127596
|
};
|
|
127173
127597
|
|
|
127174
127598
|
// node_modules/nara-sdk/src/skills.ts
|
|
127599
|
+
init_tx();
|
|
127175
127600
|
var DEFAULT_CHUNK_SIZE2 = 800;
|
|
127176
127601
|
var BUFFER_HEADER_SIZE2 = 144;
|
|
127177
127602
|
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
127603
|
function createProgram3(connection, wallet, programId) {
|
|
127204
127604
|
const idl = nara_skills_hub_default;
|
|
127205
127605
|
const pid = programId ?? DEFAULT_SKILLS_PROGRAM_ID;
|
|
@@ -127211,28 +127611,28 @@ function createProgram3(connection, wallet, programId) {
|
|
|
127211
127611
|
return new import_anchor3.Program(idlWithPid, provider);
|
|
127212
127612
|
}
|
|
127213
127613
|
function getSkillPda(programId, name) {
|
|
127214
|
-
const [pda] =
|
|
127614
|
+
const [pda] = import_web391.PublicKey.findProgramAddressSync(
|
|
127215
127615
|
[Buffer.from("skill"), Buffer.from(name)],
|
|
127216
127616
|
programId
|
|
127217
127617
|
);
|
|
127218
127618
|
return pda;
|
|
127219
127619
|
}
|
|
127220
127620
|
function getConfigPda2(programId) {
|
|
127221
|
-
const [pda] =
|
|
127621
|
+
const [pda] = import_web391.PublicKey.findProgramAddressSync(
|
|
127222
127622
|
[Buffer.from("config")],
|
|
127223
127623
|
programId
|
|
127224
127624
|
);
|
|
127225
127625
|
return pda;
|
|
127226
127626
|
}
|
|
127227
127627
|
function getDescPda(programId, skillPubkey) {
|
|
127228
|
-
const [pda] =
|
|
127628
|
+
const [pda] = import_web391.PublicKey.findProgramAddressSync(
|
|
127229
127629
|
[Buffer.from("desc"), skillPubkey.toBuffer()],
|
|
127230
127630
|
programId
|
|
127231
127631
|
);
|
|
127232
127632
|
return pda;
|
|
127233
127633
|
}
|
|
127234
127634
|
function getMetaPda2(programId, skillPubkey) {
|
|
127235
|
-
const [pda] =
|
|
127635
|
+
const [pda] = import_web391.PublicKey.findProgramAddressSync(
|
|
127236
127636
|
[Buffer.from("meta"), skillPubkey.toBuffer()],
|
|
127237
127637
|
programId
|
|
127238
127638
|
);
|
|
@@ -127241,11 +127641,11 @@ function getMetaPda2(programId, skillPubkey) {
|
|
|
127241
127641
|
function parseSkillRecordData(data) {
|
|
127242
127642
|
const buf = Buffer.from(data);
|
|
127243
127643
|
let offset = 8;
|
|
127244
|
-
const authority = new
|
|
127644
|
+
const authority = new import_web391.PublicKey(buf.subarray(offset, offset + 32));
|
|
127245
127645
|
offset += 32;
|
|
127246
|
-
const content = new
|
|
127646
|
+
const content = new import_web391.PublicKey(buf.subarray(offset, offset + 32));
|
|
127247
127647
|
offset += 32;
|
|
127248
|
-
const pendingBuffer = new
|
|
127648
|
+
const pendingBuffer = new import_web391.PublicKey(buf.subarray(offset, offset + 32));
|
|
127249
127649
|
offset += 32;
|
|
127250
127650
|
const createdAt = Number(buf.readBigInt64LE(offset));
|
|
127251
127651
|
offset += 8;
|
|
@@ -127264,7 +127664,7 @@ function parseSkillRecordData(data) {
|
|
|
127264
127664
|
authority,
|
|
127265
127665
|
name,
|
|
127266
127666
|
author,
|
|
127267
|
-
pendingBuffer: pendingBuffer.equals(
|
|
127667
|
+
pendingBuffer: pendingBuffer.equals(import_web391.PublicKey.default) ? null : pendingBuffer,
|
|
127268
127668
|
content,
|
|
127269
127669
|
version: version3,
|
|
127270
127670
|
createdAt,
|
|
@@ -127288,20 +127688,21 @@ async function registerSkill(connection, wallet, name, author, options) {
|
|
|
127288
127688
|
const configInfo = await connection.getAccountInfo(configPda);
|
|
127289
127689
|
if (!configInfo) throw new Error("Skills program config not initialized");
|
|
127290
127690
|
const configBuf = Buffer.from(configInfo.data);
|
|
127291
|
-
const feeRecipient = new
|
|
127292
|
-
const
|
|
127691
|
+
const feeRecipient = new import_web391.PublicKey(configBuf.subarray(48, 80));
|
|
127692
|
+
const ix = await program3.methods.registerSkill(name, author).accounts({
|
|
127293
127693
|
authority: wallet.publicKey,
|
|
127294
127694
|
feeRecipient
|
|
127295
|
-
}).
|
|
127695
|
+
}).instruction();
|
|
127696
|
+
const signature = await sendTx(connection, wallet, [ix]);
|
|
127296
127697
|
const skillPubkey = getSkillPda(program3.programId, name);
|
|
127297
127698
|
return { signature, skillPubkey };
|
|
127298
127699
|
}
|
|
127299
127700
|
async function getSkillRecord(connection, name, options) {
|
|
127300
|
-
const pid = new
|
|
127701
|
+
const pid = new import_web391.PublicKey(options?.programId ?? DEFAULT_SKILLS_PROGRAM_ID);
|
|
127301
127702
|
return fetchSkillRecord(connection, name, pid);
|
|
127302
127703
|
}
|
|
127303
127704
|
async function getSkillInfo(connection, name, options) {
|
|
127304
|
-
const pid = new
|
|
127705
|
+
const pid = new import_web391.PublicKey(options?.programId ?? DEFAULT_SKILLS_PROGRAM_ID);
|
|
127305
127706
|
const skillPda = getSkillPda(pid, name);
|
|
127306
127707
|
const accountInfo = await connection.getAccountInfo(skillPda);
|
|
127307
127708
|
if (!accountInfo) {
|
|
@@ -127333,9 +127734,9 @@ async function getSkillInfo(connection, name, options) {
|
|
|
127333
127734
|
return { record, description, metadata };
|
|
127334
127735
|
}
|
|
127335
127736
|
async function getSkillContent(connection, name, options) {
|
|
127336
|
-
const pid = new
|
|
127737
|
+
const pid = new import_web391.PublicKey(options?.programId ?? DEFAULT_SKILLS_PROGRAM_ID);
|
|
127337
127738
|
const record = await fetchSkillRecord(connection, name, pid);
|
|
127338
|
-
if (record.content.equals(
|
|
127739
|
+
if (record.content.equals(import_web391.PublicKey.default)) {
|
|
127339
127740
|
return null;
|
|
127340
127741
|
}
|
|
127341
127742
|
const accountInfo = await connection.getAccountInfo(record.content);
|
|
@@ -127344,15 +127745,18 @@ async function getSkillContent(connection, name, options) {
|
|
|
127344
127745
|
}
|
|
127345
127746
|
async function setDescription(connection, wallet, name, description, options) {
|
|
127346
127747
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
127347
|
-
|
|
127748
|
+
const ix = await program3.methods.setDescription(name, description).accounts({ authority: wallet.publicKey }).instruction();
|
|
127749
|
+
return sendTx(connection, wallet, [ix]);
|
|
127348
127750
|
}
|
|
127349
127751
|
async function updateMetadata(connection, wallet, name, data, options) {
|
|
127350
127752
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
127351
|
-
|
|
127753
|
+
const ix = await program3.methods.updateMetadata(name, data).accounts({ authority: wallet.publicKey }).instruction();
|
|
127754
|
+
return sendTx(connection, wallet, [ix]);
|
|
127352
127755
|
}
|
|
127353
127756
|
async function transferAuthority(connection, wallet, name, newAuthority, options) {
|
|
127354
127757
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
127355
|
-
|
|
127758
|
+
const ix = await program3.methods.transferAuthority(name, newAuthority).accounts({ authority: wallet.publicKey }).instruction();
|
|
127759
|
+
return sendTx(connection, wallet, [ix]);
|
|
127356
127760
|
}
|
|
127357
127761
|
async function closeBuffer2(connection, wallet, name, options) {
|
|
127358
127762
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
@@ -127360,16 +127764,18 @@ async function closeBuffer2(connection, wallet, name, options) {
|
|
|
127360
127764
|
if (!record.pendingBuffer) {
|
|
127361
127765
|
throw new Error(`Skill "${name}" has no pending buffer`);
|
|
127362
127766
|
}
|
|
127363
|
-
|
|
127767
|
+
const ix = await program3.methods.closeBuffer(name).accounts({ authority: wallet.publicKey, buffer: record.pendingBuffer }).instruction();
|
|
127768
|
+
return sendTx(connection, wallet, [ix]);
|
|
127364
127769
|
}
|
|
127365
127770
|
async function deleteSkill(connection, wallet, name, options) {
|
|
127366
127771
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
127367
127772
|
const record = await fetchSkillRecord(connection, name, program3.programId);
|
|
127368
|
-
const contentAccount = record.content.equals(
|
|
127369
|
-
|
|
127773
|
+
const contentAccount = record.content.equals(import_web391.PublicKey.default) ? wallet.publicKey : record.content;
|
|
127774
|
+
const ix = await program3.methods.deleteSkill(name).accounts({
|
|
127370
127775
|
authority: wallet.publicKey,
|
|
127371
127776
|
contentAccount
|
|
127372
|
-
}).
|
|
127777
|
+
}).instruction();
|
|
127778
|
+
return sendTx(connection, wallet, [ix]);
|
|
127373
127779
|
}
|
|
127374
127780
|
async function uploadSkillContent(connection, wallet, name, content, options) {
|
|
127375
127781
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
@@ -127377,74 +127783,75 @@ async function uploadSkillContent(connection, wallet, name, content, options) {
|
|
|
127377
127783
|
const totalLen = content.length;
|
|
127378
127784
|
const record = await fetchSkillRecord(connection, name, program3.programId);
|
|
127379
127785
|
const existingContent = record.content;
|
|
127380
|
-
const isUpdate = !existingContent.equals(
|
|
127381
|
-
const bufferKeypair =
|
|
127786
|
+
const isUpdate = !existingContent.equals(import_web391.PublicKey.default);
|
|
127787
|
+
const bufferKeypair = import_web391.Keypair.generate();
|
|
127382
127788
|
const bufferSize = BUFFER_HEADER_SIZE2 + totalLen;
|
|
127383
127789
|
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({
|
|
127790
|
+
const createBufferIx = import_web391.SystemProgram.createAccount({
|
|
127791
|
+
fromPubkey: wallet.publicKey,
|
|
127792
|
+
newAccountPubkey: bufferKeypair.publicKey,
|
|
127793
|
+
lamports: bufferRent,
|
|
127794
|
+
space: bufferSize,
|
|
127795
|
+
programId: program3.programId
|
|
127796
|
+
});
|
|
127797
|
+
await sendTx(connection, wallet, [createBufferIx], [bufferKeypair]);
|
|
127798
|
+
const initBufferIx = await program3.methods.initBuffer(name, totalLen).accounts({
|
|
127395
127799
|
authority: wallet.publicKey,
|
|
127396
127800
|
buffer: bufferKeypair.publicKey
|
|
127397
|
-
}).
|
|
127801
|
+
}).instruction();
|
|
127802
|
+
await sendTx(connection, wallet, [initBufferIx]);
|
|
127398
127803
|
const totalChunks = Math.ceil(totalLen / chunkSize);
|
|
127399
127804
|
let offset = 0;
|
|
127400
127805
|
let chunkIndex = 0;
|
|
127401
127806
|
while (offset < totalLen) {
|
|
127402
127807
|
const chunk = Buffer.from(content.slice(offset, offset + chunkSize));
|
|
127403
|
-
const
|
|
127808
|
+
const writeIx = await program3.methods.writeToBuffer(name, offset, chunk).accounts({
|
|
127404
127809
|
authority: wallet.publicKey,
|
|
127405
127810
|
buffer: bufferKeypair.publicKey
|
|
127406
|
-
}).
|
|
127811
|
+
}).instruction();
|
|
127812
|
+
const writeSig = await sendTx(connection, wallet, [writeIx]);
|
|
127407
127813
|
offset += chunk.length;
|
|
127408
127814
|
chunkIndex++;
|
|
127409
127815
|
options?.onProgress?.(chunkIndex, totalChunks, writeSig);
|
|
127410
127816
|
}
|
|
127411
|
-
const contentKeypair =
|
|
127817
|
+
const contentKeypair = import_web391.Keypair.generate();
|
|
127412
127818
|
const contentSize = CONTENT_HEADER_SIZE + totalLen;
|
|
127413
127819
|
const contentRent = await connection.getMinimumBalanceForRentExemption(contentSize);
|
|
127414
|
-
const
|
|
127415
|
-
|
|
127416
|
-
|
|
127417
|
-
|
|
127418
|
-
|
|
127419
|
-
|
|
127420
|
-
|
|
127421
|
-
|
|
127422
|
-
);
|
|
127423
|
-
await sendAndConfirmTx2(connection, createContentTx, [wallet, contentKeypair]);
|
|
127820
|
+
const createContentIx = import_web391.SystemProgram.createAccount({
|
|
127821
|
+
fromPubkey: wallet.publicKey,
|
|
127822
|
+
newAccountPubkey: contentKeypair.publicKey,
|
|
127823
|
+
lamports: contentRent,
|
|
127824
|
+
space: contentSize,
|
|
127825
|
+
programId: program3.programId
|
|
127826
|
+
});
|
|
127827
|
+
await sendTx(connection, wallet, [createContentIx], [contentKeypair]);
|
|
127424
127828
|
if (isUpdate) {
|
|
127425
|
-
|
|
127829
|
+
const finalizeIx = await program3.methods.finalizeSkillUpdate(name).accounts({
|
|
127426
127830
|
authority: wallet.publicKey,
|
|
127427
127831
|
buffer: bufferKeypair.publicKey,
|
|
127428
127832
|
newContent: contentKeypair.publicKey,
|
|
127429
127833
|
oldContent: existingContent
|
|
127430
|
-
}).
|
|
127834
|
+
}).instruction();
|
|
127835
|
+
return sendTx(connection, wallet, [finalizeIx]);
|
|
127431
127836
|
} else {
|
|
127432
|
-
|
|
127837
|
+
const finalizeIx = await program3.methods.finalizeSkillNew(name).accounts({
|
|
127433
127838
|
authority: wallet.publicKey,
|
|
127434
127839
|
buffer: bufferKeypair.publicKey,
|
|
127435
127840
|
newContent: contentKeypair.publicKey
|
|
127436
|
-
}).
|
|
127841
|
+
}).instruction();
|
|
127842
|
+
return sendTx(connection, wallet, [finalizeIx]);
|
|
127437
127843
|
}
|
|
127438
127844
|
}
|
|
127439
127845
|
|
|
127440
127846
|
// node_modules/nara-sdk/src/zkid.ts
|
|
127441
|
-
var
|
|
127847
|
+
var import_web392 = __toESM(require_index_cjs(), 1);
|
|
127442
127848
|
var anchor4 = __toESM(require_cjs(), 1);
|
|
127443
127849
|
var import_anchor4 = __toESM(require_cjs(), 1);
|
|
127444
127850
|
init_main3();
|
|
127445
127851
|
var import_tweetnacl = __toESM(require_nacl_fast(), 1);
|
|
127446
127852
|
var import_bn2 = __toESM(require_bn(), 1);
|
|
127447
127853
|
init_constants2();
|
|
127854
|
+
init_tx();
|
|
127448
127855
|
|
|
127449
127856
|
// node_modules/nara-sdk/src/idls/nara_zk.json
|
|
127450
127857
|
var nara_zk_default = {
|
|
@@ -128700,28 +129107,28 @@ function createReadProgram(connection, programId) {
|
|
|
128700
129107
|
const idlWithPid = { ...idl, address: pid };
|
|
128701
129108
|
const provider = new import_anchor4.AnchorProvider(
|
|
128702
129109
|
connection,
|
|
128703
|
-
new import_anchor4.Wallet(
|
|
129110
|
+
new import_anchor4.Wallet(import_web392.Keypair.generate()),
|
|
128704
129111
|
{ commitment: "confirmed" }
|
|
128705
129112
|
);
|
|
128706
129113
|
return new import_anchor4.Program(idlWithPid, provider);
|
|
128707
129114
|
}
|
|
128708
129115
|
function findZkIdPda(nameHashBuf, programId) {
|
|
128709
|
-
return
|
|
129116
|
+
return import_web392.PublicKey.findProgramAddressSync(
|
|
128710
129117
|
[new TextEncoder().encode("zk_id"), nameHashBuf],
|
|
128711
129118
|
programId
|
|
128712
129119
|
);
|
|
128713
129120
|
}
|
|
128714
129121
|
function findInboxPda(nameHashBuf, programId) {
|
|
128715
|
-
return
|
|
129122
|
+
return import_web392.PublicKey.findProgramAddressSync(
|
|
128716
129123
|
[new TextEncoder().encode("inbox"), nameHashBuf],
|
|
128717
129124
|
programId
|
|
128718
129125
|
);
|
|
128719
129126
|
}
|
|
128720
129127
|
function findConfigPda(programId) {
|
|
128721
|
-
return
|
|
129128
|
+
return import_web392.PublicKey.findProgramAddressSync([new TextEncoder().encode("config")], programId);
|
|
128722
129129
|
}
|
|
128723
129130
|
function findNullifierPda(denomination, nullifierHash, programId) {
|
|
128724
|
-
return
|
|
129131
|
+
return import_web392.PublicKey.findProgramAddressSync(
|
|
128725
129132
|
[new TextEncoder().encode("nullifier"), denomBuf(denomination), nullifierHash],
|
|
128726
129133
|
programId
|
|
128727
129134
|
);
|
|
@@ -128738,14 +129145,14 @@ function isValidRecipient(pubkey) {
|
|
|
128738
129145
|
}
|
|
128739
129146
|
function generateValidRecipient() {
|
|
128740
129147
|
for (let i = 0; i < 1e3; i++) {
|
|
128741
|
-
const kp =
|
|
129148
|
+
const kp = import_web392.Keypair.generate();
|
|
128742
129149
|
if (isValidRecipient(kp.publicKey)) return kp;
|
|
128743
129150
|
}
|
|
128744
129151
|
throw new Error("Could not generate valid recipient after 1000 tries");
|
|
128745
129152
|
}
|
|
128746
129153
|
async function getZkIdInfo(connection, name, options) {
|
|
128747
129154
|
const program3 = createReadProgram(connection, options?.programId);
|
|
128748
|
-
const programId = new
|
|
129155
|
+
const programId = new import_web392.PublicKey(options?.programId ?? DEFAULT_ZKID_PROGRAM_ID);
|
|
128749
129156
|
const [zkIdPda] = findZkIdPda(await computeNameHash(name), programId);
|
|
128750
129157
|
try {
|
|
128751
129158
|
const data = await program3.account.zkIdAccount.fetch(zkIdPda);
|
|
@@ -128761,25 +129168,27 @@ async function getZkIdInfo(connection, name, options) {
|
|
|
128761
129168
|
}
|
|
128762
129169
|
async function createZkId(connection, payer, name, idSecret, options) {
|
|
128763
129170
|
const program3 = createProgram4(connection, payer, options?.programId);
|
|
128764
|
-
const programId = new
|
|
129171
|
+
const programId = new import_web392.PublicKey(options?.programId ?? DEFAULT_ZKID_PROGRAM_ID);
|
|
128765
129172
|
const nameHashBuf = await computeNameHash(name);
|
|
128766
129173
|
const idCommitment = await poseidonHash([idSecret]);
|
|
128767
129174
|
const idCommitmentBuf = bigIntToBytes32BE(idCommitment);
|
|
128768
129175
|
const [configPda] = findConfigPda(programId);
|
|
128769
129176
|
const config = await program3.account.configAccount.fetch(configPda);
|
|
128770
|
-
|
|
129177
|
+
const ix = await program3.methods.register(toBytes32(nameHashBuf), toBytes32(idCommitmentBuf)).accounts({
|
|
128771
129178
|
payer: payer.publicKey,
|
|
128772
129179
|
feeRecipient: config.feeRecipient
|
|
128773
|
-
}).
|
|
129180
|
+
}).instruction();
|
|
129181
|
+
return sendTx(connection, payer, [ix]);
|
|
128774
129182
|
}
|
|
128775
129183
|
async function deposit(connection, payer, name, denomination, options) {
|
|
128776
129184
|
const program3 = createProgram4(connection, payer, options?.programId);
|
|
128777
129185
|
const nameHashBuf = await computeNameHash(name);
|
|
128778
|
-
|
|
129186
|
+
const ix = await program3.methods.deposit(toBytes32(nameHashBuf), denomination).accounts({ depositor: payer.publicKey }).instruction();
|
|
129187
|
+
return sendTx(connection, payer, [ix]);
|
|
128779
129188
|
}
|
|
128780
129189
|
async function scanClaimableDeposits(connection, name, idSecret, options) {
|
|
128781
129190
|
const program3 = createReadProgram(connection, options?.programId);
|
|
128782
|
-
const programId = new
|
|
129191
|
+
const programId = new import_web392.PublicKey(options?.programId ?? DEFAULT_ZKID_PROGRAM_ID);
|
|
128783
129192
|
const nameHashBuf = await computeNameHash(name);
|
|
128784
129193
|
const [zkIdPda] = findZkIdPda(nameHashBuf, programId);
|
|
128785
129194
|
const [inboxPda] = findInboxPda(nameHashBuf, programId);
|
|
@@ -128822,9 +129231,9 @@ async function withdraw(connection, payer, name, idSecret, depositInfo, recipien
|
|
|
128822
129231
|
);
|
|
128823
129232
|
}
|
|
128824
129233
|
const program3 = createProgram4(connection, payer, options?.programId);
|
|
128825
|
-
const programId = new
|
|
129234
|
+
const programId = new import_web392.PublicKey(options?.programId ?? DEFAULT_ZKID_PROGRAM_ID);
|
|
128826
129235
|
const denominationBN = new import_bn2.default(depositInfo.denomination.toString());
|
|
128827
|
-
const [treePda] =
|
|
129236
|
+
const [treePda] = import_web392.PublicKey.findProgramAddressSync(
|
|
128828
129237
|
[new TextEncoder().encode("tree"), denomBuf(denominationBN)],
|
|
128829
129238
|
programId
|
|
128830
129239
|
);
|
|
@@ -128863,7 +129272,7 @@ async function withdraw(connection, payer, name, idSecret, depositInfo, recipien
|
|
|
128863
129272
|
}
|
|
128864
129273
|
const { proof } = await silentProve2(input, wasmSource, zkeySource);
|
|
128865
129274
|
const packedProof = packProof(proof);
|
|
128866
|
-
|
|
129275
|
+
const ix = await program3.methods.withdraw(
|
|
128867
129276
|
Buffer.from(packedProof),
|
|
128868
129277
|
toBytes32(root),
|
|
128869
129278
|
toBytes32(nullifierHashBuf),
|
|
@@ -128872,7 +129281,8 @@ async function withdraw(connection, payer, name, idSecret, depositInfo, recipien
|
|
|
128872
129281
|
).accounts({
|
|
128873
129282
|
payer: payer.publicKey,
|
|
128874
129283
|
recipient
|
|
128875
|
-
}).
|
|
129284
|
+
}).instruction();
|
|
129285
|
+
return sendTx(connection, payer, [ix]);
|
|
128876
129286
|
}
|
|
128877
129287
|
async function computeIdCommitment(keypair, name) {
|
|
128878
129288
|
const idSecret = await deriveIdSecret(keypair, name);
|
|
@@ -128882,7 +129292,7 @@ async function computeIdCommitment(keypair, name) {
|
|
|
128882
129292
|
async function transferZkIdByCommitment(connection, payer, name, currentIdSecret, newIdCommitment, options) {
|
|
128883
129293
|
const program3 = createProgram4(connection, payer, options?.programId);
|
|
128884
129294
|
const nameHashBuf = await computeNameHash(name);
|
|
128885
|
-
const [zkIdPda] = findZkIdPda(nameHashBuf, new
|
|
129295
|
+
const [zkIdPda] = findZkIdPda(nameHashBuf, new import_web392.PublicKey(options?.programId ?? DEFAULT_ZKID_PROGRAM_ID));
|
|
128886
129296
|
const zkId = await program3.account.zkIdAccount.fetch(zkIdPda);
|
|
128887
129297
|
const currentCommitmentField = bytes32ToBigInt(
|
|
128888
129298
|
new Uint8Array(zkId.idCommitment)
|
|
@@ -128901,20 +129311,21 @@ async function transferZkIdByCommitment(connection, payer, name, currentIdSecret
|
|
|
128901
129311
|
}
|
|
128902
129312
|
const { proof } = await silentProve2(input, wasmSource, zkeySource);
|
|
128903
129313
|
const packedProof = packProof(proof);
|
|
128904
|
-
|
|
129314
|
+
const ix = await program3.methods.transferZkId(
|
|
128905
129315
|
toBytes32(nameHashBuf),
|
|
128906
129316
|
toBytes32(newCommitmentBuf),
|
|
128907
129317
|
Buffer.from(packedProof)
|
|
128908
|
-
).accounts({ payer: payer.publicKey }).
|
|
129318
|
+
).accounts({ payer: payer.publicKey }).instruction();
|
|
129319
|
+
return sendTx(connection, payer, [ix]);
|
|
128909
129320
|
}
|
|
128910
129321
|
|
|
128911
129322
|
// node_modules/nara-sdk/index.ts
|
|
128912
129323
|
init_agent_registry();
|
|
128913
|
-
var
|
|
129324
|
+
var import_web393 = __toESM(require_index_cjs(), 1);
|
|
128914
129325
|
var import_bn3 = __toESM(require_bn(), 1);
|
|
128915
129326
|
|
|
128916
129327
|
// src/cli/utils/wallet.ts
|
|
128917
|
-
var
|
|
129328
|
+
var import_web394 = __toESM(require_index_cjs(), 1);
|
|
128918
129329
|
var import_node_path2 = require("node:path");
|
|
128919
129330
|
var import_node_os2 = require("node:os");
|
|
128920
129331
|
|
|
@@ -129030,9 +129441,9 @@ async function loadWallet(walletPath) {
|
|
|
129030
129441
|
const file = await fs.readFile(path, "utf-8");
|
|
129031
129442
|
const data = JSON.parse(file);
|
|
129032
129443
|
if (Array.isArray(data)) {
|
|
129033
|
-
return
|
|
129444
|
+
return import_web394.Keypair.fromSecretKey(new Uint8Array(data));
|
|
129034
129445
|
} else if (data.secretKey) {
|
|
129035
|
-
return
|
|
129446
|
+
return import_web394.Keypair.fromSecretKey(new Uint8Array(data.secretKey));
|
|
129036
129447
|
} else {
|
|
129037
129448
|
throw new Error(
|
|
129038
129449
|
"Invalid wallet file format. Expected array or object with secretKey field."
|
|
@@ -129058,10 +129469,10 @@ function getRpcUrl(rpcUrl) {
|
|
|
129058
129469
|
}
|
|
129059
129470
|
|
|
129060
129471
|
// src/cli/utils/validation.ts
|
|
129061
|
-
var
|
|
129472
|
+
var import_web395 = __toESM(require_index_cjs(), 1);
|
|
129062
129473
|
function validatePublicKey(address) {
|
|
129063
129474
|
try {
|
|
129064
|
-
return new
|
|
129475
|
+
return new import_web395.PublicKey(address);
|
|
129065
129476
|
} catch (error) {
|
|
129066
129477
|
throw new Error(`Invalid Solana address: ${address}`);
|
|
129067
129478
|
}
|
|
@@ -129086,7 +129497,7 @@ function validateName(value, label) {
|
|
|
129086
129497
|
}
|
|
129087
129498
|
|
|
129088
129499
|
// src/cli/utils/transaction.ts
|
|
129089
|
-
var
|
|
129500
|
+
var import_web396 = __toESM(require_index_cjs(), 1);
|
|
129090
129501
|
|
|
129091
129502
|
// src/cli/utils/output.ts
|
|
129092
129503
|
function formatOutput(data, jsonMode = false) {
|
|
@@ -129171,7 +129582,7 @@ async function signAndSendTransaction(sdk, transaction, signers) {
|
|
|
129171
129582
|
try {
|
|
129172
129583
|
printInfo("Signing transaction...");
|
|
129173
129584
|
let signature;
|
|
129174
|
-
if (transaction instanceof
|
|
129585
|
+
if (transaction instanceof import_web396.VersionedTransaction) {
|
|
129175
129586
|
transaction.sign(signers);
|
|
129176
129587
|
printInfo("Sending transaction...");
|
|
129177
129588
|
signature = await connection.sendTransaction(transaction, {
|
|
@@ -129271,7 +129682,7 @@ async function handleWalletBalance(address, options) {
|
|
|
129271
129682
|
}
|
|
129272
129683
|
printInfo(`Checking balance for: ${pubkey.toBase58()}`);
|
|
129273
129684
|
const balance = await connection.getBalance(pubkey);
|
|
129274
|
-
const balanceSOL = balance /
|
|
129685
|
+
const balanceSOL = balance / import_web397.LAMPORTS_PER_SOL;
|
|
129275
129686
|
if (options.json) {
|
|
129276
129687
|
const output = {
|
|
129277
129688
|
address: pubkey.toBase58(),
|
|
@@ -129398,7 +129809,7 @@ Transaction: ${signature}`);
|
|
|
129398
129809
|
console.log(`Time: ${date.toISOString()}`);
|
|
129399
129810
|
}
|
|
129400
129811
|
if (output.fee) {
|
|
129401
|
-
console.log(`Fee: ${output.fee /
|
|
129812
|
+
console.log(`Fee: ${output.fee / import_web397.LAMPORTS_PER_SOL} NARA`);
|
|
129402
129813
|
}
|
|
129403
129814
|
if (output.error) {
|
|
129404
129815
|
console.log(`Error: ${JSON.stringify(output.error)}`);
|
|
@@ -129416,7 +129827,7 @@ async function handleTransferSol(to, amount, options) {
|
|
|
129416
129827
|
printInfo(`From: ${wallet.publicKey.toBase58()}`);
|
|
129417
129828
|
const recipient = validatePublicKey(to);
|
|
129418
129829
|
const amountSOL = validatePositiveNumber(amount, "amount");
|
|
129419
|
-
const lamports = Math.floor(amountSOL *
|
|
129830
|
+
const lamports = Math.floor(amountSOL * import_web397.LAMPORTS_PER_SOL);
|
|
129420
129831
|
printInfo(`To: ${recipient.toBase58()}`);
|
|
129421
129832
|
printInfo(`Amount: ${amountSOL} NARA`);
|
|
129422
129833
|
const sdk = new NaraSDK({
|
|
@@ -129424,12 +129835,12 @@ async function handleTransferSol(to, amount, options) {
|
|
|
129424
129835
|
commitment: "confirmed"
|
|
129425
129836
|
});
|
|
129426
129837
|
const connection = sdk.getConnection();
|
|
129427
|
-
const transferInstruction =
|
|
129838
|
+
const transferInstruction = import_web397.SystemProgram.transfer({
|
|
129428
129839
|
fromPubkey: wallet.publicKey,
|
|
129429
129840
|
toPubkey: recipient,
|
|
129430
129841
|
lamports
|
|
129431
129842
|
});
|
|
129432
|
-
const transaction = new
|
|
129843
|
+
const transaction = new import_web397.Transaction().add(transferInstruction);
|
|
129433
129844
|
const { blockhash } = await connection.getLatestBlockhash("confirmed");
|
|
129434
129845
|
transaction.recentBlockhash = blockhash;
|
|
129435
129846
|
transaction.feePayer = wallet.publicKey;
|
|
@@ -129492,7 +129903,7 @@ async function handleTransferToken(tokenAddress, to, amount, options) {
|
|
|
129492
129903
|
[],
|
|
129493
129904
|
TOKEN_PROGRAM_ID
|
|
129494
129905
|
);
|
|
129495
|
-
const transaction = new
|
|
129906
|
+
const transaction = new import_web397.Transaction().add(transferInstruction);
|
|
129496
129907
|
const { blockhash } = await connection.getLatestBlockhash("confirmed");
|
|
129497
129908
|
transaction.recentBlockhash = blockhash;
|
|
129498
129909
|
transaction.feePayer = wallet.publicKey;
|
|
@@ -129537,7 +129948,7 @@ async function handleWalletCreate(options) {
|
|
|
129537
129948
|
const mnemonic = bip39.generateMnemonic(128);
|
|
129538
129949
|
const seed = await bip39.mnemonicToSeed(mnemonic);
|
|
129539
129950
|
const derivedSeed = (0, import_ed25519_hd_key.derivePath)("m/44'/501'/0'/0'", seed.toString("hex")).key;
|
|
129540
|
-
const keypair =
|
|
129951
|
+
const keypair = import_web397.Keypair.fromSeed(derivedSeed);
|
|
129541
129952
|
const dir = outputPath.substring(0, outputPath.lastIndexOf("/"));
|
|
129542
129953
|
await (0, import_promises.mkdir)(dir, { recursive: true });
|
|
129543
129954
|
const walletData = Array.from(keypair.secretKey);
|
|
@@ -129573,16 +129984,16 @@ async function handleWalletImport(options) {
|
|
|
129573
129984
|
}
|
|
129574
129985
|
const seed = await bip39.mnemonicToSeed(mnemonic);
|
|
129575
129986
|
const derivedSeed = (0, import_ed25519_hd_key.derivePath)("m/44'/501'/0'/0'", seed.toString("hex")).key;
|
|
129576
|
-
keypair =
|
|
129987
|
+
keypair = import_web397.Keypair.fromSeed(derivedSeed);
|
|
129577
129988
|
printInfo("Importing wallet from mnemonic...");
|
|
129578
129989
|
} else if (options.privateKey) {
|
|
129579
129990
|
const privateKey = options.privateKey.trim();
|
|
129580
129991
|
try {
|
|
129581
129992
|
if (privateKey.startsWith("[")) {
|
|
129582
129993
|
const data = JSON.parse(privateKey);
|
|
129583
|
-
keypair =
|
|
129994
|
+
keypair = import_web397.Keypair.fromSecretKey(new Uint8Array(data));
|
|
129584
129995
|
} else {
|
|
129585
|
-
keypair =
|
|
129996
|
+
keypair = import_web397.Keypair.fromSecretKey(esm_default2.decode(privateKey));
|
|
129586
129997
|
}
|
|
129587
129998
|
printInfo("Importing wallet from private key...");
|
|
129588
129999
|
} catch (error) {
|
|
@@ -129611,7 +130022,7 @@ async function handleWalletAddress(options) {
|
|
|
129611
130022
|
}
|
|
129612
130023
|
|
|
129613
130024
|
// src/cli/commands/quest.ts
|
|
129614
|
-
var
|
|
130025
|
+
var import_web398 = __toESM(require_index_cjs(), 1);
|
|
129615
130026
|
var DEFAULT_QUEST_RELAY_URL2 = process.env.QUEST_RELAY_URL || "https://quest-api.nara.build/";
|
|
129616
130027
|
var QUEST_ERRORS = {
|
|
129617
130028
|
6e3: "unauthorized",
|
|
@@ -129644,12 +130055,12 @@ function formatTimeRemaining(seconds) {
|
|
|
129644
130055
|
}
|
|
129645
130056
|
async function handleQuestGet(options) {
|
|
129646
130057
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
129647
|
-
const connection = new
|
|
130058
|
+
const connection = new import_web398.Connection(rpcUrl, "confirmed");
|
|
129648
130059
|
let wallet;
|
|
129649
130060
|
try {
|
|
129650
130061
|
wallet = await loadWallet(options.wallet);
|
|
129651
130062
|
} catch {
|
|
129652
|
-
wallet =
|
|
130063
|
+
wallet = import_web398.Keypair.generate();
|
|
129653
130064
|
}
|
|
129654
130065
|
let quest;
|
|
129655
130066
|
try {
|
|
@@ -129706,7 +130117,7 @@ async function handleQuestGet(options) {
|
|
|
129706
130117
|
}
|
|
129707
130118
|
async function handleQuestAnswer(answer, options) {
|
|
129708
130119
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
129709
|
-
const connection = new
|
|
130120
|
+
const connection = new import_web398.Connection(rpcUrl, "confirmed");
|
|
129710
130121
|
const wallet = await loadWallet(options.wallet);
|
|
129711
130122
|
const networkConfig = loadNetworkConfig(rpcUrl);
|
|
129712
130123
|
const configAgentId = networkConfig.agent_ids[0];
|
|
@@ -129786,7 +130197,7 @@ async function handleQuestAnswer(answer, options) {
|
|
|
129786
130197
|
}
|
|
129787
130198
|
async function handleQuestStake(amount, options) {
|
|
129788
130199
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
129789
|
-
const connection = new
|
|
130200
|
+
const connection = new import_web398.Connection(rpcUrl, "confirmed");
|
|
129790
130201
|
const wallet = await loadWallet(options.wallet);
|
|
129791
130202
|
const n = parseFloat(amount);
|
|
129792
130203
|
if (isNaN(n) || n <= 0) {
|
|
@@ -129804,7 +130215,7 @@ async function handleQuestStake(amount, options) {
|
|
|
129804
130215
|
}
|
|
129805
130216
|
async function handleQuestUnstake(amount, options) {
|
|
129806
130217
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
129807
|
-
const connection = new
|
|
130218
|
+
const connection = new import_web398.Connection(rpcUrl, "confirmed");
|
|
129808
130219
|
const wallet = await loadWallet(options.wallet);
|
|
129809
130220
|
const n = parseFloat(amount);
|
|
129810
130221
|
if (isNaN(n) || n <= 0) {
|
|
@@ -129822,7 +130233,7 @@ async function handleQuestUnstake(amount, options) {
|
|
|
129822
130233
|
}
|
|
129823
130234
|
async function handleQuestStakeInfo(options) {
|
|
129824
130235
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
129825
|
-
const connection = new
|
|
130236
|
+
const connection = new import_web398.Connection(rpcUrl, "confirmed");
|
|
129826
130237
|
const wallet = await loadWallet(options.wallet);
|
|
129827
130238
|
const stakeInfo = await getStakeInfo(connection, wallet.publicKey);
|
|
129828
130239
|
if (!stakeInfo) {
|
|
@@ -129960,7 +130371,7 @@ function registerQuestCommands(program3) {
|
|
|
129960
130371
|
}
|
|
129961
130372
|
|
|
129962
130373
|
// src/cli/commands/skills.ts
|
|
129963
|
-
var
|
|
130374
|
+
var import_web3100 = __toESM(require_index_cjs(), 1);
|
|
129964
130375
|
var import_promises3 = require("node:fs/promises");
|
|
129965
130376
|
|
|
129966
130377
|
// node_modules/@clack/core/dist/index.mjs
|
|
@@ -131025,7 +131436,7 @@ var import_promises2 = require("node:fs/promises");
|
|
|
131025
131436
|
var import_node_fs2 = require("node:fs");
|
|
131026
131437
|
var import_node_path4 = require("node:path");
|
|
131027
131438
|
var import_node_os4 = require("node:os");
|
|
131028
|
-
var
|
|
131439
|
+
var import_web399 = __toESM(require_index_cjs(), 1);
|
|
131029
131440
|
var home = (0, import_node_os4.homedir)();
|
|
131030
131441
|
var xdgConfig = process.env.XDG_CONFIG_HOME || (0, import_node_path4.join)(home, ".config");
|
|
131031
131442
|
var claudeHome = process.env.CLAUDE_CONFIG_DIR?.trim() || (0, import_node_path4.join)(home, ".claude");
|
|
@@ -131338,7 +131749,7 @@ function shortenPath(fullPath, cwd) {
|
|
|
131338
131749
|
}
|
|
131339
131750
|
async function handleSkillsAdd(name, options) {
|
|
131340
131751
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131341
|
-
const connection = new
|
|
131752
|
+
const connection = new import_web399.Connection(rpcUrl, "confirmed");
|
|
131342
131753
|
const cwd = process.cwd();
|
|
131343
131754
|
const nonInteractive = options.json || options.yes || !process.stdin.isTTY;
|
|
131344
131755
|
if (!options.json) {
|
|
@@ -131546,7 +131957,7 @@ async function handleSkillsList(options) {
|
|
|
131546
131957
|
}
|
|
131547
131958
|
async function handleSkillsCheck(options) {
|
|
131548
131959
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131549
|
-
const connection = new
|
|
131960
|
+
const connection = new import_web399.Connection(rpcUrl, "confirmed");
|
|
131550
131961
|
const cwd = process.cwd();
|
|
131551
131962
|
const isGlobal = options.global ?? false;
|
|
131552
131963
|
const lock = await readLock(isGlobal, cwd);
|
|
@@ -131599,7 +132010,7 @@ async function handleSkillsCheck(options) {
|
|
|
131599
132010
|
}
|
|
131600
132011
|
async function handleSkillsUpdate(names, options) {
|
|
131601
132012
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131602
|
-
const connection = new
|
|
132013
|
+
const connection = new import_web399.Connection(rpcUrl, "confirmed");
|
|
131603
132014
|
const cwd = process.cwd();
|
|
131604
132015
|
const isGlobal = options.global ?? false;
|
|
131605
132016
|
const lock = await readLock(isGlobal, cwd);
|
|
@@ -131671,7 +132082,7 @@ Updated ${updated.length} skill(s)`));
|
|
|
131671
132082
|
async function handleSkillsRegister(name, author, options) {
|
|
131672
132083
|
validateName(name, "Skill name");
|
|
131673
132084
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131674
|
-
const connection = new
|
|
132085
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131675
132086
|
const wallet = await loadWallet(options.wallet);
|
|
131676
132087
|
printInfo(`Registering skill "${name}" by "${author}"...`);
|
|
131677
132088
|
const { signature, skillPubkey } = await registerSkill(connection, wallet, name, author);
|
|
@@ -131685,7 +132096,7 @@ async function handleSkillsRegister(name, author, options) {
|
|
|
131685
132096
|
}
|
|
131686
132097
|
async function handleSkillsGet(name, options) {
|
|
131687
132098
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131688
|
-
const connection = new
|
|
132099
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131689
132100
|
const info = await getSkillInfo(connection, name);
|
|
131690
132101
|
const data = {
|
|
131691
132102
|
name: info.record.name,
|
|
@@ -131714,7 +132125,7 @@ async function handleSkillsGet(name, options) {
|
|
|
131714
132125
|
}
|
|
131715
132126
|
async function handleSkillsContent(name, options) {
|
|
131716
132127
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131717
|
-
const connection = new
|
|
132128
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131718
132129
|
const content = await getSkillContent(connection, name);
|
|
131719
132130
|
if (!content) {
|
|
131720
132131
|
if (options.json) {
|
|
@@ -131737,7 +132148,7 @@ async function handleSkillsContent(name, options) {
|
|
|
131737
132148
|
}
|
|
131738
132149
|
async function handleSkillsSetDescription(name, description, options) {
|
|
131739
132150
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131740
|
-
const connection = new
|
|
132151
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131741
132152
|
const wallet = await loadWallet(options.wallet);
|
|
131742
132153
|
printInfo(`Setting description for skill "${name}"...`);
|
|
131743
132154
|
const signature = await setDescription(connection, wallet, name, description);
|
|
@@ -131755,7 +132166,7 @@ async function handleSkillsSetMetadata(name, json, options) {
|
|
|
131755
132166
|
throw new Error("Invalid JSON provided for metadata");
|
|
131756
132167
|
}
|
|
131757
132168
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131758
|
-
const connection = new
|
|
132169
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131759
132170
|
const wallet = await loadWallet(options.wallet);
|
|
131760
132171
|
printInfo(`Setting metadata for skill "${name}"...`);
|
|
131761
132172
|
const signature = await updateMetadata(connection, wallet, name, json);
|
|
@@ -131768,7 +132179,7 @@ async function handleSkillsSetMetadata(name, json, options) {
|
|
|
131768
132179
|
}
|
|
131769
132180
|
async function handleSkillsUpload(name, filePath, options) {
|
|
131770
132181
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131771
|
-
const connection = new
|
|
132182
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131772
132183
|
const wallet = await loadWallet(options.wallet);
|
|
131773
132184
|
const content = await (0, import_promises3.readFile)(filePath);
|
|
131774
132185
|
printInfo(`Uploading ${content.length} bytes to skill "${name}"...`);
|
|
@@ -131787,12 +132198,12 @@ async function handleSkillsUpload(name, filePath, options) {
|
|
|
131787
132198
|
async function handleSkillsTransfer(name, newAuthority, options) {
|
|
131788
132199
|
let newPubkey;
|
|
131789
132200
|
try {
|
|
131790
|
-
newPubkey = new
|
|
132201
|
+
newPubkey = new import_web3100.PublicKey(newAuthority);
|
|
131791
132202
|
} catch {
|
|
131792
132203
|
throw new Error(`Invalid public key: ${newAuthority}`);
|
|
131793
132204
|
}
|
|
131794
132205
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131795
|
-
const connection = new
|
|
132206
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131796
132207
|
const wallet = await loadWallet(options.wallet);
|
|
131797
132208
|
printInfo(`Transferring authority of skill "${name}" to ${newPubkey.toBase58()}...`);
|
|
131798
132209
|
const signature = await transferAuthority(connection, wallet, name, newPubkey);
|
|
@@ -131805,7 +132216,7 @@ async function handleSkillsTransfer(name, newAuthority, options) {
|
|
|
131805
132216
|
}
|
|
131806
132217
|
async function handleSkillsCloseBuffer(name, options) {
|
|
131807
132218
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131808
|
-
const connection = new
|
|
132219
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131809
132220
|
const wallet = await loadWallet(options.wallet);
|
|
131810
132221
|
printInfo(`Closing pending buffer for skill "${name}"...`);
|
|
131811
132222
|
const signature = await closeBuffer2(connection, wallet, name);
|
|
@@ -131833,7 +132244,7 @@ async function handleSkillsDelete(name, options) {
|
|
|
131833
132244
|
}
|
|
131834
132245
|
}
|
|
131835
132246
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
131836
|
-
const connection = new
|
|
132247
|
+
const connection = new import_web3100.Connection(rpcUrl, "confirmed");
|
|
131837
132248
|
const wallet = await loadWallet(options.wallet);
|
|
131838
132249
|
if (!options.json) printInfo(`Deleting skill "${name}"...`);
|
|
131839
132250
|
const signature = await deleteSkill(connection, wallet, name);
|
|
@@ -131975,7 +132386,7 @@ function registerSkillsCommands(program3) {
|
|
|
131975
132386
|
}
|
|
131976
132387
|
|
|
131977
132388
|
// src/cli/commands/zkid.ts
|
|
131978
|
-
var
|
|
132389
|
+
var import_web3101 = __toESM(require_index_cjs(), 1);
|
|
131979
132390
|
var import_bn4 = __toESM(require_bn(), 1);
|
|
131980
132391
|
var VALID_AMOUNTS = [1, 10, 100, 1e3, 1e4, 1e5];
|
|
131981
132392
|
var DENOM_MAP = {
|
|
@@ -131997,7 +132408,7 @@ function parseDenomination(amount) {
|
|
|
131997
132408
|
}
|
|
131998
132409
|
async function handleZkIdCreate(name, options) {
|
|
131999
132410
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132000
|
-
const connection = new
|
|
132411
|
+
const connection = new import_web3101.Connection(rpcUrl, "confirmed");
|
|
132001
132412
|
const wallet = await loadWallet(options.wallet);
|
|
132002
132413
|
if (!options.json) printInfo(`Deriving idSecret for "${name}"...`);
|
|
132003
132414
|
const idSecret = await deriveIdSecret(wallet, name);
|
|
@@ -132018,7 +132429,7 @@ async function handleZkIdCreate(name, options) {
|
|
|
132018
132429
|
}
|
|
132019
132430
|
async function handleZkIdInfo(name, options) {
|
|
132020
132431
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132021
|
-
const connection = new
|
|
132432
|
+
const connection = new import_web3101.Connection(rpcUrl, "confirmed");
|
|
132022
132433
|
const info = await getZkIdInfo(connection, name);
|
|
132023
132434
|
if (!info) {
|
|
132024
132435
|
if (options.json) {
|
|
@@ -132048,7 +132459,7 @@ async function handleZkIdInfo(name, options) {
|
|
|
132048
132459
|
async function handleZkIdDeposit(name, amount, options) {
|
|
132049
132460
|
const denomination = parseDenomination(amount);
|
|
132050
132461
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132051
|
-
const connection = new
|
|
132462
|
+
const connection = new import_web3101.Connection(rpcUrl, "confirmed");
|
|
132052
132463
|
const wallet = await loadWallet(options.wallet);
|
|
132053
132464
|
if (!options.json) printInfo(`Depositing ${amount} NARA into ZK ID "${name}"...`);
|
|
132054
132465
|
const signature = await deposit(connection, wallet, name, denomination);
|
|
@@ -132061,7 +132472,7 @@ async function handleZkIdDeposit(name, amount, options) {
|
|
|
132061
132472
|
}
|
|
132062
132473
|
async function handleZkIdScan(name, options) {
|
|
132063
132474
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132064
|
-
const connection = new
|
|
132475
|
+
const connection = new import_web3101.Connection(rpcUrl, "confirmed");
|
|
132065
132476
|
const wallet = await loadWallet(options.wallet);
|
|
132066
132477
|
let names;
|
|
132067
132478
|
if (name) {
|
|
@@ -132129,7 +132540,7 @@ async function handleZkIdWithdraw(name, options) {
|
|
|
132129
132540
|
let recipient;
|
|
132130
132541
|
if (options.recipient) {
|
|
132131
132542
|
try {
|
|
132132
|
-
recipient = new
|
|
132543
|
+
recipient = new import_web3101.PublicKey(options.recipient);
|
|
132133
132544
|
} catch {
|
|
132134
132545
|
throw new Error(`Invalid recipient address: ${options.recipient}`);
|
|
132135
132546
|
}
|
|
@@ -132140,7 +132551,7 @@ async function handleZkIdWithdraw(name, options) {
|
|
|
132140
132551
|
}
|
|
132141
132552
|
}
|
|
132142
132553
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132143
|
-
const connection = new
|
|
132554
|
+
const connection = new import_web3101.Connection(rpcUrl, "confirmed");
|
|
132144
132555
|
const wallet = await loadWallet(options.wallet);
|
|
132145
132556
|
if (!options.json) printInfo(`Scanning deposits for "${name}"...`);
|
|
132146
132557
|
const idSecret = await deriveIdSecret(wallet, name);
|
|
@@ -132206,7 +132617,7 @@ async function handleZkIdTransfer(name, newIdCommitmentHex, options) {
|
|
|
132206
132617
|
throw new Error(`Invalid id-commitment: ${e3.message}`);
|
|
132207
132618
|
}
|
|
132208
132619
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132209
|
-
const connection = new
|
|
132620
|
+
const connection = new import_web3101.Connection(rpcUrl, "confirmed");
|
|
132210
132621
|
const wallet = await loadWallet(options.wallet);
|
|
132211
132622
|
if (!options.json) printInfo(`Generating ownership proof for "${name}"...`);
|
|
132212
132623
|
const currentIdSecret = await deriveIdSecret(wallet, name);
|
|
@@ -132294,12 +132705,12 @@ function registerZkIdCommands(program3) {
|
|
|
132294
132705
|
}
|
|
132295
132706
|
|
|
132296
132707
|
// src/cli/commands/agent.ts
|
|
132297
|
-
var
|
|
132708
|
+
var import_web3102 = __toESM(require_index_cjs(), 1);
|
|
132298
132709
|
var import_node_fs3 = require("node:fs");
|
|
132299
132710
|
async function handleAgentRegister(agentId, options) {
|
|
132300
132711
|
validateName(agentId, "Agent ID");
|
|
132301
132712
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132302
|
-
const connection = new
|
|
132713
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132303
132714
|
const wallet = await loadWallet(options.wallet);
|
|
132304
132715
|
if (!options.json) printInfo(`Registering agent "${agentId}"...`);
|
|
132305
132716
|
const result = options.referral ? await registerAgentWithReferral(connection, wallet, agentId, options.referral) : await registerAgent(connection, wallet, agentId);
|
|
@@ -132315,7 +132726,7 @@ async function handleAgentRegister(agentId, options) {
|
|
|
132315
132726
|
}
|
|
132316
132727
|
async function handleAgentGet(agentId, options) {
|
|
132317
132728
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132318
|
-
const connection = new
|
|
132729
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132319
132730
|
const info = await getAgentInfo(connection, agentId);
|
|
132320
132731
|
const data = {
|
|
132321
132732
|
agentId: info.record.agentId,
|
|
@@ -132342,7 +132753,7 @@ async function handleAgentGet(agentId, options) {
|
|
|
132342
132753
|
}
|
|
132343
132754
|
async function handleAgentSetBio(agentId, bio, options) {
|
|
132344
132755
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132345
|
-
const connection = new
|
|
132756
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132346
132757
|
const wallet = await loadWallet(options.wallet);
|
|
132347
132758
|
if (!options.json) printInfo(`Setting bio for "${agentId}"...`);
|
|
132348
132759
|
const signature = await setBio(connection, wallet, agentId, bio);
|
|
@@ -132360,7 +132771,7 @@ async function handleAgentSetMetadata(agentId, jsonStr, options) {
|
|
|
132360
132771
|
throw new Error(`Invalid JSON: ${jsonStr}`);
|
|
132361
132772
|
}
|
|
132362
132773
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132363
|
-
const connection = new
|
|
132774
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132364
132775
|
const wallet = await loadWallet(options.wallet);
|
|
132365
132776
|
if (!options.json) printInfo(`Setting metadata for "${agentId}"...`);
|
|
132366
132777
|
const signature = await setMetadata(connection, wallet, agentId, jsonStr);
|
|
@@ -132379,7 +132790,7 @@ async function handleAgentUploadMemory(agentId, filePath, options) {
|
|
|
132379
132790
|
throw new Error(`Failed to read file "${filePath}": ${err.message}`);
|
|
132380
132791
|
}
|
|
132381
132792
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132382
|
-
const connection = new
|
|
132793
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132383
132794
|
const wallet = await loadWallet(options.wallet);
|
|
132384
132795
|
if (!options.json) printInfo(`Uploading memory for "${agentId}" (${data.length} bytes)...`);
|
|
132385
132796
|
const signature = await uploadMemory(connection, wallet, agentId, data, {
|
|
@@ -132396,7 +132807,7 @@ async function handleAgentUploadMemory(agentId, filePath, options) {
|
|
|
132396
132807
|
}
|
|
132397
132808
|
async function handleAgentMemory(agentId, options) {
|
|
132398
132809
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132399
|
-
const connection = new
|
|
132810
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132400
132811
|
const memory = await getAgentMemory(connection, agentId);
|
|
132401
132812
|
if (!memory) {
|
|
132402
132813
|
if (options.json) {
|
|
@@ -132415,12 +132826,12 @@ async function handleAgentMemory(agentId, options) {
|
|
|
132415
132826
|
async function handleAgentTransfer(agentId, newAuthority, options) {
|
|
132416
132827
|
let newAuth;
|
|
132417
132828
|
try {
|
|
132418
|
-
newAuth = new
|
|
132829
|
+
newAuth = new import_web3102.PublicKey(newAuthority);
|
|
132419
132830
|
} catch {
|
|
132420
132831
|
throw new Error(`Invalid public key: ${newAuthority}`);
|
|
132421
132832
|
}
|
|
132422
132833
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132423
|
-
const connection = new
|
|
132834
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132424
132835
|
const wallet = await loadWallet(options.wallet);
|
|
132425
132836
|
if (!options.json) printInfo(`Transferring agent "${agentId}" authority...`);
|
|
132426
132837
|
const signature = await transferAgentAuthority(connection, wallet, agentId, newAuth);
|
|
@@ -132434,7 +132845,7 @@ async function handleAgentTransfer(agentId, newAuthority, options) {
|
|
|
132434
132845
|
}
|
|
132435
132846
|
async function handleAgentCloseBuffer(agentId, options) {
|
|
132436
132847
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132437
|
-
const connection = new
|
|
132848
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132438
132849
|
const wallet = await loadWallet(options.wallet);
|
|
132439
132850
|
if (!options.json) printInfo(`Closing buffer for "${agentId}"...`);
|
|
132440
132851
|
const signature = await closeBuffer(connection, wallet, agentId);
|
|
@@ -132447,7 +132858,7 @@ async function handleAgentCloseBuffer(agentId, options) {
|
|
|
132447
132858
|
}
|
|
132448
132859
|
async function handleAgentDelete(agentId, options) {
|
|
132449
132860
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132450
|
-
const connection = new
|
|
132861
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132451
132862
|
const wallet = await loadWallet(options.wallet);
|
|
132452
132863
|
if (!options.json) printInfo(`Deleting agent "${agentId}"...`);
|
|
132453
132864
|
const signature = await deleteAgent(connection, wallet, agentId);
|
|
@@ -132460,7 +132871,7 @@ async function handleAgentDelete(agentId, options) {
|
|
|
132460
132871
|
}
|
|
132461
132872
|
async function handleAgentSetReferral(agentId, referralAgentId, options) {
|
|
132462
132873
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132463
|
-
const connection = new
|
|
132874
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132464
132875
|
const wallet = await loadWallet(options.wallet);
|
|
132465
132876
|
if (!options.json) printInfo(`Setting referral for "${agentId}" to "${referralAgentId}"...`);
|
|
132466
132877
|
const signature = await setReferral(connection, wallet, agentId, referralAgentId);
|
|
@@ -132473,7 +132884,7 @@ async function handleAgentSetReferral(agentId, referralAgentId, options) {
|
|
|
132473
132884
|
}
|
|
132474
132885
|
async function handleAgentLog(agentId, activity, log, options) {
|
|
132475
132886
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
132476
|
-
const connection = new
|
|
132887
|
+
const connection = new import_web3102.Connection(rpcUrl, "confirmed");
|
|
132477
132888
|
const wallet = await loadWallet(options.wallet);
|
|
132478
132889
|
const model = options.model ?? "";
|
|
132479
132890
|
const referral = options.referral;
|
|
@@ -132774,11 +133185,11 @@ function registerCommands(program3) {
|
|
|
132774
133185
|
const buf = Buffer.from(base64Tx, "base64");
|
|
132775
133186
|
let tx;
|
|
132776
133187
|
try {
|
|
132777
|
-
tx =
|
|
133188
|
+
tx = import_web3103.VersionedTransaction.deserialize(new Uint8Array(buf));
|
|
132778
133189
|
} catch {
|
|
132779
|
-
tx =
|
|
133190
|
+
tx = import_web3103.Transaction.from(buf);
|
|
132780
133191
|
}
|
|
132781
|
-
if (tx instanceof
|
|
133192
|
+
if (tx instanceof import_web3103.VersionedTransaction) {
|
|
132782
133193
|
tx.sign([wallet]);
|
|
132783
133194
|
} else {
|
|
132784
133195
|
tx.sign(wallet);
|
|
@@ -132789,7 +133200,7 @@ function registerCommands(program3) {
|
|
|
132789
133200
|
const connection = sdk.getConnection();
|
|
132790
133201
|
printInfo("Sending transaction...");
|
|
132791
133202
|
let signature;
|
|
132792
|
-
if (tx instanceof
|
|
133203
|
+
if (tx instanceof import_web3103.VersionedTransaction) {
|
|
132793
133204
|
signature = await connection.sendTransaction(tx, { maxRetries: 3 });
|
|
132794
133205
|
} else {
|
|
132795
133206
|
signature = await connection.sendRawTransaction(tx.serialize(), { skipPreflight: true });
|
|
@@ -132803,7 +133214,7 @@ function registerCommands(program3) {
|
|
|
132803
133214
|
console.log(`Signature: ${signature}`);
|
|
132804
133215
|
}
|
|
132805
133216
|
} else {
|
|
132806
|
-
const serialized = tx instanceof
|
|
133217
|
+
const serialized = tx instanceof import_web3103.VersionedTransaction ? Buffer.from(tx.serialize()).toString("base64") : Buffer.from(tx.serialize()).toString("base64");
|
|
132807
133218
|
if (opts.json) {
|
|
132808
133219
|
console.log(JSON.stringify({ transaction: serialized }, null, 2));
|
|
132809
133220
|
} else {
|
|
@@ -132818,7 +133229,7 @@ function registerCommands(program3) {
|
|
|
132818
133229
|
}
|
|
132819
133230
|
|
|
132820
133231
|
// bin/nara-cli.ts
|
|
132821
|
-
var version2 = true ? "1.0.
|
|
133232
|
+
var version2 = true ? "1.0.45" : "dev";
|
|
132822
133233
|
var program2 = new Command();
|
|
132823
133234
|
program2.name("naracli").description("CLI for the Nara chain (Solana-compatible)").version(version2);
|
|
132824
133235
|
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");
|