@clawnch/clawncher-sdk 0.1.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.
Files changed (98) hide show
  1. package/README.md +603 -0
  2. package/dist/abis.d.ts +935 -0
  3. package/dist/abis.d.ts.map +1 -0
  4. package/dist/abis.js +486 -0
  5. package/dist/abis.js.map +1 -0
  6. package/dist/addresses.d.ts +51 -0
  7. package/dist/addresses.d.ts.map +1 -0
  8. package/dist/addresses.js +80 -0
  9. package/dist/addresses.js.map +1 -0
  10. package/dist/api-deployer-types.d.ts +165 -0
  11. package/dist/api-deployer-types.d.ts.map +1 -0
  12. package/dist/api-deployer-types.js +9 -0
  13. package/dist/api-deployer-types.js.map +1 -0
  14. package/dist/api-deployer.d.ts +114 -0
  15. package/dist/api-deployer.d.ts.map +1 -0
  16. package/dist/api-deployer.js +309 -0
  17. package/dist/api-deployer.js.map +1 -0
  18. package/dist/claimer.d.ts +197 -0
  19. package/dist/claimer.d.ts.map +1 -0
  20. package/dist/claimer.js +311 -0
  21. package/dist/claimer.js.map +1 -0
  22. package/dist/deployer.d.ts +229 -0
  23. package/dist/deployer.d.ts.map +1 -0
  24. package/dist/deployer.js +305 -0
  25. package/dist/deployer.js.map +1 -0
  26. package/dist/erc8004-types.d.ts +94 -0
  27. package/dist/erc8004-types.d.ts.map +1 -0
  28. package/dist/erc8004-types.js +8 -0
  29. package/dist/erc8004-types.js.map +1 -0
  30. package/dist/errors.d.ts +62 -0
  31. package/dist/errors.d.ts.map +1 -0
  32. package/dist/errors.js +75 -0
  33. package/dist/errors.js.map +1 -0
  34. package/dist/index.d.ts +204 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +358 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/liquidity-types.d.ts +198 -0
  39. package/dist/liquidity-types.d.ts.map +1 -0
  40. package/dist/liquidity-types.js +8 -0
  41. package/dist/liquidity-types.js.map +1 -0
  42. package/dist/liquidity.d.ts +111 -0
  43. package/dist/liquidity.d.ts.map +1 -0
  44. package/dist/liquidity.js +608 -0
  45. package/dist/liquidity.js.map +1 -0
  46. package/dist/molten-types.d.ts +282 -0
  47. package/dist/molten-types.d.ts.map +1 -0
  48. package/dist/molten-types.js +8 -0
  49. package/dist/molten-types.js.map +1 -0
  50. package/dist/molten.d.ts +336 -0
  51. package/dist/molten.d.ts.map +1 -0
  52. package/dist/molten.js +560 -0
  53. package/dist/molten.js.map +1 -0
  54. package/dist/portfolio.d.ts +129 -0
  55. package/dist/portfolio.d.ts.map +1 -0
  56. package/dist/portfolio.js +218 -0
  57. package/dist/portfolio.js.map +1 -0
  58. package/dist/reader.d.ts +249 -0
  59. package/dist/reader.d.ts.map +1 -0
  60. package/dist/reader.js +488 -0
  61. package/dist/reader.js.map +1 -0
  62. package/dist/swap-types.d.ts +159 -0
  63. package/dist/swap-types.d.ts.map +1 -0
  64. package/dist/swap-types.js +22 -0
  65. package/dist/swap-types.js.map +1 -0
  66. package/dist/swap.d.ts +762 -0
  67. package/dist/swap.d.ts.map +1 -0
  68. package/dist/swap.js +345 -0
  69. package/dist/swap.js.map +1 -0
  70. package/dist/token-verification-data.d.ts +4 -0
  71. package/dist/token-verification-data.d.ts.map +1 -0
  72. package/dist/token-verification-data.js +6 -0
  73. package/dist/token-verification-data.js.map +1 -0
  74. package/dist/types.d.ts +244 -0
  75. package/dist/types.d.ts.map +1 -0
  76. package/dist/types.js +5 -0
  77. package/dist/types.js.map +1 -0
  78. package/dist/uniswap-abis.d.ts +470 -0
  79. package/dist/uniswap-abis.d.ts.map +1 -0
  80. package/dist/uniswap-abis.js +322 -0
  81. package/dist/uniswap-abis.js.map +1 -0
  82. package/dist/uniswap-addresses.d.ts +38 -0
  83. package/dist/uniswap-addresses.d.ts.map +1 -0
  84. package/dist/uniswap-addresses.js +67 -0
  85. package/dist/uniswap-addresses.js.map +1 -0
  86. package/dist/vanity.d.ts +115 -0
  87. package/dist/vanity.d.ts.map +1 -0
  88. package/dist/vanity.js +166 -0
  89. package/dist/vanity.js.map +1 -0
  90. package/dist/verify.d.ts +88 -0
  91. package/dist/verify.d.ts.map +1 -0
  92. package/dist/verify.js +181 -0
  93. package/dist/verify.js.map +1 -0
  94. package/dist/watcher.d.ts +112 -0
  95. package/dist/watcher.d.ts.map +1 -0
  96. package/dist/watcher.js +132 -0
  97. package/dist/watcher.js.map +1 -0
  98. package/package.json +59 -0
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Types for ClawnchApiDeployer — verified agent launches via Clawnch API
3
+ *
4
+ * Defines the contract between the Clawncher SDK and the Clawnch API
5
+ * server for agent registration, challenge-response verification,
6
+ * and verified token deployment.
7
+ */
8
+ import type { Address, Hash, Hex, WalletClient, PublicClient, Chain, Account, Transport } from 'viem';
9
+ import type { NetworkName } from './addresses.js';
10
+ export interface ApiDeployerConfig {
11
+ /** API key issued during agent verification */
12
+ apiKey: string;
13
+ /** Wallet client for signing captcha challenges */
14
+ wallet: WalletClient<Transport, Chain, Account>;
15
+ /** Public client for reading on-chain challenge data */
16
+ publicClient: PublicClient;
17
+ /** Network: 'mainnet' (Base) or 'sepolia' (Base Sepolia) */
18
+ network?: NetworkName;
19
+ /** Clawnch API base URL (default: https://clawn.ch) */
20
+ apiBaseUrl?: string;
21
+ }
22
+ export interface RegisterConfig {
23
+ /** Wallet client for signing the registration challenge */
24
+ wallet: WalletClient<Transport, Chain, Account>;
25
+ /** Public client for reading chain state */
26
+ publicClient: PublicClient;
27
+ /** Clawnch API base URL (default: https://clawn.ch) */
28
+ apiBaseUrl?: string;
29
+ }
30
+ export interface RegisterRequest {
31
+ /** Agent display name */
32
+ name: string;
33
+ /** Agent wallet address (will sign challenges from this wallet) */
34
+ wallet: Address;
35
+ /** Short description of the agent */
36
+ description: string;
37
+ }
38
+ export interface RegisterResponse {
39
+ /** Registration ID (use in verify step) */
40
+ registrationId: string;
41
+ /** Challenge nonce to sign */
42
+ challenge: string;
43
+ /** Message to sign with wallet */
44
+ message: string;
45
+ }
46
+ export interface VerifyRequest {
47
+ /** Registration ID from register step */
48
+ registrationId: string;
49
+ /** ECDSA signature of the challenge message */
50
+ signature: Hex;
51
+ }
52
+ export interface VerifyResponse {
53
+ /** API key for authenticated requests */
54
+ apiKey: string;
55
+ /** Agent ID */
56
+ agentId: string;
57
+ /** Wallet address that was verified */
58
+ wallet: Address;
59
+ }
60
+ export interface AgentStatus {
61
+ /** Agent ID */
62
+ agentId: string;
63
+ /** Agent display name */
64
+ name: string;
65
+ /** Verified wallet address */
66
+ wallet: Address;
67
+ /** Whether agent is verified */
68
+ verified: boolean;
69
+ /** $CLAWNCH token allowance remaining */
70
+ clawnchAllowance: string;
71
+ /** $CLAWNCH token balance */
72
+ clawnchBalance: string;
73
+ /** Number of tokens deployed via API */
74
+ launchCount: number;
75
+ /** Registration timestamp */
76
+ registeredAt: string;
77
+ }
78
+ export interface CaptchaChallenge {
79
+ /** Unique challenge ID */
80
+ challengeId: string;
81
+ /** Random message to hash and sign */
82
+ message: string;
83
+ /** Random nonce */
84
+ nonce: string;
85
+ /** Contract address to read storage from */
86
+ contractAddress: Address;
87
+ /** Storage slot to read */
88
+ storageSlot: Hex;
89
+ /** Challenge deadline (ISO 8601 timestamp, 5 seconds from issue) */
90
+ deadline: string;
91
+ }
92
+ export interface CaptchaSolution {
93
+ /** Challenge ID from the challenge */
94
+ challengeId: string;
95
+ /** ECDSA signature of the message hash */
96
+ signature: Hex;
97
+ /** On-chain storage value read from the specified slot */
98
+ storageValue: Hex;
99
+ /** Final proof: keccak256(signature + nonce + storageValue) */
100
+ proof: Hex;
101
+ }
102
+ export interface ApiDeployRequest {
103
+ /** Token name */
104
+ name: string;
105
+ /** Token symbol (ticker) */
106
+ symbol: string;
107
+ /** Token image URL */
108
+ image?: string;
109
+ /** Token description */
110
+ description?: string;
111
+ /** Reward recipients configuration */
112
+ rewards?: {
113
+ recipients: Array<{
114
+ recipient: Address;
115
+ admin: Address;
116
+ bps: number;
117
+ feePreference?: 'Clawnch' | 'Paired' | 'Both';
118
+ }>;
119
+ };
120
+ /** Vault configuration */
121
+ vault?: {
122
+ percentage: number;
123
+ lockupDuration: number;
124
+ vestingDuration?: number;
125
+ recipient: Address;
126
+ };
127
+ /** Dev buy configuration */
128
+ devBuy?: {
129
+ ethAmount: string;
130
+ recipient: Address;
131
+ };
132
+ /** Enable vanity address (default: true) */
133
+ vanity?: boolean;
134
+ }
135
+ export interface ApiDeployResponse {
136
+ /** Whether deploy was successful */
137
+ success: boolean;
138
+ /** Transaction hash of the deployment */
139
+ txHash: Hash;
140
+ /** Deployed token contract address */
141
+ tokenAddress: Address;
142
+ /** $CLAWNCH amount burned for this launch */
143
+ clawnchBurned: string;
144
+ /** Deployer address (Clawnch deployer wallet) */
145
+ deployedFrom: Address;
146
+ /** Agent ID that initiated the deploy */
147
+ agentId: string;
148
+ }
149
+ export interface ApprovalResult {
150
+ /** Transaction hash of the approval */
151
+ txHash: Hash;
152
+ /** Spender address (Clawnch deployer) */
153
+ spender: Address;
154
+ /** Amount approved */
155
+ amount: string;
156
+ }
157
+ export interface ApiErrorResponse {
158
+ /** Error message */
159
+ error: string;
160
+ /** Error code for programmatic handling */
161
+ code?: string;
162
+ /** Additional error details */
163
+ details?: Record<string, unknown>;
164
+ }
165
+ //# sourceMappingURL=api-deployer-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-deployer-types.d.ts","sourceRoot":"","sources":["../src/api-deployer-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,OAAO,EACP,IAAI,EACJ,GAAG,EACH,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,OAAO,EACP,SAAS,EACV,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMlD,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,MAAM,EAAE,YAAY,CAAC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B,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,SAAS,EAAE,OAAO,CAAC;KACpB,CAAC;IACF,4BAA4B;IAC5B,MAAM,CAAC,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,OAAO,CAAC;KACpB,CAAC;IACF,4CAA4C;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,MAAM,EAAE,IAAI,CAAC;IACb,sCAAsC;IACtC,YAAY,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,YAAY,EAAE,OAAO,CAAC;IACtB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,MAAM,EAAE,IAAI,CAAC;IACb,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,MAAM,WAAW,gBAAgB;IAC/B,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Types for ClawnchApiDeployer — verified agent launches via Clawnch API
3
+ *
4
+ * Defines the contract between the Clawncher SDK and the Clawnch API
5
+ * server for agent registration, challenge-response verification,
6
+ * and verified token deployment.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=api-deployer-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-deployer-types.js","sourceRoot":"","sources":["../src/api-deployer-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * ClawnchApiDeployer — Verified agent token deployment via Clawnch API
3
+ *
4
+ * Deploys tokens through the Clawnch API using the Clawnch deployer wallet.
5
+ * Tokens deployed this way receive a verified badge on the Clawnch launchpad.
6
+ *
7
+ * Flow for each deploy:
8
+ * 1. Request captcha challenge from API
9
+ * 2. Solve challenge: read on-chain storage, sign message, compute proof
10
+ * 3. Submit solution + deploy params → server burns $CLAWNCH → deploys token
11
+ *
12
+ * Requires prior agent registration and $CLAWNCH token approval.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * // One-time registration
17
+ * const { apiKey } = await ClawnchApiDeployer.register({
18
+ * wallet,
19
+ * publicClient,
20
+ * }, {
21
+ * name: 'MyAgent',
22
+ * wallet: account.address,
23
+ * description: 'An AI agent that launches tokens',
24
+ * });
25
+ *
26
+ * // Create deployer with API key
27
+ * const deployer = new ClawnchApiDeployer({
28
+ * apiKey,
29
+ * wallet,
30
+ * publicClient,
31
+ * });
32
+ *
33
+ * // One-time $CLAWNCH approval
34
+ * await deployer.approveClawnch();
35
+ *
36
+ * // Deploy a token
37
+ * const result = await deployer.deploy({
38
+ * name: 'My Token',
39
+ * symbol: 'MYTKN',
40
+ * });
41
+ * console.log('Token deployed:', result.tokenAddress);
42
+ * ```
43
+ */
44
+ import { type Address } from 'viem';
45
+ import type { ApiDeployerConfig, RegisterConfig, RegisterRequest, VerifyResponse, AgentStatus, CaptchaChallenge, CaptchaSolution, ApiDeployRequest, ApiDeployResponse, ApprovalResult } from './api-deployer-types.js';
46
+ export declare class ClawnchApiDeployer {
47
+ private readonly apiKey;
48
+ private readonly wallet;
49
+ private readonly publicClient;
50
+ private readonly apiBaseUrl;
51
+ constructor(config: ApiDeployerConfig);
52
+ /**
53
+ * Register a new agent with the Clawnch API.
54
+ *
55
+ * Two-step process:
56
+ * 1. POST /api/agents/register — submits agent info, receives challenge
57
+ * 2. POST /api/agents/verify — submits wallet signature, receives API key
58
+ *
59
+ * @returns VerifyResponse containing the API key
60
+ */
61
+ static register(config: RegisterConfig, request: RegisterRequest): Promise<VerifyResponse>;
62
+ /**
63
+ * Get the current agent status (verification, balance, launch count)
64
+ */
65
+ getStatus(): Promise<AgentStatus>;
66
+ /**
67
+ * Approve the Clawnch deployer to spend $CLAWNCH from the agent's wallet.
68
+ *
69
+ * This is a one-time operation. The approval is set to max uint256 so
70
+ * the agent doesn't need to re-approve before each launch.
71
+ *
72
+ * @param spender - The Clawnch deployer address (fetched from API if not provided)
73
+ * @returns ApprovalResult with transaction hash
74
+ */
75
+ approveClawnch(spender?: Address): Promise<ApprovalResult>;
76
+ /**
77
+ * Check the current $CLAWNCH allowance for the Clawnch deployer
78
+ */
79
+ getClawnchAllowance(spender: Address): Promise<bigint>;
80
+ /**
81
+ * Check the agent's $CLAWNCH balance
82
+ */
83
+ getClawnchBalance(): Promise<bigint>;
84
+ /**
85
+ * Deploy a token via the Clawnch API (verified launch).
86
+ *
87
+ * Internally handles the full flow:
88
+ * 1. Request captcha challenge
89
+ * 2. Solve: read storage slot, sign message, compute keccak proof
90
+ * 3. Submit solution + deploy params
91
+ * 4. Server burns $CLAWNCH from agent → deploys from Clawnch wallet
92
+ *
93
+ * @param request - Token deployment parameters
94
+ * @returns ApiDeployResponse with txHash and tokenAddress
95
+ */
96
+ deploy(request: ApiDeployRequest): Promise<ApiDeployResponse>;
97
+ /**
98
+ * Solve a cryptographic captcha challenge.
99
+ *
100
+ * Steps:
101
+ * 1. Read the on-chain storage slot specified in the challenge
102
+ * 2. Hash the challenge message with keccak256
103
+ * 3. Sign the hash with the agent's wallet (ECDSA)
104
+ * 4. Compute proof: keccak256(signature + nonce + storageValue)
105
+ *
106
+ * All must complete within the 5-second deadline.
107
+ */
108
+ solveCaptcha(challenge: CaptchaChallenge): Promise<CaptchaSolution>;
109
+ /**
110
+ * Make an authenticated API request to the Clawnch server
111
+ */
112
+ private apiRequest;
113
+ }
114
+ //# sourceMapping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AAU;CAiDzB"}
@@ -0,0 +1,309 @@
1
+ /**
2
+ * ClawnchApiDeployer — Verified agent token deployment via Clawnch API
3
+ *
4
+ * Deploys tokens through the Clawnch API using the Clawnch deployer wallet.
5
+ * Tokens deployed this way receive a verified badge on the Clawnch launchpad.
6
+ *
7
+ * Flow for each deploy:
8
+ * 1. Request captcha challenge from API
9
+ * 2. Solve challenge: read on-chain storage, sign message, compute proof
10
+ * 3. Submit solution + deploy params → server burns $CLAWNCH → deploys token
11
+ *
12
+ * Requires prior agent registration and $CLAWNCH token approval.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * // One-time registration
17
+ * const { apiKey } = await ClawnchApiDeployer.register({
18
+ * wallet,
19
+ * publicClient,
20
+ * }, {
21
+ * name: 'MyAgent',
22
+ * wallet: account.address,
23
+ * description: 'An AI agent that launches tokens',
24
+ * });
25
+ *
26
+ * // Create deployer with API key
27
+ * const deployer = new ClawnchApiDeployer({
28
+ * apiKey,
29
+ * wallet,
30
+ * publicClient,
31
+ * });
32
+ *
33
+ * // One-time $CLAWNCH approval
34
+ * await deployer.approveClawnch();
35
+ *
36
+ * // Deploy a token
37
+ * const result = await deployer.deploy({
38
+ * name: 'My Token',
39
+ * symbol: 'MYTKN',
40
+ * });
41
+ * console.log('Token deployed:', result.tokenAddress);
42
+ * ```
43
+ */
44
+ import { keccak256, encodePacked, getAddress, maxUint256, parseAbi, } from 'viem';
45
+ import { ClawnchErrorCode, ClawnchDeployError } from './errors.js';
46
+ /** Default Clawnch API base URL */
47
+ const DEFAULT_API_BASE = 'https://clawn.ch';
48
+ /** $CLAWNCH token address on Base mainnet */
49
+ const CLAWNCH_TOKEN_ADDRESS = '0xa1F72459dfA10BAD200Ac160eCd78C6b77a747be';
50
+ /** Minimal ERC20 ABI for approve + allowance */
51
+ const ERC20_ABI = parseAbi([
52
+ 'function approve(address spender, uint256 amount) returns (bool)',
53
+ 'function allowance(address owner, address spender) view returns (uint256)',
54
+ 'function balanceOf(address account) view returns (uint256)',
55
+ ]);
56
+ export class ClawnchApiDeployer {
57
+ apiKey;
58
+ wallet;
59
+ publicClient;
60
+ apiBaseUrl;
61
+ constructor(config) {
62
+ if (!config.apiKey) {
63
+ throw new ClawnchDeployError(ClawnchErrorCode.WALLET_NOT_CONFIGURED, 'API key is required. Register an agent first with ClawnchApiDeployer.register()');
64
+ }
65
+ if (!config.wallet) {
66
+ throw new ClawnchDeployError(ClawnchErrorCode.WALLET_NOT_CONFIGURED, 'Wallet client is required for signing captcha challenges');
67
+ }
68
+ if (!config.publicClient) {
69
+ throw new ClawnchDeployError(ClawnchErrorCode.PUBLIC_CLIENT_NOT_CONFIGURED, 'Public client is required for reading on-chain challenge data');
70
+ }
71
+ this.apiKey = config.apiKey;
72
+ this.wallet = config.wallet;
73
+ this.publicClient = config.publicClient;
74
+ this.apiBaseUrl = (config.apiBaseUrl ?? DEFAULT_API_BASE).replace(/\/$/, '');
75
+ }
76
+ // ==========================================================================
77
+ // Static: Agent Registration
78
+ // ==========================================================================
79
+ /**
80
+ * Register a new agent with the Clawnch API.
81
+ *
82
+ * Two-step process:
83
+ * 1. POST /api/agents/register — submits agent info, receives challenge
84
+ * 2. POST /api/agents/verify — submits wallet signature, receives API key
85
+ *
86
+ * @returns VerifyResponse containing the API key
87
+ */
88
+ static async register(config, request) {
89
+ const baseUrl = (config.apiBaseUrl ?? DEFAULT_API_BASE).replace(/\/$/, '');
90
+ // Step 1: Register — get challenge
91
+ const registerRes = await fetch(`${baseUrl}/api/agents/register`, {
92
+ method: 'POST',
93
+ headers: { 'Content-Type': 'application/json' },
94
+ body: JSON.stringify(request),
95
+ });
96
+ if (!registerRes.ok) {
97
+ const err = await registerRes.json().catch(() => ({ error: 'Registration failed' }));
98
+ throw new ClawnchDeployError(ClawnchErrorCode.DEPLOY_FAILED, `Agent registration failed: ${err.error}`);
99
+ }
100
+ const registerData = await registerRes.json();
101
+ // Step 2: Sign the challenge message with wallet
102
+ const signature = await config.wallet.signMessage({
103
+ message: registerData.message,
104
+ });
105
+ // Step 3: Verify — submit signature, receive API key
106
+ const verifyBody = {
107
+ registrationId: registerData.registrationId,
108
+ signature,
109
+ };
110
+ const verifyRes = await fetch(`${baseUrl}/api/agents/verify`, {
111
+ method: 'POST',
112
+ headers: { 'Content-Type': 'application/json' },
113
+ body: JSON.stringify(verifyBody),
114
+ });
115
+ if (!verifyRes.ok) {
116
+ const err = await verifyRes.json().catch(() => ({ error: 'Verification failed' }));
117
+ throw new ClawnchDeployError(ClawnchErrorCode.DEPLOY_FAILED, `Agent verification failed: ${err.error}`);
118
+ }
119
+ return verifyRes.json();
120
+ }
121
+ // ==========================================================================
122
+ // Agent Status
123
+ // ==========================================================================
124
+ /**
125
+ * Get the current agent status (verification, balance, launch count)
126
+ */
127
+ async getStatus() {
128
+ return this.apiRequest('GET', '/api/agents/me');
129
+ }
130
+ // ==========================================================================
131
+ // $CLAWNCH Token Approval
132
+ // ==========================================================================
133
+ /**
134
+ * Approve the Clawnch deployer to spend $CLAWNCH from the agent's wallet.
135
+ *
136
+ * This is a one-time operation. The approval is set to max uint256 so
137
+ * the agent doesn't need to re-approve before each launch.
138
+ *
139
+ * @param spender - The Clawnch deployer address (fetched from API if not provided)
140
+ * @returns ApprovalResult with transaction hash
141
+ */
142
+ async approveClawnch(spender) {
143
+ // Get the deployer address from the API if not provided
144
+ let deployerAddress = spender;
145
+ if (!deployerAddress) {
146
+ const status = await this.getStatus();
147
+ // The API should return the deployer address, but fallback to a fetch
148
+ const configRes = await this.apiRequest('GET', '/api/agents/config');
149
+ deployerAddress = configRes.deployerAddress;
150
+ }
151
+ const txHash = await this.wallet.writeContract({
152
+ address: CLAWNCH_TOKEN_ADDRESS,
153
+ abi: ERC20_ABI,
154
+ functionName: 'approve',
155
+ args: [deployerAddress, maxUint256],
156
+ });
157
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });
158
+ if (receipt.status === 'reverted') {
159
+ throw new ClawnchDeployError(ClawnchErrorCode.TX_REVERTED, 'Approval transaction reverted');
160
+ }
161
+ return {
162
+ txHash,
163
+ spender: deployerAddress,
164
+ amount: maxUint256.toString(),
165
+ };
166
+ }
167
+ /**
168
+ * Check the current $CLAWNCH allowance for the Clawnch deployer
169
+ */
170
+ async getClawnchAllowance(spender) {
171
+ const owner = this.wallet.account.address;
172
+ return this.publicClient.readContract({
173
+ address: CLAWNCH_TOKEN_ADDRESS,
174
+ abi: ERC20_ABI,
175
+ functionName: 'allowance',
176
+ args: [owner, spender],
177
+ });
178
+ }
179
+ /**
180
+ * Check the agent's $CLAWNCH balance
181
+ */
182
+ async getClawnchBalance() {
183
+ const owner = this.wallet.account.address;
184
+ return this.publicClient.readContract({
185
+ address: CLAWNCH_TOKEN_ADDRESS,
186
+ abi: ERC20_ABI,
187
+ functionName: 'balanceOf',
188
+ args: [owner],
189
+ });
190
+ }
191
+ // ==========================================================================
192
+ // Verified Deploy
193
+ // ==========================================================================
194
+ /**
195
+ * Deploy a token via the Clawnch API (verified launch).
196
+ *
197
+ * Internally handles the full flow:
198
+ * 1. Request captcha challenge
199
+ * 2. Solve: read storage slot, sign message, compute keccak proof
200
+ * 3. Submit solution + deploy params
201
+ * 4. Server burns $CLAWNCH from agent → deploys from Clawnch wallet
202
+ *
203
+ * @param request - Token deployment parameters
204
+ * @returns ApiDeployResponse with txHash and tokenAddress
205
+ */
206
+ async deploy(request) {
207
+ // Step 1: Request captcha challenge
208
+ const challenge = await this.apiRequest('POST', '/api/deploy', { tokenParams: request });
209
+ // Step 2: Solve the captcha
210
+ const solution = await this.solveCaptcha(challenge);
211
+ // Step 3: Submit solution → server burns $CLAWNCH and deploys
212
+ const result = await this.apiRequest('POST', '/api/deploy/confirm', {
213
+ challengeId: challenge.challengeId,
214
+ solution,
215
+ tokenParams: request,
216
+ });
217
+ return result;
218
+ }
219
+ // ==========================================================================
220
+ // Captcha Solving (Internal)
221
+ // ==========================================================================
222
+ /**
223
+ * Solve a cryptographic captcha challenge.
224
+ *
225
+ * Steps:
226
+ * 1. Read the on-chain storage slot specified in the challenge
227
+ * 2. Hash the challenge message with keccak256
228
+ * 3. Sign the hash with the agent's wallet (ECDSA)
229
+ * 4. Compute proof: keccak256(signature + nonce + storageValue)
230
+ *
231
+ * All must complete within the 5-second deadline.
232
+ */
233
+ async solveCaptcha(challenge) {
234
+ // Check deadline hasn't passed
235
+ const deadline = new Date(challenge.deadline);
236
+ if (Date.now() > deadline.getTime()) {
237
+ throw new ClawnchDeployError(ClawnchErrorCode.TIMEOUT, 'Captcha challenge has expired');
238
+ }
239
+ // Step 1: Read on-chain storage slot
240
+ const storageValue = await this.publicClient.getStorageAt({
241
+ address: getAddress(challenge.contractAddress),
242
+ slot: challenge.storageSlot,
243
+ });
244
+ if (!storageValue) {
245
+ throw new ClawnchDeployError(ClawnchErrorCode.RPC_ERROR, 'Failed to read on-chain storage slot for captcha');
246
+ }
247
+ // Step 2: Sign the challenge message
248
+ const signature = await this.wallet.signMessage({
249
+ message: challenge.message,
250
+ });
251
+ // Step 3: Compute proof = keccak256(signature + nonce + storageValue)
252
+ const proof = keccak256(encodePacked(['bytes', 'string', 'bytes32'], [signature, challenge.nonce, storageValue]));
253
+ // Check deadline again after computation
254
+ if (Date.now() > deadline.getTime()) {
255
+ throw new ClawnchDeployError(ClawnchErrorCode.TIMEOUT, 'Captcha solution exceeded the 5-second deadline');
256
+ }
257
+ return {
258
+ challengeId: challenge.challengeId,
259
+ signature: signature,
260
+ storageValue,
261
+ proof,
262
+ };
263
+ }
264
+ // ==========================================================================
265
+ // HTTP Client
266
+ // ==========================================================================
267
+ /**
268
+ * Make an authenticated API request to the Clawnch server
269
+ */
270
+ async apiRequest(method, path, body) {
271
+ const url = `${this.apiBaseUrl}${path}`;
272
+ const headers = {
273
+ 'Accept': 'application/json',
274
+ 'Authorization': `Bearer ${this.apiKey}`,
275
+ };
276
+ const options = { method, headers };
277
+ if (body && method === 'POST') {
278
+ headers['Content-Type'] = 'application/json';
279
+ options.body = JSON.stringify(body);
280
+ }
281
+ const response = await fetch(url, {
282
+ ...options,
283
+ signal: AbortSignal.timeout(30000),
284
+ });
285
+ if (!response.ok) {
286
+ let errorMsg;
287
+ let errorCode;
288
+ try {
289
+ const errBody = await response.json();
290
+ errorMsg = errBody.error || `HTTP ${response.status}`;
291
+ errorCode = errBody.code;
292
+ }
293
+ catch {
294
+ errorMsg = `HTTP ${response.status}: ${response.statusText}`;
295
+ }
296
+ // Map known HTTP codes to SDK error codes
297
+ const sdkCode = response.status === 401 || response.status === 403
298
+ ? ClawnchErrorCode.WALLET_NOT_CONFIGURED
299
+ : response.status === 402
300
+ ? ClawnchErrorCode.INSUFFICIENT_FUNDS
301
+ : response.status === 408 || response.status === 504
302
+ ? ClawnchErrorCode.TIMEOUT
303
+ : ClawnchErrorCode.DEPLOY_FAILED;
304
+ throw new ClawnchDeployError(sdkCode, `API error: ${errorMsg}`);
305
+ }
306
+ return response.json();
307
+ }
308
+ }
309
+ //# sourceMappingURL=api-deployer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-deployer.js","sourceRoot":"","sources":["../src/api-deployer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAIL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,QAAQ,GACT,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAiBnE,mCAAmC;AACnC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAE5C,6CAA6C;AAC7C,MAAM,qBAAqB,GAAY,4CAA4C,CAAC;AAEpF,gDAAgD;AAChD,MAAM,SAAS,GAAG,QAAQ,CAAC;IACzB,kEAAkE;IAClE,2EAA2E;IAC3E,4DAA4D;CAC7D,CAAC,CAAC;AAEH,MAAM,OAAO,kBAAkB;IACZ,MAAM,CAAS;IACf,MAAM,CAA8B;IACpC,YAAY,CAAoC;IAChD,UAA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