nara-sdk 1.0.63 → 1.0.64
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/package.json +1 -1
- package/src/agent_registry.ts +35 -34
package/package.json
CHANGED
package/src/agent_registry.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from "@solana/web3.js";
|
|
13
13
|
import * as anchor from "@coral-xyz/anchor";
|
|
14
14
|
import { Program, AnchorProvider, Wallet } from "@coral-xyz/anchor";
|
|
15
|
+
import BN from "bn.js";
|
|
15
16
|
import { getAssociatedTokenAddressSync, TOKEN_2022_PROGRAM_ID } from "@solana/spl-token";
|
|
16
17
|
import type { NaraAgentRegistry } from "./idls/nara_agent_registry";
|
|
17
18
|
import { DEFAULT_AGENT_REGISTRY_PROGRAM_ID } from "./constants";
|
|
@@ -985,11 +986,11 @@ export async function updateAdmin(
|
|
|
985
986
|
export async function withdrawFees(
|
|
986
987
|
connection: Connection,
|
|
987
988
|
wallet: Keypair,
|
|
988
|
-
amount: number |
|
|
989
|
+
amount: number | BN,
|
|
989
990
|
options?: AgentRegistryOptions
|
|
990
991
|
): Promise<string> {
|
|
991
992
|
const program = createProgram(connection, wallet, options?.programId);
|
|
992
|
-
const amt = typeof amount === "number" ? new
|
|
993
|
+
const amt = typeof amount === "number" ? new BN(amount) : amount;
|
|
993
994
|
const ix = await program.methods
|
|
994
995
|
.withdrawFees(amt)
|
|
995
996
|
.accounts({ admin: wallet.publicKey } as any)
|
|
@@ -1003,11 +1004,11 @@ export async function withdrawFees(
|
|
|
1003
1004
|
export async function updateRegisterFee(
|
|
1004
1005
|
connection: Connection,
|
|
1005
1006
|
wallet: Keypair,
|
|
1006
|
-
newFee: number |
|
|
1007
|
+
newFee: number | BN,
|
|
1007
1008
|
options?: AgentRegistryOptions
|
|
1008
1009
|
): Promise<string> {
|
|
1009
1010
|
const program = createProgram(connection, wallet, options?.programId);
|
|
1010
|
-
const fee = typeof newFee === "number" ? new
|
|
1011
|
+
const fee = typeof newFee === "number" ? new BN(newFee) : newFee;
|
|
1011
1012
|
const ix = await program.methods
|
|
1012
1013
|
.updateRegisterFee(fee)
|
|
1013
1014
|
.accounts({ admin: wallet.publicKey } as any)
|
|
@@ -1022,13 +1023,13 @@ export async function updateRegisterFee(
|
|
|
1022
1023
|
export async function updatePointsConfig(
|
|
1023
1024
|
connection: Connection,
|
|
1024
1025
|
wallet: Keypair,
|
|
1025
|
-
pointsSelf: number |
|
|
1026
|
-
pointsReferral: number |
|
|
1026
|
+
pointsSelf: number | BN,
|
|
1027
|
+
pointsReferral: number | BN,
|
|
1027
1028
|
options?: AgentRegistryOptions
|
|
1028
1029
|
): Promise<string> {
|
|
1029
1030
|
const program = createProgram(connection, wallet, options?.programId);
|
|
1030
|
-
const ps = typeof pointsSelf === "number" ? new
|
|
1031
|
-
const pr = typeof pointsReferral === "number" ? new
|
|
1031
|
+
const ps = typeof pointsSelf === "number" ? new BN(pointsSelf) : pointsSelf;
|
|
1032
|
+
const pr = typeof pointsReferral === "number" ? new BN(pointsReferral) : pointsReferral;
|
|
1032
1033
|
const ix = await program.methods
|
|
1033
1034
|
.updatePointsConfig(ps, pr)
|
|
1034
1035
|
.accounts({ admin: wallet.publicKey } as any)
|
|
@@ -1045,15 +1046,15 @@ export async function updatePointsConfig(
|
|
|
1045
1046
|
export async function updateReferralConfig(
|
|
1046
1047
|
connection: Connection,
|
|
1047
1048
|
wallet: Keypair,
|
|
1048
|
-
referralRegisterFee: number |
|
|
1049
|
-
referralFeeShare: number |
|
|
1050
|
-
referralRegisterPoints: number |
|
|
1049
|
+
referralRegisterFee: number | BN,
|
|
1050
|
+
referralFeeShare: number | BN,
|
|
1051
|
+
referralRegisterPoints: number | BN,
|
|
1051
1052
|
options?: AgentRegistryOptions
|
|
1052
1053
|
): Promise<string> {
|
|
1053
1054
|
const program = createProgram(connection, wallet, options?.programId);
|
|
1054
|
-
const fee = typeof referralRegisterFee === "number" ? new
|
|
1055
|
-
const share = typeof referralFeeShare === "number" ? new
|
|
1056
|
-
const pts = typeof referralRegisterPoints === "number" ? new
|
|
1055
|
+
const fee = typeof referralRegisterFee === "number" ? new BN(referralRegisterFee) : referralRegisterFee;
|
|
1056
|
+
const share = typeof referralFeeShare === "number" ? new BN(referralFeeShare) : referralFeeShare;
|
|
1057
|
+
const pts = typeof referralRegisterPoints === "number" ? new BN(referralRegisterPoints) : referralRegisterPoints;
|
|
1057
1058
|
const ix = await program.methods
|
|
1058
1059
|
.updateReferralConfig(fee, share, pts)
|
|
1059
1060
|
.accounts({ admin: wallet.publicKey } as any)
|
|
@@ -1069,13 +1070,13 @@ export async function updateReferralConfig(
|
|
|
1069
1070
|
export async function updateActivityConfig(
|
|
1070
1071
|
connection: Connection,
|
|
1071
1072
|
wallet: Keypair,
|
|
1072
|
-
activityReward: number |
|
|
1073
|
-
referralActivityReward: number |
|
|
1073
|
+
activityReward: number | BN,
|
|
1074
|
+
referralActivityReward: number | BN,
|
|
1074
1075
|
options?: AgentRegistryOptions
|
|
1075
1076
|
): Promise<string> {
|
|
1076
1077
|
const program = createProgram(connection, wallet, options?.programId);
|
|
1077
|
-
const ar = typeof activityReward === "number" ? new
|
|
1078
|
-
const rar = typeof referralActivityReward === "number" ? new
|
|
1078
|
+
const ar = typeof activityReward === "number" ? new BN(activityReward) : activityReward;
|
|
1079
|
+
const rar = typeof referralActivityReward === "number" ? new BN(referralActivityReward) : referralActivityReward;
|
|
1079
1080
|
const ix = await program.methods
|
|
1080
1081
|
.updateActivityConfig(ar, rar)
|
|
1081
1082
|
.accounts({ admin: wallet.publicKey } as any)
|
|
@@ -1089,11 +1090,11 @@ export async function updateActivityConfig(
|
|
|
1089
1090
|
export async function expandConfig(
|
|
1090
1091
|
connection: Connection,
|
|
1091
1092
|
wallet: Keypair,
|
|
1092
|
-
extendSize: number |
|
|
1093
|
+
extendSize: number | BN,
|
|
1093
1094
|
options?: AgentRegistryOptions
|
|
1094
1095
|
): Promise<string> {
|
|
1095
1096
|
const program = createProgram(connection, wallet, options?.programId);
|
|
1096
|
-
const size = typeof extendSize === "number" ? new
|
|
1097
|
+
const size = typeof extendSize === "number" ? new BN(extendSize) : extendSize;
|
|
1097
1098
|
const ix = await program.methods
|
|
1098
1099
|
.expandConfig(size)
|
|
1099
1100
|
.accounts({ admin: wallet.publicKey } as any)
|
|
@@ -1127,15 +1128,15 @@ export async function updateTwitterVerifier(
|
|
|
1127
1128
|
export async function updateTwitterVerificationConfig(
|
|
1128
1129
|
connection: Connection,
|
|
1129
1130
|
wallet: Keypair,
|
|
1130
|
-
fee: number |
|
|
1131
|
-
reward: number |
|
|
1132
|
-
points: number |
|
|
1131
|
+
fee: number | BN,
|
|
1132
|
+
reward: number | BN,
|
|
1133
|
+
points: number | BN,
|
|
1133
1134
|
options?: AgentRegistryOptions
|
|
1134
1135
|
): Promise<string> {
|
|
1135
1136
|
const program = createProgram(connection, wallet, options?.programId);
|
|
1136
|
-
const f = typeof fee === "number" ? new
|
|
1137
|
-
const r = typeof reward === "number" ? new
|
|
1138
|
-
const p = typeof points === "number" ? new
|
|
1137
|
+
const f = typeof fee === "number" ? new BN(fee) : fee;
|
|
1138
|
+
const r = typeof reward === "number" ? new BN(reward) : reward;
|
|
1139
|
+
const p = typeof points === "number" ? new BN(points) : points;
|
|
1139
1140
|
const ix = await program.methods
|
|
1140
1141
|
.updateTwitterVerificationConfig(f, r, p)
|
|
1141
1142
|
.accounts({ admin: wallet.publicKey } as any)
|
|
@@ -1151,13 +1152,13 @@ export async function updateTwitterVerificationConfig(
|
|
|
1151
1152
|
export async function updateTweetVerifyConfig(
|
|
1152
1153
|
connection: Connection,
|
|
1153
1154
|
wallet: Keypair,
|
|
1154
|
-
reward: number |
|
|
1155
|
-
points: number |
|
|
1155
|
+
reward: number | BN,
|
|
1156
|
+
points: number | BN,
|
|
1156
1157
|
options?: AgentRegistryOptions
|
|
1157
1158
|
): Promise<string> {
|
|
1158
1159
|
const program = createProgram(connection, wallet, options?.programId);
|
|
1159
|
-
const r = typeof reward === "number" ? new
|
|
1160
|
-
const p = typeof points === "number" ? new
|
|
1160
|
+
const r = typeof reward === "number" ? new BN(reward) : reward;
|
|
1161
|
+
const p = typeof points === "number" ? new BN(points) : points;
|
|
1161
1162
|
const ix = await program.methods
|
|
1162
1163
|
.updateTweetVerifyConfig(r, p)
|
|
1163
1164
|
.accounts({ admin: wallet.publicKey } as any)
|
|
@@ -1171,11 +1172,11 @@ export async function updateTweetVerifyConfig(
|
|
|
1171
1172
|
export async function withdrawTwitterVerifyFees(
|
|
1172
1173
|
connection: Connection,
|
|
1173
1174
|
wallet: Keypair,
|
|
1174
|
-
amount: number |
|
|
1175
|
+
amount: number | BN,
|
|
1175
1176
|
options?: AgentRegistryOptions
|
|
1176
1177
|
): Promise<string> {
|
|
1177
1178
|
const program = createProgram(connection, wallet, options?.programId);
|
|
1178
|
-
const amt = typeof amount === "number" ? new
|
|
1179
|
+
const amt = typeof amount === "number" ? new BN(amount) : amount;
|
|
1179
1180
|
const ix = await program.methods
|
|
1180
1181
|
.withdrawTwitterVerifyFees(amt)
|
|
1181
1182
|
.accounts({ admin: wallet.publicKey } as any)
|
|
@@ -1367,7 +1368,7 @@ export async function submitTweet(
|
|
|
1367
1368
|
): Promise<string> {
|
|
1368
1369
|
const program = createProgram(connection, wallet, options?.programId);
|
|
1369
1370
|
const ix = await program.methods
|
|
1370
|
-
.submitTweet(agentId, new
|
|
1371
|
+
.submitTweet(agentId, new BN(tweetId.toString()))
|
|
1371
1372
|
.accounts({ authority: wallet.publicKey } as any)
|
|
1372
1373
|
.instruction();
|
|
1373
1374
|
return sendTx(connection, wallet, [ix]);
|
|
@@ -1484,7 +1485,7 @@ export async function approveTweet(
|
|
|
1484
1485
|
);
|
|
1485
1486
|
|
|
1486
1487
|
const ix = await program.methods
|
|
1487
|
-
.approveTweet(agentId, new
|
|
1488
|
+
.approveTweet(agentId, new BN(tweetId.toString()))
|
|
1488
1489
|
.accounts({
|
|
1489
1490
|
verifier: wallet.publicKey,
|
|
1490
1491
|
authority,
|