@exagent/sdk 0.1.0 → 0.1.1

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/index.d.mts CHANGED
@@ -2164,6 +2164,12 @@ declare class ExagentClient {
2164
2164
  * Get the agent's wallet address
2165
2165
  */
2166
2166
  get address(): Address;
2167
+ /**
2168
+ * Sign a message with the wallet's private key (EIP-191 personal sign)
2169
+ * @param message The message to sign
2170
+ * @returns The signature
2171
+ */
2172
+ signMessage(message: string): Promise<`0x${string}`>;
2167
2173
  private uploadMetadata;
2168
2174
  private signIntent;
2169
2175
  private parseAgentIdFromReceipt;
package/dist/index.d.ts CHANGED
@@ -2164,6 +2164,12 @@ declare class ExagentClient {
2164
2164
  * Get the agent's wallet address
2165
2165
  */
2166
2166
  get address(): Address;
2167
+ /**
2168
+ * Sign a message with the wallet's private key (EIP-191 personal sign)
2169
+ * @param message The message to sign
2170
+ * @returns The signature
2171
+ */
2172
+ signMessage(message: string): Promise<`0x${string}`>;
2167
2173
  private uploadMetadata;
2168
2174
  private signIntent;
2169
2175
  private parseAgentIdFromReceipt;
package/dist/index.js CHANGED
@@ -1847,12 +1847,21 @@ var EXAGENT_API_CONFIG = {
1847
1847
  mainnet: "https://api.exagent.io",
1848
1848
  testnet: "https://api.testnet.exagent.io"
1849
1849
  };
1850
+ var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
1851
+ function validateContractAddresses(network) {
1852
+ const addresses = CONTRACT_ADDRESSES[network];
1853
+ const zeroEntries = Object.entries(addresses).filter(([, addr]) => addr === ZERO_ADDRESS);
1854
+ if (network === "mainnet" && zeroEntries.length > 0) {
1855
+ const missing = zeroEntries.map(([name]) => name).join(", ");
1856
+ throw new Error(
1857
+ `Mainnet contracts not yet deployed. Missing addresses: ${missing}. Deploy contracts before using the SDK on mainnet.`
1858
+ );
1859
+ }
1860
+ }
1850
1861
 
1851
1862
  // src/client.ts
1852
1863
  var ExagentClient = class {
1853
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1854
1864
  publicClient;
1855
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1856
1865
  walletClient;
1857
1866
  account;
1858
1867
  network;
@@ -1865,6 +1874,7 @@ var ExagentClient = class {
1865
1874
  constructor(config) {
1866
1875
  this.network = config.network ?? "testnet";
1867
1876
  this.apiKey = config.apiKey;
1877
+ validateContractAddresses(this.network);
1868
1878
  const chain = CHAIN_CONFIG[this.network];
1869
1879
  this.publicClient = (0, import_viem.createPublicClient)({
1870
1880
  chain,
@@ -2427,6 +2437,14 @@ var ExagentClient = class {
2427
2437
  get address() {
2428
2438
  return this.account.address;
2429
2439
  }
2440
+ /**
2441
+ * Sign a message with the wallet's private key (EIP-191 personal sign)
2442
+ * @param message The message to sign
2443
+ * @returns The signature
2444
+ */
2445
+ async signMessage(message) {
2446
+ return this.walletClient.signMessage({ account: this.account, message });
2447
+ }
2430
2448
  async uploadMetadata(metadata) {
2431
2449
  const apiUrl = EXAGENT_API_CONFIG[this.network];
2432
2450
  const response = await fetch(`${apiUrl}/v1/metadata/upload`, {
package/dist/index.mjs CHANGED
@@ -1819,12 +1819,21 @@ var EXAGENT_API_CONFIG = {
1819
1819
  mainnet: "https://api.exagent.io",
1820
1820
  testnet: "https://api.testnet.exagent.io"
1821
1821
  };
1822
+ var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
1823
+ function validateContractAddresses(network) {
1824
+ const addresses = CONTRACT_ADDRESSES[network];
1825
+ const zeroEntries = Object.entries(addresses).filter(([, addr]) => addr === ZERO_ADDRESS);
1826
+ if (network === "mainnet" && zeroEntries.length > 0) {
1827
+ const missing = zeroEntries.map(([name]) => name).join(", ");
1828
+ throw new Error(
1829
+ `Mainnet contracts not yet deployed. Missing addresses: ${missing}. Deploy contracts before using the SDK on mainnet.`
1830
+ );
1831
+ }
1832
+ }
1822
1833
 
1823
1834
  // src/client.ts
1824
1835
  var ExagentClient = class {
1825
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1826
1836
  publicClient;
1827
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1828
1837
  walletClient;
1829
1838
  account;
1830
1839
  network;
@@ -1837,6 +1846,7 @@ var ExagentClient = class {
1837
1846
  constructor(config) {
1838
1847
  this.network = config.network ?? "testnet";
1839
1848
  this.apiKey = config.apiKey;
1849
+ validateContractAddresses(this.network);
1840
1850
  const chain = CHAIN_CONFIG[this.network];
1841
1851
  this.publicClient = createPublicClient({
1842
1852
  chain,
@@ -2399,6 +2409,14 @@ var ExagentClient = class {
2399
2409
  get address() {
2400
2410
  return this.account.address;
2401
2411
  }
2412
+ /**
2413
+ * Sign a message with the wallet's private key (EIP-191 personal sign)
2414
+ * @param message The message to sign
2415
+ * @returns The signature
2416
+ */
2417
+ async signMessage(message) {
2418
+ return this.walletClient.signMessage({ account: this.account, message });
2419
+ }
2402
2420
  async uploadMetadata(metadata) {
2403
2421
  const apiUrl = EXAGENT_API_CONFIG[this.network];
2404
2422
  const response = await fetch(`${apiUrl}/v1/metadata/upload`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exagent/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "TypeScript SDK for Exagent",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",