@kasarlabs/braavos-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/lib/utils/AccountManager.d.ts +6 -3
- package/build/lib/utils/AccountManager.js +22 -13
- package/build/lib/utils/AccountManager.js.map +1 -1
- package/build/tools/createAccount.d.ts +11 -27
- package/build/tools/createAccount.js +15 -11
- package/build/tools/createAccount.js.map +1 -1
- package/build/tools/deployAccount.d.ts +3 -27
- package/build/tools/deployAccount.js +14 -6
- package/build/tools/deployAccount.js.map +1 -1
- package/package.json +10 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RpcProvider, BigNumberish } from 'starknet';
|
|
1
|
+
import { RpcProvider, BigNumberish, ResourceBoundsBN } from 'starknet';
|
|
2
2
|
import { AccountDetails, BaseUtilityClass, TransactionResult } from '../types/accounts.js';
|
|
3
3
|
export declare class AccountManager implements BaseUtilityClass {
|
|
4
4
|
provider: RpcProvider;
|
|
@@ -7,8 +7,11 @@ export declare class AccountManager implements BaseUtilityClass {
|
|
|
7
7
|
accountClassHash: string;
|
|
8
8
|
constructor(provider: RpcProvider, initialClassHash: string, proxyClassHash: string, accountClassHash: string);
|
|
9
9
|
createAccount(): Promise<AccountDetails>;
|
|
10
|
-
estimateAccountDeployFee(accountDetails: AccountDetails): Promise<
|
|
11
|
-
|
|
10
|
+
estimateAccountDeployFee(accountDetails: AccountDetails): Promise<{
|
|
11
|
+
resourceBounds: ResourceBoundsBN;
|
|
12
|
+
maxFee: bigint;
|
|
13
|
+
}>;
|
|
14
|
+
deployAccount(accountDetails: AccountDetails, resourceBounds?: ResourceBoundsBN, maxFee?: BigNumberish): Promise<TransactionResult>;
|
|
12
15
|
private calcInit;
|
|
13
16
|
private getProxyConstructor;
|
|
14
17
|
private getBraavosSignature;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallData, stark, hash, ec, constants, num, } from 'starknet';
|
|
1
|
+
import { CallData, stark, hash, ec, constants, num, EDAMode, ETransactionVersion, } from 'starknet';
|
|
2
2
|
export class AccountManager {
|
|
3
3
|
constructor(provider, initialClassHash, proxyClassHash, accountClassHash) {
|
|
4
4
|
this.provider = provider;
|
|
@@ -25,34 +25,39 @@ export class AccountManager {
|
|
|
25
25
|
}
|
|
26
26
|
async estimateAccountDeployFee(accountDetails) {
|
|
27
27
|
try {
|
|
28
|
-
const version =
|
|
28
|
+
const version = ETransactionVersion.V3;
|
|
29
29
|
const nonce = constants.ZERO;
|
|
30
30
|
const chainId = await this.provider.getChainId();
|
|
31
31
|
const initializer = this.calcInit(accountDetails.publicKey);
|
|
32
32
|
const constructorCalldata = this.getProxyConstructor(initializer);
|
|
33
|
-
const signature = this.getBraavosSignature(accountDetails.contractAddress, constructorCalldata, accountDetails.publicKey, constants.ZERO, chainId, BigInt(nonce), accountDetails.privateKey);
|
|
34
33
|
const deployAccountPayload = {
|
|
35
34
|
classHash: this.proxyClassHash,
|
|
36
35
|
constructorCalldata,
|
|
37
36
|
addressSalt: accountDetails.publicKey,
|
|
38
|
-
signature,
|
|
39
37
|
};
|
|
40
38
|
const response = await this.provider.getDeployAccountEstimateFee(deployAccountPayload, { version, nonce });
|
|
41
|
-
return
|
|
39
|
+
return {
|
|
40
|
+
resourceBounds: response.resourceBounds,
|
|
41
|
+
maxFee: response.overall_fee,
|
|
42
|
+
};
|
|
42
43
|
}
|
|
43
44
|
catch (error) {
|
|
44
45
|
throw new Error(`Failed to estimate deploy fee: ${error.message}`);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
|
-
async deployAccount(accountDetails, maxFee) {
|
|
48
|
+
async deployAccount(accountDetails, resourceBounds, maxFee) {
|
|
48
49
|
try {
|
|
49
|
-
const version =
|
|
50
|
+
const version = ETransactionVersion.V3;
|
|
50
51
|
const nonce = constants.ZERO;
|
|
51
52
|
const chainId = await this.provider.getChainId();
|
|
52
53
|
const initializer = this.calcInit(accountDetails.publicKey);
|
|
53
54
|
const constructorCalldata = this.getProxyConstructor(initializer);
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
if (!resourceBounds || !maxFee) {
|
|
56
|
+
const estimated = await this.estimateAccountDeployFee(accountDetails);
|
|
57
|
+
resourceBounds = resourceBounds ?? estimated.resourceBounds;
|
|
58
|
+
maxFee = maxFee ?? estimated.maxFee;
|
|
59
|
+
}
|
|
60
|
+
const signature = this.getBraavosSignature(accountDetails.contractAddress, constructorCalldata, accountDetails.publicKey, resourceBounds, chainId, BigInt(nonce), accountDetails.privateKey);
|
|
56
61
|
const { transaction_hash, contract_address } = await this.provider.deployAccountContract({
|
|
57
62
|
classHash: this.proxyClassHash,
|
|
58
63
|
constructorCalldata,
|
|
@@ -84,16 +89,20 @@ export class AccountManager {
|
|
|
84
89
|
calldata: [...initializer],
|
|
85
90
|
});
|
|
86
91
|
}
|
|
87
|
-
getBraavosSignature(contractAddress,
|
|
92
|
+
getBraavosSignature(contractAddress, compiledConstructorCalldata, publicKey, resourceBounds, chainId, nonce, privateKey) {
|
|
88
93
|
const txHash = hash.calculateDeployAccountTransactionHash({
|
|
89
94
|
contractAddress,
|
|
90
95
|
classHash: this.proxyClassHash,
|
|
91
|
-
|
|
96
|
+
compiledConstructorCalldata,
|
|
92
97
|
salt: publicKey,
|
|
93
|
-
version:
|
|
94
|
-
maxFee,
|
|
98
|
+
version: ETransactionVersion.V3,
|
|
95
99
|
chainId,
|
|
96
100
|
nonce,
|
|
101
|
+
nonceDataAvailabilityMode: EDAMode.L2,
|
|
102
|
+
feeDataAvailabilityMode: EDAMode.L2,
|
|
103
|
+
resourceBounds,
|
|
104
|
+
paymasterData: [],
|
|
105
|
+
tip: 0,
|
|
97
106
|
});
|
|
98
107
|
const parsedOtherSigner = [0, 0, 0, 0, 0, 0, 0];
|
|
99
108
|
const { r, s } = ec.starkCurve.sign(hash.computeHashOnElements([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountManager.js","sourceRoot":"","sources":["../../../src/lib/utils/AccountManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,EAAE,EACF,SAAS,EAIT,GAAG,
|
|
1
|
+
{"version":3,"file":"AccountManager.js","sourceRoot":"","sources":["../../../src/lib/utils/AccountManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,EAAE,EACF,SAAS,EAIT,GAAG,EACH,OAAO,EACP,mBAAmB,GAEpB,MAAM,UAAU,CAAC;AAelB,MAAM,OAAO,cAAc;IACzB,YACS,QAAqB,EACrB,gBAAwB,EACxB,cAAsB,EACtB,gBAAwB;QAHxB,aAAQ,GAAR,QAAQ,CAAa;QACrB,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,mBAAc,GAAd,cAAc,CAAQ;QACtB,qBAAgB,GAAhB,gBAAgB,CAAQ;IAC9B,CAAC;IASJ,KAAK,CAAC,aAAa;QACjB,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;YACzC,MAAM,SAAS,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAExD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YAC7C,MAAM,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;YAElE,MAAM,eAAe,GAAG,IAAI,CAAC,gCAAgC,CAC3D,SAAS,EACT,IAAI,CAAC,cAAc,EACnB,mBAAmB,EACnB,CAAC,CACF,CAAC;YAEF,OAAO;gBACL,eAAe;gBACf,UAAU;gBACV,SAAS;aACV,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,6BAA6B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IAUD,KAAK,CAAC,wBAAwB,CAC5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C;IACJ,CAAC;CACF;AAQD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC9D,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAoB,CAAC;QACrD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,GAAG,IAAI;gBACP,OAAO,EAAE,QAAQ,IAAI,CAAC,MAAM,6CAA6C,IAAI,CAAC,eAAe,iBAAiB,IAAI,CAAC,SAAS,kBAAkB,IAAI,CAAC,UAAU,EAAE;aAChK,CAAC,CAAC;QACL,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,34 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
wallet: string;
|
|
4
|
-
publicKey: string;
|
|
5
|
-
privateKey: string;
|
|
6
|
-
contractAddress: string;
|
|
7
|
-
error?: undefined;
|
|
8
|
-
} | {
|
|
9
|
-
status: string;
|
|
10
|
-
error: string;
|
|
11
|
-
wallet?: undefined;
|
|
12
|
-
publicKey?: undefined;
|
|
13
|
-
privateKey?: undefined;
|
|
14
|
-
contractAddress?: undefined;
|
|
15
|
-
}>;
|
|
1
|
+
import { toolResult } from '@kasarlabs/ask-starknet-core';
|
|
2
|
+
export declare const CreateBraavosAccount: () => Promise<toolResult>;
|
|
16
3
|
export declare const CreateBraavosAccountSignature: () => Promise<{
|
|
17
4
|
status: string;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
data: {
|
|
6
|
+
transaction_type: string;
|
|
7
|
+
wallet: string;
|
|
8
|
+
publicKey: string;
|
|
9
|
+
privateKey: string;
|
|
10
|
+
contractAddress: string;
|
|
11
|
+
deployFee: string;
|
|
12
|
+
};
|
|
24
13
|
error?: undefined;
|
|
25
14
|
} | {
|
|
26
15
|
status: string;
|
|
27
16
|
error: string;
|
|
28
|
-
|
|
29
|
-
wallet?: undefined;
|
|
30
|
-
publicKey?: undefined;
|
|
31
|
-
privateKey?: undefined;
|
|
32
|
-
contractAddress?: undefined;
|
|
33
|
-
deployFee?: undefined;
|
|
17
|
+
data?: undefined;
|
|
34
18
|
}>;
|
|
@@ -8,10 +8,12 @@ export const CreateBraavosAccount = async () => {
|
|
|
8
8
|
const accountDetails = await accountManager.createAccount();
|
|
9
9
|
return {
|
|
10
10
|
status: 'success',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
data: {
|
|
12
|
+
wallet: 'Braavos',
|
|
13
|
+
publicKey: accountDetails.publicKey,
|
|
14
|
+
privateKey: accountDetails.privateKey,
|
|
15
|
+
contractAddress: accountDetails.contractAddress,
|
|
16
|
+
},
|
|
15
17
|
};
|
|
16
18
|
}
|
|
17
19
|
catch (error) {
|
|
@@ -27,15 +29,17 @@ export const CreateBraavosAccountSignature = async () => {
|
|
|
27
29
|
const accountManager = new AccountManager(provider, BRAAVOS_INITIAL_CLASSHASH, BRAAVOS_PROXY_CLASSHASH, BRAAVOS_ACCOUNT_CLASSHASH);
|
|
28
30
|
const accountDetails = await accountManager.createAccount();
|
|
29
31
|
const suggestedMaxFee = await accountManager.estimateAccountDeployFee(accountDetails);
|
|
30
|
-
const maxFee = suggestedMaxFee
|
|
32
|
+
const maxFee = suggestedMaxFee.maxFee;
|
|
31
33
|
return {
|
|
32
34
|
status: 'success',
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
data: {
|
|
36
|
+
transaction_type: 'CREATE_ACCOUNT',
|
|
37
|
+
wallet: 'Braavos',
|
|
38
|
+
publicKey: accountDetails.publicKey,
|
|
39
|
+
privateKey: accountDetails.privateKey,
|
|
40
|
+
contractAddress: accountDetails.contractAddress,
|
|
41
|
+
deployFee: maxFee.toString(),
|
|
42
|
+
},
|
|
39
43
|
};
|
|
40
44
|
}
|
|
41
45
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../src/tools/createAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../src/tools/createAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAUhE,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,IAAyB,EAAE;IAClE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAC5E,MAAM,cAAc,GAAG,IAAI,cAAc,CACvC,QAAQ,EACR,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,CAC1B,CAAC;QAEF,MAAM,cAAc,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC;QAE5D,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE;gBACJ,MAAM,EAAE,SAAS;gBACjB,SAAS,EAAE,cAAc,CAAC,SAAS;gBACnC,UAAU,EAAE,cAAc,CAAC,UAAU;gBACrC,eAAe,EAAE,cAAc,CAAC,eAAe;aAChD;SAC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-
import { onchainRead } from '@kasarlabs/ask-starknet-core';
|
|
1
|
+
import { onchainRead, toolResult } from '@kasarlabs/ask-starknet-core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { accountDetailsSchema } from '../schemas/index.js';
|
|
4
|
-
export declare const DeployBraavosAccount: (env: onchainRead, params: z.infer<typeof accountDetailsSchema>) => Promise<
|
|
5
|
-
|
|
6
|
-
wallet: string;
|
|
7
|
-
transaction_hash: string | undefined;
|
|
8
|
-
contract_address: string | undefined;
|
|
9
|
-
error?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
status: string;
|
|
12
|
-
error: string;
|
|
13
|
-
wallet?: undefined;
|
|
14
|
-
transaction_hash?: undefined;
|
|
15
|
-
contract_address?: undefined;
|
|
16
|
-
}>;
|
|
17
|
-
export declare const DeployBraavosAccountSignature: (params: z.infer<typeof accountDetailsSchema>) => Promise<{
|
|
18
|
-
status: string;
|
|
19
|
-
wallet: string;
|
|
20
|
-
transaction_hash: string | undefined;
|
|
21
|
-
contract_address: string | undefined;
|
|
22
|
-
error?: undefined;
|
|
23
|
-
} | {
|
|
24
|
-
status: string;
|
|
25
|
-
error: string;
|
|
26
|
-
wallet?: undefined;
|
|
27
|
-
transaction_hash?: undefined;
|
|
28
|
-
contract_address?: undefined;
|
|
29
|
-
}>;
|
|
4
|
+
export declare const DeployBraavosAccount: (env: onchainRead, params: z.infer<typeof accountDetailsSchema>) => Promise<toolResult>;
|
|
5
|
+
export declare const DeployBraavosAccountSignature: (params: z.infer<typeof accountDetailsSchema>) => Promise<toolResult>;
|
|
@@ -2,15 +2,21 @@ import { RpcProvider } from 'starknet';
|
|
|
2
2
|
import { AccountManager } from '../lib/utils/AccountManager.js';
|
|
3
3
|
import { BRAAVOS_ACCOUNT_CLASSHASH, BRAAVOS_INITIAL_CLASSHASH, BRAAVOS_PROXY_CLASSHASH, } from '../lib/constants/contract.js';
|
|
4
4
|
export const DeployBraavosAccount = async (env, params) => {
|
|
5
|
+
return {
|
|
6
|
+
status: 'failure',
|
|
7
|
+
error: 'Tool under maintenance',
|
|
8
|
+
};
|
|
5
9
|
try {
|
|
6
10
|
const provider = env.provider;
|
|
7
11
|
const accountManager = new AccountManager(provider, BRAAVOS_INITIAL_CLASSHASH, BRAAVOS_PROXY_CLASSHASH, BRAAVOS_ACCOUNT_CLASSHASH);
|
|
8
12
|
const tx = await accountManager.deployAccount(params);
|
|
9
13
|
return {
|
|
10
14
|
status: 'success',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
data: {
|
|
16
|
+
wallet: 'Braavos',
|
|
17
|
+
transaction_hash: tx.transactionHash,
|
|
18
|
+
contract_address: tx.contractAddress,
|
|
19
|
+
},
|
|
14
20
|
};
|
|
15
21
|
}
|
|
16
22
|
catch (error) {
|
|
@@ -27,9 +33,11 @@ export const DeployBraavosAccountSignature = async (params) => {
|
|
|
27
33
|
const tx = await accountManager.deployAccount(params);
|
|
28
34
|
return {
|
|
29
35
|
status: 'success',
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
data: {
|
|
37
|
+
wallet: 'Braavos',
|
|
38
|
+
transaction_hash: tx.transactionHash,
|
|
39
|
+
contract_address: tx.contractAddress,
|
|
40
|
+
},
|
|
33
41
|
};
|
|
34
42
|
}
|
|
35
43
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployAccount.js","sourceRoot":"","sources":["../../src/tools/deployAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGhE,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AAWtC,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EACvC,GAAgB,EAChB,MAA4C,
|
|
1
|
+
{"version":3,"file":"deployAccount.js","sourceRoot":"","sources":["../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I,cAAc,CACvC,QAAQ,EACR,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,CAC1B,CAAC;QAEF,MAAM,EAAE,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAEtD,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE;gBACJ,MAAM,EAAE,SAAS;gBACjB,gBAAgB,EAAE,EAAE,CAAC,eAAe;gBACpC,gBAAgB,EAAE,EAAE,CAAC,eAAe;aACrC;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/braavos-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,16 +16,21 @@
|
|
|
16
16
|
"build"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@kasarlabs/ask-starknet-core": "0.1.
|
|
19
|
+
"@kasarlabs/ask-starknet-core": "0.1.4",
|
|
20
20
|
"@langchain/core": "^0.3.75",
|
|
21
|
-
"@modelcontextprotocol/sdk": "
|
|
21
|
+
"@modelcontextprotocol/sdk": "1.22.0",
|
|
22
|
+
"@starknet-io/types-js": "^0.10.0",
|
|
22
23
|
"dotenv": "^16.4.7",
|
|
23
|
-
"starknet": "
|
|
24
|
+
"starknet": "~8.9.0",
|
|
24
25
|
"winston": "^3.17.0",
|
|
25
26
|
"zod": "^3.24.2"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
29
|
+
"@jest/globals": "^29.7.0",
|
|
30
|
+
"@types/jest": "^29.5.12",
|
|
28
31
|
"@types/node": "^22.13.10",
|
|
32
|
+
"jest": "^29.7.0",
|
|
33
|
+
"ts-jest": "^29.1.2",
|
|
29
34
|
"typescript": "^5.8.2"
|
|
30
35
|
},
|
|
31
36
|
"keywords": [
|
|
@@ -39,5 +44,5 @@
|
|
|
39
44
|
"publishConfig": {
|
|
40
45
|
"access": "public"
|
|
41
46
|
},
|
|
42
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "0799e2b085e950e5d102822d71a6b122290e8c38"
|
|
43
48
|
}
|