@kasarlabs/contract-mcp 0.1.2 → 0.1.4
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/tools/declareContract.d.ts +2 -19
- package/build/tools/declareContract.js +8 -9
- package/build/tools/declareContract.js.map +1 -1
- package/build/tools/deployContract.d.ts +2 -23
- package/build/tools/deployContract.js +10 -13
- package/build/tools/deployContract.js.map +1 -1
- package/build/tools/getConstructorParams.d.ts +2 -25
- package/build/tools/getConstructorParams.js +16 -14
- package/build/tools/getConstructorParams.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,21 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { toolResult } from '@kasarlabs/ask-starknet-core';
|
|
2
3
|
import { declareContractSchema } from '../schemas/index.js';
|
|
3
|
-
export declare const declareContract: (params: z.infer<typeof declareContractSchema>) => Promise<
|
|
4
|
-
status: string;
|
|
5
|
-
transactionHash: any;
|
|
6
|
-
classHash: any;
|
|
7
|
-
sierraFilePath: string;
|
|
8
|
-
casmFilePath: string;
|
|
9
|
-
message: string;
|
|
10
|
-
error?: undefined;
|
|
11
|
-
step?: undefined;
|
|
12
|
-
} | {
|
|
13
|
-
status: string;
|
|
14
|
-
error: string;
|
|
15
|
-
step: string;
|
|
16
|
-
sierraFilePath: string;
|
|
17
|
-
casmFilePath: string;
|
|
18
|
-
transactionHash?: undefined;
|
|
19
|
-
classHash?: undefined;
|
|
20
|
-
message?: undefined;
|
|
21
|
-
}>;
|
|
4
|
+
export declare const declareContract: (params: z.infer<typeof declareContractSchema>) => Promise<toolResult>;
|
|
@@ -12,21 +12,20 @@ export const declareContract = async (params) => {
|
|
|
12
12
|
const { classHash: calculatedClassHash } = await contractManagerForHash.isContractDeclared();
|
|
13
13
|
return {
|
|
14
14
|
status: 'success',
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
data: {
|
|
16
|
+
transactionHash: declareResponse.transaction_hash || '',
|
|
17
|
+
classHash: declareResponse.class_hash || calculatedClassHash,
|
|
18
|
+
sierraFilePath: params.sierraFilePath,
|
|
19
|
+
casmFilePath: params.casmFilePath,
|
|
20
|
+
message: 'Contract declared successfully',
|
|
21
|
+
},
|
|
20
22
|
};
|
|
21
23
|
}
|
|
22
24
|
catch (error) {
|
|
23
25
|
const errorMessage = formatContractError(error);
|
|
24
26
|
return {
|
|
25
27
|
status: 'failure',
|
|
26
|
-
error: errorMessage
|
|
27
|
-
step: 'contract declaration',
|
|
28
|
-
sierraFilePath: params.sierraFilePath,
|
|
29
|
-
casmFilePath: params.casmFilePath,
|
|
28
|
+
error: `${errorMessage} (step: contract declaration)`,
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declareContract.js","sourceRoot":"","sources":["../../src/tools/declareContract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"declareContract.js","sourceRoot":"","sources":["../../src/tools/declareContract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAc,MAAM,8BAA8B,CAAC;AAE3E,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,MAA6C,EACxB,EAAE;IACvB,IAAI,CAAC;QAEH,MAAM,iBAAiB,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;QAGpE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,eAAe,EAAE,CAAC;QAGhD,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QACrD,MAAM,eAAe,CAAC,4BAA4B,CAChD,MAAM,CAAC,cAAc,EACrB,MAAM,CAAC,YAAY,CACpB,CAAC;QAEF,MAAM,eAAe,GAAG,MAAM,eAAe,CAAC,eAAe,EAAE,CAAC;QAGhE,MAAM,sBAAsB,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QAC5D,MAAM,sBAAsB,CAAC,4BAA4B,CACvD,MAAM,CAAC,cAAc,EACrB,MAAM,CAAC,YAAY,CACpB,CAAC;QACF,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,GACtC,MAAM,sBAAsB,CAAC,kBAAkB,EAAE,CAAC;QAEpD,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE;gBACJ,eAAe,EAAE,eAAe,CAAC,gBAAgB,IAAI,EAAE;gBACvD,SAAS,EAAE,eAAe,CAAC,UAAU,IAAI,mBAAmB;gBAC5D,cAAc,EAAE,MAAM,CAAC,cAAc;gBACrC,YAAY,EAAE,MAAM,CAAC,YAAY;gBACjC,OAAO,EAAE,gCAAgC;aAC1C;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChD,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,GAAG,YAAY,+BAA+B;SACtD,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { toolResult } from '@kasarlabs/ask-starknet-core';
|
|
2
3
|
import { deployContractSchema } from '../schemas/index.js';
|
|
3
|
-
export declare const deployContract: (params: z.infer<typeof deployContractSchema>) => Promise<
|
|
4
|
-
status: string;
|
|
5
|
-
transactionHash: any;
|
|
6
|
-
contractAddress: any;
|
|
7
|
-
classHash: string;
|
|
8
|
-
constructorArgs: string[];
|
|
9
|
-
sierraFilePath: string;
|
|
10
|
-
casmFilePath: string;
|
|
11
|
-
message: string;
|
|
12
|
-
error?: undefined;
|
|
13
|
-
step?: undefined;
|
|
14
|
-
} | {
|
|
15
|
-
status: string;
|
|
16
|
-
error: string;
|
|
17
|
-
step: string;
|
|
18
|
-
classHash: string;
|
|
19
|
-
constructorArgs: string[];
|
|
20
|
-
sierraFilePath: string;
|
|
21
|
-
casmFilePath: string;
|
|
22
|
-
transactionHash?: undefined;
|
|
23
|
-
contractAddress?: undefined;
|
|
24
|
-
message?: undefined;
|
|
25
|
-
}>;
|
|
4
|
+
export declare const deployContract: (params: z.infer<typeof deployContractSchema>) => Promise<toolResult>;
|
|
@@ -9,25 +9,22 @@ export const deployContract = async (params) => {
|
|
|
9
9
|
const deployResponse = await contractManager.deployContract(params.classHash, params.constructorArgs || []);
|
|
10
10
|
return {
|
|
11
11
|
status: 'success',
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
data: {
|
|
13
|
+
transactionHash: deployResponse.transaction_hash,
|
|
14
|
+
contractAddress: deployResponse.contract_address,
|
|
15
|
+
classHash: params.classHash,
|
|
16
|
+
constructorArgs: params.constructorArgs || [],
|
|
17
|
+
sierraFilePath: params.sierraFilePath,
|
|
18
|
+
casmFilePath: params.casmFilePath,
|
|
19
|
+
message: 'Contract deployed successfully',
|
|
20
|
+
},
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
23
|
catch (error) {
|
|
22
24
|
const errorMessage = formatContractError(error);
|
|
23
25
|
return {
|
|
24
26
|
status: 'failure',
|
|
25
|
-
error: errorMessage,
|
|
26
|
-
step: 'contract deployment',
|
|
27
|
-
classHash: params.classHash,
|
|
28
|
-
constructorArgs: params.constructorArgs || [],
|
|
29
|
-
sierraFilePath: params.sierraFilePath,
|
|
30
|
-
casmFilePath: params.casmFilePath,
|
|
27
|
+
error: `${errorMessage} (step: contract deployment, classHash: ${params.classHash})`,
|
|
31
28
|
};
|
|
32
29
|
}
|
|
33
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployContract.js","sourceRoot":"","sources":["../../src/tools/deployContract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"deployContract.js","sourceRoot":"","sources":["../../src/tools/deployContract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAc,MAAM,8BAA8B,CAAC;AAE3E,OAAO,EAEL,mBAAmB,EACnB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAMzB,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,MAA4C,EACvB,EAAE;IACvB,IAAI,CAAC;QAKH,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,eAAe,EAAE,CAAC;QAGhD,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QACrD,MAAM,eAAe,CAAC,4BAA4B,CAChD,MAAM,CAAC,cAAc,EACrB,MAAM,CAAC,YAAY,CACpB,CAAC;QACF,MAAM,eAAe,CAAC,WAAW,EAAE,CAAC;QAEpC,MAAM,cAAc,GAAG,MAAM,eAAe,CAAC,cAAc,CACzD,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,eAAe,IAAI,EAAE,CAC7B,CAAC;QAEF,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE;gBACJ,eAAe,EAAE,cAAc,CAAC,gBAAgB;gBAChD,eAAe,EAAE,cAAc,CAAC,gBAAgB;gBAChD,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,eAAe,EAAE,MAAM,CAAC,eAAe,IAAI,EAAE;gBAC7C,cAAc,EAAE,MAAM,CAAC,cAAc;gBACrC,YAAY,EAAE,MAAM,CAAC,YAAY;gBACjC,OAAO,EAAE,gCAAgC;aAC1C;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChD,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,GAAG,YAAY,2CAA2C,MAAM,CAAC,SAAS,GAAG;SACrF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { getConstructorParamsSchema } from '../schemas/index.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
classHash: string;
|
|
6
|
-
sierraFilePath: string;
|
|
7
|
-
message: string;
|
|
8
|
-
parameterCount: number;
|
|
9
|
-
parameters: {
|
|
10
|
-
index: number;
|
|
11
|
-
name: any;
|
|
12
|
-
type: any;
|
|
13
|
-
}[];
|
|
14
|
-
error?: undefined;
|
|
15
|
-
step?: undefined;
|
|
16
|
-
providedArgs?: undefined;
|
|
17
|
-
} | {
|
|
18
|
-
status: string;
|
|
19
|
-
error: string;
|
|
20
|
-
step: string;
|
|
21
|
-
classHash: string;
|
|
22
|
-
sierraFilePath: string;
|
|
23
|
-
providedArgs: string[];
|
|
24
|
-
message?: undefined;
|
|
25
|
-
parameterCount?: undefined;
|
|
26
|
-
parameters?: undefined;
|
|
27
|
-
}>;
|
|
3
|
+
import { toolResult } from '@kasarlabs/ask-starknet-core';
|
|
4
|
+
export declare const getConstructorParams: (params: z.infer<typeof getConstructorParamsSchema>) => Promise<toolResult>;
|
|
@@ -6,21 +6,27 @@ export const getConstructorParams = async (params) => {
|
|
|
6
6
|
const provider = new RpcProvider({
|
|
7
7
|
nodeUrl: 'https://starknet-mainnet.public.blastapi.io',
|
|
8
8
|
});
|
|
9
|
-
const dummyAccount = new Account(
|
|
9
|
+
const dummyAccount = new Account({
|
|
10
|
+
provider,
|
|
11
|
+
address: '0x1',
|
|
12
|
+
signer: '0x1',
|
|
13
|
+
});
|
|
10
14
|
const contractManager = new ContractManager(dummyAccount);
|
|
11
15
|
await contractManager.loadContractCompilationFiles(params.sierraFilePath, params.casmFilePath);
|
|
12
16
|
const constructorParams = contractManager.extractConstructorParams();
|
|
13
17
|
return {
|
|
14
18
|
status: 'success',
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
index
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
data: {
|
|
20
|
+
classHash: params.classHash,
|
|
21
|
+
sierraFilePath: params.sierraFilePath,
|
|
22
|
+
message: 'Constructor parameters retrieved successfully',
|
|
23
|
+
parameterCount: constructorParams.length,
|
|
24
|
+
parameters: constructorParams.map((param, index) => ({
|
|
25
|
+
index,
|
|
26
|
+
name: param.name,
|
|
27
|
+
type: param.type,
|
|
28
|
+
})),
|
|
29
|
+
},
|
|
24
30
|
};
|
|
25
31
|
}
|
|
26
32
|
catch (error) {
|
|
@@ -28,10 +34,6 @@ export const getConstructorParams = async (params) => {
|
|
|
28
34
|
return {
|
|
29
35
|
status: 'failure',
|
|
30
36
|
error: errorMessage,
|
|
31
|
-
step: 'getting constructor parameters',
|
|
32
|
-
classHash: params.classHash,
|
|
33
|
-
sierraFilePath: params.sierraFilePath,
|
|
34
|
-
providedArgs: params.constructorArgs || [],
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConstructorParams.js","sourceRoot":"","sources":["../../src/tools/getConstructorParams.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"getConstructorParams.js","sourceRoot":"","sources":["../../src/tools/getConstructorParams.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAQhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EACvC,MAAkD,EAC7B,EAAE;IACvB,IA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0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"build"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@kasarlabs/ask-starknet-core": "0.1.
|
|
20
|
-
"@modelcontextprotocol/sdk": "
|
|
19
|
+
"@kasarlabs/ask-starknet-core": "0.1.3",
|
|
20
|
+
"@modelcontextprotocol/sdk": "1.22.0",
|
|
21
21
|
"dotenv": "^16.4.7",
|
|
22
|
-
"starknet": "
|
|
22
|
+
"starknet": "8.6.0",
|
|
23
23
|
"winston": "^3.17.0",
|
|
24
24
|
"zod": "^3.24.2"
|
|
25
25
|
},
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "bfb4d4b055bbfa15b8e745d414adf52ac5e158fb"
|
|
42
42
|
}
|