@kasarlabs/erc20-mcp 0.1.4 → 0.1.5
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/build/schemas/index.d.ts
CHANGED
|
@@ -35,19 +35,19 @@ export declare const getAllowanceSchema: z.ZodObject<{
|
|
|
35
35
|
assetSymbol?: string | undefined;
|
|
36
36
|
}>;
|
|
37
37
|
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
ownerAddress: string;
|
|
39
|
+
spenderAddress: string;
|
|
38
40
|
asset: {
|
|
39
41
|
assetAddress?: string | undefined;
|
|
40
42
|
assetSymbol?: string | undefined;
|
|
41
43
|
};
|
|
42
|
-
spenderAddress: string;
|
|
43
|
-
ownerAddress: string;
|
|
44
44
|
}, {
|
|
45
|
+
ownerAddress: string;
|
|
46
|
+
spenderAddress: string;
|
|
45
47
|
asset: {
|
|
46
48
|
assetAddress?: string | undefined;
|
|
47
49
|
assetSymbol?: string | undefined;
|
|
48
50
|
};
|
|
49
|
-
spenderAddress: string;
|
|
50
|
-
ownerAddress: string;
|
|
51
51
|
}>;
|
|
52
52
|
export declare const getMyGivenAllowanceSchema: z.ZodObject<{
|
|
53
53
|
spenderAddress: z.ZodString;
|
|
@@ -68,17 +68,17 @@ export declare const getMyGivenAllowanceSchema: z.ZodObject<{
|
|
|
68
68
|
assetSymbol?: string | undefined;
|
|
69
69
|
}>;
|
|
70
70
|
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
spenderAddress: string;
|
|
71
72
|
asset: {
|
|
72
73
|
assetAddress?: string | undefined;
|
|
73
74
|
assetSymbol?: string | undefined;
|
|
74
75
|
};
|
|
75
|
-
spenderAddress: string;
|
|
76
76
|
}, {
|
|
77
|
+
spenderAddress: string;
|
|
77
78
|
asset: {
|
|
78
79
|
assetAddress?: string | undefined;
|
|
79
80
|
assetSymbol?: string | undefined;
|
|
80
81
|
};
|
|
81
|
-
spenderAddress: string;
|
|
82
82
|
}>;
|
|
83
83
|
export declare const getAllowanceGivenToMeSchema: z.ZodObject<{
|
|
84
84
|
ownerAddress: z.ZodString;
|
|
@@ -99,17 +99,17 @@ export declare const getAllowanceGivenToMeSchema: z.ZodObject<{
|
|
|
99
99
|
assetSymbol?: string | undefined;
|
|
100
100
|
}>;
|
|
101
101
|
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
ownerAddress: string;
|
|
102
103
|
asset: {
|
|
103
104
|
assetAddress?: string | undefined;
|
|
104
105
|
assetSymbol?: string | undefined;
|
|
105
106
|
};
|
|
106
|
-
ownerAddress: string;
|
|
107
107
|
}, {
|
|
108
|
+
ownerAddress: string;
|
|
108
109
|
asset: {
|
|
109
110
|
assetAddress?: string | undefined;
|
|
110
111
|
assetSymbol?: string | undefined;
|
|
111
112
|
};
|
|
112
|
-
ownerAddress: string;
|
|
113
113
|
}>;
|
|
114
114
|
export declare const getTotalSupplySchema: z.ZodObject<{
|
|
115
115
|
asset: z.ZodEffects<z.ZodObject<{
|
|
@@ -160,21 +160,21 @@ export declare const transferFromSchema: z.ZodObject<{
|
|
|
160
160
|
assetSymbol?: string | undefined;
|
|
161
161
|
}>;
|
|
162
162
|
}, "strip", z.ZodTypeAny, {
|
|
163
|
-
amount: string;
|
|
164
163
|
asset: {
|
|
165
164
|
assetAddress?: string | undefined;
|
|
166
165
|
assetSymbol?: string | undefined;
|
|
167
166
|
};
|
|
168
167
|
fromAddress: string;
|
|
169
168
|
toAddress: string;
|
|
170
|
-
}, {
|
|
171
169
|
amount: string;
|
|
170
|
+
}, {
|
|
172
171
|
asset: {
|
|
173
172
|
assetAddress?: string | undefined;
|
|
174
173
|
assetSymbol?: string | undefined;
|
|
175
174
|
};
|
|
176
175
|
fromAddress: string;
|
|
177
176
|
toAddress: string;
|
|
177
|
+
amount: string;
|
|
178
178
|
}>;
|
|
179
179
|
export declare const transferFromSignatureSchema: z.ZodObject<{
|
|
180
180
|
fromAddress: z.ZodString;
|
|
@@ -197,21 +197,21 @@ export declare const transferFromSignatureSchema: z.ZodObject<{
|
|
|
197
197
|
assetSymbol?: string | undefined;
|
|
198
198
|
}>;
|
|
199
199
|
}, "strip", z.ZodTypeAny, {
|
|
200
|
-
amount: string;
|
|
201
200
|
asset: {
|
|
202
201
|
assetAddress?: string | undefined;
|
|
203
202
|
assetSymbol?: string | undefined;
|
|
204
203
|
};
|
|
205
204
|
fromAddress: string;
|
|
206
205
|
toAddress: string;
|
|
207
|
-
}, {
|
|
208
206
|
amount: string;
|
|
207
|
+
}, {
|
|
209
208
|
asset: {
|
|
210
209
|
assetAddress?: string | undefined;
|
|
211
210
|
assetSymbol?: string | undefined;
|
|
212
211
|
};
|
|
213
212
|
fromAddress: string;
|
|
214
213
|
toAddress: string;
|
|
214
|
+
amount: string;
|
|
215
215
|
}>;
|
|
216
216
|
export declare const getBalanceSchema: z.ZodObject<{
|
|
217
217
|
accountAddress: z.ZodString;
|
|
@@ -323,19 +323,19 @@ export declare const approveSchema: z.ZodObject<{
|
|
|
323
323
|
assetSymbol?: string | undefined;
|
|
324
324
|
}>;
|
|
325
325
|
}, "strip", z.ZodTypeAny, {
|
|
326
|
-
|
|
326
|
+
spenderAddress: string;
|
|
327
327
|
asset: {
|
|
328
328
|
assetAddress?: string | undefined;
|
|
329
329
|
assetSymbol?: string | undefined;
|
|
330
330
|
};
|
|
331
|
-
spenderAddress: string;
|
|
332
|
-
}, {
|
|
333
331
|
amount: string;
|
|
332
|
+
}, {
|
|
333
|
+
spenderAddress: string;
|
|
334
334
|
asset: {
|
|
335
335
|
assetAddress?: string | undefined;
|
|
336
336
|
assetSymbol?: string | undefined;
|
|
337
337
|
};
|
|
338
|
-
|
|
338
|
+
amount: string;
|
|
339
339
|
}>;
|
|
340
340
|
export declare const approveSignatureSchema: z.ZodObject<{
|
|
341
341
|
spenderAddress: z.ZodString;
|
|
@@ -357,19 +357,19 @@ export declare const approveSignatureSchema: z.ZodObject<{
|
|
|
357
357
|
assetSymbol?: string | undefined;
|
|
358
358
|
}>;
|
|
359
359
|
}, "strip", z.ZodTypeAny, {
|
|
360
|
-
|
|
360
|
+
spenderAddress: string;
|
|
361
361
|
asset: {
|
|
362
362
|
assetAddress?: string | undefined;
|
|
363
363
|
assetSymbol?: string | undefined;
|
|
364
364
|
};
|
|
365
|
-
spenderAddress: string;
|
|
366
|
-
}, {
|
|
367
365
|
amount: string;
|
|
366
|
+
}, {
|
|
367
|
+
spenderAddress: string;
|
|
368
368
|
asset: {
|
|
369
369
|
assetAddress?: string | undefined;
|
|
370
370
|
assetSymbol?: string | undefined;
|
|
371
371
|
};
|
|
372
|
-
|
|
372
|
+
amount: string;
|
|
373
373
|
}>;
|
|
374
374
|
export declare const transferSchema: z.ZodObject<{
|
|
375
375
|
recipientAddress: z.ZodString;
|
|
@@ -391,19 +391,19 @@ export declare const transferSchema: z.ZodObject<{
|
|
|
391
391
|
assetSymbol?: string | undefined;
|
|
392
392
|
}>;
|
|
393
393
|
}, "strip", z.ZodTypeAny, {
|
|
394
|
-
recipientAddress: string;
|
|
395
|
-
amount: string;
|
|
396
394
|
asset: {
|
|
397
395
|
assetAddress?: string | undefined;
|
|
398
396
|
assetSymbol?: string | undefined;
|
|
399
397
|
};
|
|
400
|
-
}, {
|
|
401
|
-
recipientAddress: string;
|
|
402
398
|
amount: string;
|
|
399
|
+
recipientAddress: string;
|
|
400
|
+
}, {
|
|
403
401
|
asset: {
|
|
404
402
|
assetAddress?: string | undefined;
|
|
405
403
|
assetSymbol?: string | undefined;
|
|
406
404
|
};
|
|
405
|
+
amount: string;
|
|
406
|
+
recipientAddress: string;
|
|
407
407
|
}>;
|
|
408
408
|
export declare const transferSignatureSchema: z.ZodObject<{
|
|
409
409
|
recipientAddress: z.ZodString;
|
|
@@ -425,19 +425,19 @@ export declare const transferSignatureSchema: z.ZodObject<{
|
|
|
425
425
|
assetSymbol?: string | undefined;
|
|
426
426
|
}>;
|
|
427
427
|
}, "strip", z.ZodTypeAny, {
|
|
428
|
-
recipientAddress: string;
|
|
429
|
-
amount: string;
|
|
430
428
|
asset: {
|
|
431
429
|
assetAddress?: string | undefined;
|
|
432
430
|
assetSymbol?: string | undefined;
|
|
433
431
|
};
|
|
434
|
-
}, {
|
|
435
|
-
recipientAddress: string;
|
|
436
432
|
amount: string;
|
|
433
|
+
recipientAddress: string;
|
|
434
|
+
}, {
|
|
437
435
|
asset: {
|
|
438
436
|
assetAddress?: string | undefined;
|
|
439
437
|
assetSymbol?: string | undefined;
|
|
440
438
|
};
|
|
439
|
+
amount: string;
|
|
440
|
+
recipientAddress: string;
|
|
441
441
|
}>;
|
|
442
442
|
export declare const deployERC20Schema: z.ZodObject<{
|
|
443
443
|
name: z.ZodString;
|
|
@@ -2,6 +2,7 @@ import { shortString, cairo } from 'starknet';
|
|
|
2
2
|
import { ContractManager } from '../lib/utils/contractManager.js';
|
|
3
3
|
import { ERC20_CLASSHASH_SEPOLIA, ERC20_CLASSHASH_MAINNET, } from '../lib/constants/constant.js';
|
|
4
4
|
import { NEW_ERC20_ABI_SEPOLIA, NEW_ERC20_ABI_MAINNET, } from '../lib/abis/new.js';
|
|
5
|
+
import { formatTokenAmount } from '../lib/utils/utils.js';
|
|
5
6
|
export const deployERC20Contract = async (env, params) => {
|
|
6
7
|
try {
|
|
7
8
|
const provider = env.provider;
|
|
@@ -10,10 +11,11 @@ export const deployERC20Contract = async (env, params) => {
|
|
|
10
11
|
const chainId = shortString.decodeShortString(await provider.getChainId());
|
|
11
12
|
const classhash = chainId === 'SN_MAIN' ? ERC20_CLASSHASH_MAINNET : ERC20_CLASSHASH_SEPOLIA;
|
|
12
13
|
const abi = chainId === 'SN_MAIN' ? NEW_ERC20_ABI_MAINNET : NEW_ERC20_ABI_SEPOLIA;
|
|
14
|
+
const formattedAmount = formatTokenAmount(params.totalSupply.toString(), 18);
|
|
13
15
|
const response = await contractManager.deployContract(classhash, abi, [
|
|
14
16
|
params.name,
|
|
15
17
|
params.symbol,
|
|
16
|
-
cairo.uint256(
|
|
18
|
+
cairo.uint256(formattedAmount),
|
|
17
19
|
account.address,
|
|
18
20
|
]);
|
|
19
21
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployERC20.js","sourceRoot":"","sources":["../../src/tools/deployERC20.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EACL,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"deployERC20.js","sourceRoot":"","sources":["../../src/tools/deployERC20.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EACL,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAS1D,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACtC,GAAiB,EACjB,MAAyC,EACpB,EAAE;IACvB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QAC9B,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAE5B,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QAErD,MAAM,OAAO,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QAC3E,MAAM,SAAS,GACb,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,uBAAuB,CAAC;QAC5E,MAAM,GAAG,GACP,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,qBAAqB,CAAC;QAExE,MAAM,eAAe,GAAG,iBAAiB,CACvC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,EAC7B,EAAE,CACH,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,cAAc,CACnD,SAAmB,EACnB,GAAG,EACH;YACE,MAAM,CAAC,IAAI;YACX,MAAM,CAAC,MAAM;YACb,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC;YAC9B,OAAO,CAAC,OAAO;SAChB,CACF,CAAC;QAEF,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE;gBACJ,eAAe,EAAE,QAAQ,CAAC,eAAe;gBACzC,eAAe,EAAE,QAAQ,CAAC,eAAe;aAC1C;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
package/build/tools/transfer.js
CHANGED
|
@@ -10,7 +10,9 @@ export const transfer = async (env, params) => {
|
|
|
10
10
|
const recipientAddress = address;
|
|
11
11
|
try {
|
|
12
12
|
const nonce = await account.getNonce();
|
|
13
|
-
|
|
13
|
+
if (nonce === undefined) {
|
|
14
|
+
throw new Error(`Nonce is undefined. Please verify your account address and network. Account: ${account.address}`);
|
|
15
|
+
}
|
|
14
16
|
}
|
|
15
17
|
catch (error) {
|
|
16
18
|
throw new Error(`Account not found on this network. Please verify your account address and network. Account: ${account.address}. Error: ${error.message}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.js","sourceRoot":"","sources":["../../src/tools/transfer.ts"],"names":[],"mappings":"AAAA,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+F,OAAO,CAAC,OAAO,YAAY,KAAK,CAAC,OAAO,EAAE,CAC1I,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC;YAC5B,GAAG;YACH,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,iBAAiB,EAAE,OAAO;SAC3B,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE;YAC7C,SAAS,EAAE,gBAAgB;YAC3B,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC;YACrC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;QAEH,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE;gBACJ,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,kBAAkB,EAAE,gBAAgB;gBACpC,gBAAgB,EAAE,GAAG;aACtB;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kasarlabs/erc20-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,22 +10,28 @@
|
|
|
10
10
|
"build": "tsc && chmod 755 build/index.js",
|
|
11
11
|
"clean": "rm -rf build",
|
|
12
12
|
"clean:all": "rm -rf build node_modules",
|
|
13
|
-
"start": "node build/index.js"
|
|
13
|
+
"start": "node build/index.js",
|
|
14
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
15
|
+
"test:e2e": "NODE_OPTIONS=--experimental-vm-modules jest __tests__/e2e"
|
|
14
16
|
},
|
|
15
17
|
"files": [
|
|
16
18
|
"build"
|
|
17
19
|
],
|
|
18
20
|
"dependencies": {
|
|
19
|
-
"@kasarlabs/ask-starknet-core": "0.1.
|
|
21
|
+
"@kasarlabs/ask-starknet-core": "0.1.4",
|
|
20
22
|
"@langchain/core": "^0.3.42",
|
|
21
23
|
"@modelcontextprotocol/sdk": "1.22.0",
|
|
22
24
|
"dotenv": "^16.4.7",
|
|
23
|
-
"starknet": "8.
|
|
25
|
+
"starknet": "~8.9.0",
|
|
24
26
|
"winston": "^3.17.0",
|
|
25
27
|
"zod": "^3.24.2"
|
|
26
28
|
},
|
|
27
29
|
"devDependencies": {
|
|
30
|
+
"@jest/globals": "^29.7.0",
|
|
31
|
+
"@types/jest": "^29.5.12",
|
|
28
32
|
"@types/node": "^22.13.10",
|
|
33
|
+
"jest": "^29.7.0",
|
|
34
|
+
"ts-jest": "^29.1.2",
|
|
29
35
|
"typescript": "^5.8.2"
|
|
30
36
|
},
|
|
31
37
|
"keywords": [
|
|
@@ -39,5 +45,5 @@
|
|
|
39
45
|
"publishConfig": {
|
|
40
46
|
"access": "public"
|
|
41
47
|
},
|
|
42
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "0799e2b085e950e5d102822d71a6b122290e8c38"
|
|
43
49
|
}
|