@agether/sdk 1.6.5 → 1.8.0

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/cli.js CHANGED
@@ -148,9 +148,9 @@ var init_config = __esm({
148
148
  morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb"
149
149
  },
150
150
  [8453 /* Base */]: {
151
- accountFactory: "0x871eb6b07964bc308bf68b18ca5824AFE5Cb0c8b",
152
- validationRegistry: "0x5a2FF014C68a2498554B5786ED92483E6d56D06f",
153
- agentReputation: "0x47adEA82a8975a60D81483CD39C377F905988DF1",
151
+ accountFactory: "0xb5b09213d0718f3FD56F1b111C8A83FDFcBdd5d8",
152
+ validationRegistry: "0x867F4F6f749Dc422aeFEcF4273cD22015d2CBCc2",
153
+ agentReputation: "0x352883c396bc7e88891a7D343ba550A7638256c0",
154
154
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
155
155
  identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
156
156
  morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb"
@@ -1117,8 +1117,28 @@ var init_X402Client = __esm({
1117
1117
  constructor(config) {
1118
1118
  this.config = config;
1119
1119
  const privateKey = config.privateKey.startsWith("0x") ? config.privateKey : `0x${config.privateKey}`;
1120
- const signer = (0, import_accounts.privateKeyToAccount)(privateKey);
1121
- this.address = signer.address;
1120
+ const eoaSigner = (0, import_accounts.privateKeyToAccount)(privateKey);
1121
+ let signer;
1122
+ if (config.accountAddress) {
1123
+ const accountAddr = config.accountAddress;
1124
+ signer = (0, import_accounts.toAccount)({
1125
+ address: accountAddr,
1126
+ async signMessage({ message }) {
1127
+ return eoaSigner.signMessage({ message });
1128
+ },
1129
+ async signTransaction(tx) {
1130
+ return eoaSigner.signTransaction(tx);
1131
+ },
1132
+ async signTypedData(typedData) {
1133
+ const sig = await eoaSigner.signTypedData(typedData);
1134
+ return `${sig}00`;
1135
+ }
1136
+ });
1137
+ this.address = accountAddr;
1138
+ } else {
1139
+ signer = eoaSigner;
1140
+ this.address = eoaSigner.address;
1141
+ }
1122
1142
  const client = new import_client.x402Client();
1123
1143
  (0, import_client2.registerExactEvmScheme)(client, { signer });
1124
1144
  this.paidFetch = (0, import_fetch.wrapFetchWithPayment)(fetch, client);
package/dist/index.js CHANGED
@@ -199,9 +199,9 @@ var CONTRACT_ADDRESSES = {
199
199
  morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb"
200
200
  },
201
201
  [8453 /* Base */]: {
202
- accountFactory: "0x871eb6b07964bc308bf68b18ca5824AFE5Cb0c8b",
203
- validationRegistry: "0x5a2FF014C68a2498554B5786ED92483E6d56D06f",
204
- agentReputation: "0x47adEA82a8975a60D81483CD39C377F905988DF1",
202
+ accountFactory: "0xb5b09213d0718f3FD56F1b111C8A83FDFcBdd5d8",
203
+ validationRegistry: "0x867F4F6f749Dc422aeFEcF4273cD22015d2CBCc2",
204
+ agentReputation: "0x352883c396bc7e88891a7D343ba550A7638256c0",
205
205
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
206
206
  identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
207
207
  morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb"
@@ -1345,8 +1345,28 @@ var X402Client = class {
1345
1345
  constructor(config) {
1346
1346
  this.config = config;
1347
1347
  const privateKey = config.privateKey.startsWith("0x") ? config.privateKey : `0x${config.privateKey}`;
1348
- const signer = (0, import_accounts.privateKeyToAccount)(privateKey);
1349
- this.address = signer.address;
1348
+ const eoaSigner = (0, import_accounts.privateKeyToAccount)(privateKey);
1349
+ let signer;
1350
+ if (config.accountAddress) {
1351
+ const accountAddr = config.accountAddress;
1352
+ signer = (0, import_accounts.toAccount)({
1353
+ address: accountAddr,
1354
+ async signMessage({ message }) {
1355
+ return eoaSigner.signMessage({ message });
1356
+ },
1357
+ async signTransaction(tx) {
1358
+ return eoaSigner.signTransaction(tx);
1359
+ },
1360
+ async signTypedData(typedData) {
1361
+ const sig = await eoaSigner.signTypedData(typedData);
1362
+ return `${sig}00`;
1363
+ }
1364
+ });
1365
+ this.address = accountAddr;
1366
+ } else {
1367
+ signer = eoaSigner;
1368
+ this.address = eoaSigner.address;
1369
+ }
1350
1370
  const client = new import_client.x402Client();
1351
1371
  (0, import_client2.registerExactEvmScheme)(client, { signer });
1352
1372
  this.paidFetch = (0, import_fetch.wrapFetchWithPayment)(fetch, client);
package/dist/index.mjs CHANGED
@@ -135,9 +135,9 @@ var CONTRACT_ADDRESSES = {
135
135
  morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb"
136
136
  },
137
137
  [8453 /* Base */]: {
138
- accountFactory: "0x871eb6b07964bc308bf68b18ca5824AFE5Cb0c8b",
139
- validationRegistry: "0x5a2FF014C68a2498554B5786ED92483E6d56D06f",
140
- agentReputation: "0x47adEA82a8975a60D81483CD39C377F905988DF1",
138
+ accountFactory: "0xb5b09213d0718f3FD56F1b111C8A83FDFcBdd5d8",
139
+ validationRegistry: "0x867F4F6f749Dc422aeFEcF4273cD22015d2CBCc2",
140
+ agentReputation: "0x352883c396bc7e88891a7D343ba550A7638256c0",
141
141
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
142
142
  identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
143
143
  morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb"
@@ -1276,13 +1276,33 @@ import axios2 from "axios";
1276
1276
  import { wrapFetchWithPayment } from "@x402/fetch";
1277
1277
  import { x402Client } from "@x402/core/client";
1278
1278
  import { registerExactEvmScheme } from "@x402/evm/exact/client";
1279
- import { privateKeyToAccount } from "viem/accounts";
1279
+ import { privateKeyToAccount, toAccount } from "viem/accounts";
1280
1280
  var X402Client = class {
1281
1281
  constructor(config) {
1282
1282
  this.config = config;
1283
1283
  const privateKey = config.privateKey.startsWith("0x") ? config.privateKey : `0x${config.privateKey}`;
1284
- const signer = privateKeyToAccount(privateKey);
1285
- this.address = signer.address;
1284
+ const eoaSigner = privateKeyToAccount(privateKey);
1285
+ let signer;
1286
+ if (config.accountAddress) {
1287
+ const accountAddr = config.accountAddress;
1288
+ signer = toAccount({
1289
+ address: accountAddr,
1290
+ async signMessage({ message }) {
1291
+ return eoaSigner.signMessage({ message });
1292
+ },
1293
+ async signTransaction(tx) {
1294
+ return eoaSigner.signTransaction(tx);
1295
+ },
1296
+ async signTypedData(typedData) {
1297
+ const sig = await eoaSigner.signTypedData(typedData);
1298
+ return `${sig}00`;
1299
+ }
1300
+ });
1301
+ this.address = accountAddr;
1302
+ } else {
1303
+ signer = eoaSigner;
1304
+ this.address = eoaSigner.address;
1305
+ }
1286
1306
  const client = new x402Client();
1287
1307
  registerExactEvmScheme(client, { signer });
1288
1308
  this.paidFetch = wrapFetchWithPayment(fetch, client);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agether/sdk",
3
- "version": "1.6.5",
3
+ "version": "1.8.0",
4
4
  "description": "TypeScript SDK for Agether - autonomous credit for AI agents on Base",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",