@cartesi/cli 2.0.0-alpha.13 → 2.0.0-alpha.15
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/base.d.ts +8 -3
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +7 -4
- package/dist/commands/address-book.d.ts +1 -0
- package/dist/commands/address-book.d.ts.map +1 -1
- package/dist/commands/address-book.js +6 -3
- package/dist/commands/create.d.ts +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +1 -0
- package/dist/commands/deploy.d.ts +1 -16
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +8 -267
- package/dist/commands/deposit/erc20.d.ts +11 -0
- package/dist/commands/deposit/erc20.d.ts.map +1 -0
- package/dist/commands/deposit/erc20.js +126 -0
- package/dist/commands/deposit/erc721.d.ts +12 -0
- package/dist/commands/deposit/erc721.d.ts.map +1 -0
- package/dist/commands/deposit/erc721.js +144 -0
- package/dist/commands/deposit/ether.d.ts +10 -0
- package/dist/commands/deposit/ether.d.ts.map +1 -0
- package/dist/commands/deposit/ether.js +66 -0
- package/dist/commands/deposit.d.ts +9 -0
- package/dist/commands/deposit.d.ts.map +1 -0
- package/dist/commands/deposit.js +36 -0
- package/dist/commands/logs.d.ts +1 -1
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +6 -4
- package/dist/commands/run.d.ts +13 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +196 -4
- package/dist/commands/send.d.ts +6 -17
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +122 -59
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +10 -7
- package/dist/compose/default.env +1 -1
- package/dist/compose/docker-compose-anvil.yaml +1 -1
- package/dist/compose/docker-compose-explorer.yaml +6 -5
- package/dist/compose/docker-compose-node.yaml +1 -4
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -2
- package/dist/exec/cartesi-machine.js +1 -1
- package/dist/exec/rollups.d.ts +94 -5
- package/dist/exec/rollups.d.ts.map +1 -1
- package/dist/exec/rollups.js +356 -12
- package/dist/index.js +5 -7
- package/dist/prompts.d.ts +12 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +58 -23
- package/dist/wallet.d.ts +15948 -21
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.js +33 -221
- package/package.json +24 -23
- package/dist/commands/send/eip712.d.ts +0 -34
- package/dist/commands/send/eip712.d.ts.map +0 -1
- package/dist/commands/send/eip712.js +0 -81
- package/dist/commands/send/erc20.d.ts +0 -12
- package/dist/commands/send/erc20.d.ts.map +0 -1
- package/dist/commands/send/erc20.js +0 -75
- package/dist/commands/send/erc721.d.ts +0 -12
- package/dist/commands/send/erc721.d.ts.map +0 -1
- package/dist/commands/send/erc721.js +0 -78
- package/dist/commands/send/ether.d.ts +0 -12
- package/dist/commands/send/ether.d.ts.map +0 -1
- package/dist/commands/send/ether.js +0 -36
- package/dist/commands/send/generic.d.ts +0 -15
- package/dist/commands/send/generic.d.ts.map +0 -1
- package/dist/commands/send/generic.js +0 -122
- package/dist/commands/start.d.ts +0 -14
- package/dist/commands/start.d.ts.map +0 -1
- package/dist/commands/start.js +0 -220
- package/dist/commands/stop.d.ts +0 -5
- package/dist/commands/stop.d.ts.map +0 -1
- package/dist/commands/stop.js +0 -27
- package/dist/compose/docker-compose-espresso.yaml +0 -81
package/dist/wallet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAER,OAAO,EACP,KAAK,EACL,GAAG,EAEH,YAAY,EAEZ,YAAY,EACf,MAAM,MAAM,CAAC;AAsBd,MAAM,MAAM,sBAAsB,GAAG;IACjC,aAAa,CAAC,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
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
if (includeMainnets) {
|
|
19
|
-
chains.push(arbitrum, base, mainnet, optimism);
|
|
20
|
-
}
|
|
21
|
-
return chains;
|
|
22
|
-
};
|
|
23
|
-
export const DEFAULT_DEVNET_MNEMONIC = "test test test test test test test test test test test junk";
|
|
24
|
-
const walletChoices = (chain) => {
|
|
25
|
-
const dev = chain.id === cannon.id;
|
|
26
|
-
return [
|
|
27
|
-
{
|
|
28
|
-
name: `Mnemonic${dev ? "" : chalk.red(" (UNSAFE)")}`,
|
|
29
|
-
value: "mnemonic",
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: `Private Key${dev ? "" : chalk.red(" (UNSAFE)")}`,
|
|
33
|
-
value: "private-key",
|
|
34
|
-
},
|
|
35
|
-
];
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Test if a RPC URL for a chain is working
|
|
39
|
-
* @param chain chain to test
|
|
40
|
-
* @param url url to test
|
|
41
|
-
* @returns true if the RPC URL is valid and chainId matches, false otherwise
|
|
42
|
-
*/
|
|
43
|
-
const testChainUrl = async (chain, url) => {
|
|
2
|
+
import { createTestClient, defineChain, http, publicActions, walletActions, } from "viem";
|
|
3
|
+
import { cannon } from "viem/chains";
|
|
4
|
+
import { getProjectName } from "./base.js";
|
|
5
|
+
import { PREFERRED_PORT } from "./config.js";
|
|
6
|
+
import { getProjectPort } from "./exec/rollups.js";
|
|
7
|
+
export const cartesi = defineChain({
|
|
8
|
+
...cannon,
|
|
9
|
+
name: "Cartesi Devnet",
|
|
10
|
+
testnet: true,
|
|
11
|
+
});
|
|
12
|
+
const getRpcUrl = async (options) => {
|
|
13
|
+
// if rpcUrl is provided, use it
|
|
14
|
+
if (options.rpcUrl)
|
|
15
|
+
return options.rpcUrl;
|
|
16
|
+
// otherwise, try to resolve host:port of the docker project
|
|
44
17
|
try {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
const chainId = await publicClient.getChainId();
|
|
50
|
-
return chainId === chain.id;
|
|
18
|
+
const projectName = getProjectName(options);
|
|
19
|
+
const host = await getProjectPort({ projectName });
|
|
20
|
+
return `http://${host}/anvil`;
|
|
51
21
|
}
|
|
52
22
|
catch (e) {
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Test if the default RPC URL for a chain is working
|
|
58
|
-
* @param chain chain to test
|
|
59
|
-
* @returns true if the default RPC URL is valid, false otherwise
|
|
60
|
-
*/
|
|
61
|
-
const testDefaultPublicClient = async (chain) => {
|
|
62
|
-
return testChainUrl(chain, chain.rpcUrls.default.http[0]);
|
|
63
|
-
};
|
|
64
|
-
const selectChain = async (options) => {
|
|
65
|
-
// if development mode, include anvil as an option
|
|
66
|
-
const chains = supportedChains({ includeDevnet: true });
|
|
67
|
-
if (options.chain) {
|
|
68
|
-
const chain = options.chain;
|
|
69
|
-
if (chains.findIndex((c) => c.id === chain.id) >= 0) {
|
|
70
|
-
return options.chain;
|
|
71
|
-
}
|
|
72
|
-
throw new Error(`Unsupported chainId ${options.chain.id}`);
|
|
73
|
-
}
|
|
74
|
-
// allow user to select from list
|
|
75
|
-
const choices = chains.map((chain) => ({
|
|
76
|
-
name: chain.name,
|
|
77
|
-
value: chain,
|
|
78
|
-
}));
|
|
79
|
-
return await selectAuto({
|
|
80
|
-
message: "Chain",
|
|
81
|
-
choices,
|
|
82
|
-
pageSize: choices.length,
|
|
83
|
-
discardDisabled: true,
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
const selectTransport = async (options, chain) => {
|
|
87
|
-
// use user provided url (in args) or try to use default one from chain, or ask for one
|
|
88
|
-
if (options.rpcUrl) {
|
|
89
|
-
return http(options.rpcUrl);
|
|
90
|
-
}
|
|
91
|
-
const defaultUrl = chain.rpcUrls.default.http[0];
|
|
92
|
-
// if the chain is cannon and URL is valid, use it without asking the user
|
|
93
|
-
if (chain.id === cannon.id) {
|
|
94
|
-
const port = 6751; // XXX: how to get environment port?
|
|
95
|
-
const url = `http://127.0.0.1:${port}/anvil`;
|
|
96
|
-
if (await testChainUrl(chain, url)) {
|
|
97
|
-
return http(url);
|
|
98
|
-
}
|
|
99
|
-
if (await testDefaultPublicClient(chain)) {
|
|
100
|
-
return http(defaultUrl);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
const url = await input({
|
|
104
|
-
message: "RPC URL",
|
|
105
|
-
default: defaultUrl,
|
|
106
|
-
});
|
|
107
|
-
return http(url);
|
|
108
|
-
};
|
|
109
|
-
const createPublicClient = async (chain, transport) => {
|
|
110
|
-
const publicClient = viemCreatePublicClient({ transport, chain });
|
|
111
|
-
// check if chainId matches
|
|
112
|
-
const chainId = await publicClient.getChainId();
|
|
113
|
-
if (chainId !== chain.id) {
|
|
114
|
-
throw new Error(`Chain of provided RPC URL (${chainId}) does not match selected chain (${chain.id}))`);
|
|
115
|
-
}
|
|
116
|
-
return publicClient;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Format the balance of an account for display
|
|
120
|
-
* @param account account to format the balance for
|
|
121
|
-
* @param publicClient client to query the balance
|
|
122
|
-
* @returns formatted balance string
|
|
123
|
-
*/
|
|
124
|
-
const addressBalanceLabel = async (address, publicClient) => {
|
|
125
|
-
const chain = publicClient.chain;
|
|
126
|
-
if (chain) {
|
|
127
|
-
// query balance using provider
|
|
128
|
-
const balance = await publicClient.getBalance({ address });
|
|
129
|
-
// format balance
|
|
130
|
-
const symbol = chain.nativeCurrency.symbol;
|
|
131
|
-
const balanceStr = formatUnits(balance, chain.nativeCurrency.decimals);
|
|
132
|
-
let balanceLabel = chalk.bold(`${balanceStr} ${symbol}`);
|
|
133
|
-
// display in red if balance is zero
|
|
134
|
-
if (balance === 0n) {
|
|
135
|
-
balanceLabel = chalk.red(balanceLabel);
|
|
136
|
-
}
|
|
137
|
-
return `${address} ${balanceLabel}`;
|
|
138
|
-
}
|
|
139
|
-
return address;
|
|
140
|
-
};
|
|
141
|
-
const createWalletClient = async (options, chain, publicClient, publicTransport) => {
|
|
142
|
-
if (options.privateKey) {
|
|
143
|
-
// private key specified
|
|
144
|
-
const account = privateKeyToAccount(options.privateKey);
|
|
145
|
-
return viemCreateWalletClient({
|
|
146
|
-
account,
|
|
147
|
-
transport: publicTransport,
|
|
148
|
-
chain,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
if (options.mnemonicPassphrase) {
|
|
152
|
-
// mnemonic specified
|
|
153
|
-
const account = mnemonicToAccount(options.mnemonicPassphrase, {
|
|
154
|
-
addressIndex: options.mnemonicIndex,
|
|
155
|
-
});
|
|
156
|
-
// create wallet client
|
|
157
|
-
return viemCreateWalletClient({
|
|
158
|
-
account,
|
|
159
|
-
transport: publicTransport,
|
|
160
|
-
chain,
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
const wallets = walletChoices(chain);
|
|
164
|
-
const wallet = await selectAuto({
|
|
165
|
-
message: "Wallet",
|
|
166
|
-
choices: wallets,
|
|
167
|
-
discardDisabled: true,
|
|
168
|
-
});
|
|
169
|
-
if (wallet === "mnemonic") {
|
|
170
|
-
// use the publicClient transport
|
|
171
|
-
const mnemonic = await input({
|
|
172
|
-
message: "Mnemonic",
|
|
173
|
-
default: chain.id === cannon.id ? DEFAULT_DEVNET_MNEMONIC : undefined,
|
|
174
|
-
});
|
|
175
|
-
// select account from mnemonic
|
|
176
|
-
if (options.mnemonicIndex) {
|
|
177
|
-
return viemCreateWalletClient({
|
|
178
|
-
transport: publicTransport,
|
|
179
|
-
chain,
|
|
180
|
-
account: mnemonicToAccount(mnemonic, {
|
|
181
|
-
addressIndex: options.mnemonicIndex,
|
|
182
|
-
}),
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
const choices = await Promise.all([...Array(10)].map(async (_, addressIndex) => {
|
|
186
|
-
const account = mnemonicToAccount(mnemonic, {
|
|
187
|
-
addressIndex,
|
|
188
|
-
});
|
|
189
|
-
const name = await addressBalanceLabel(account.address, publicClient);
|
|
190
|
-
return { name, value: account };
|
|
191
|
-
}));
|
|
192
|
-
const account = await selectAuto({
|
|
193
|
-
message: "Account",
|
|
194
|
-
choices,
|
|
195
|
-
pageSize: choices.length,
|
|
196
|
-
});
|
|
197
|
-
return viemCreateWalletClient({
|
|
198
|
-
transport: publicTransport,
|
|
199
|
-
chain,
|
|
200
|
-
account,
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
if (wallet === "private-key") {
|
|
204
|
-
const privateKey = await hexInput({ message: "Private Key" });
|
|
205
|
-
const account = privateKeyToAccount(privateKey);
|
|
206
|
-
return viemCreateWalletClient({
|
|
207
|
-
transport: publicTransport,
|
|
208
|
-
chain,
|
|
209
|
-
account,
|
|
23
|
+
return await input({
|
|
24
|
+
message: "RPC URL",
|
|
25
|
+
default: `http://127.0.0.1:${PREFERRED_PORT}/anvil`,
|
|
210
26
|
});
|
|
211
27
|
}
|
|
212
|
-
throw new Error(`Unsupported wallet ${wallet}`);
|
|
213
28
|
};
|
|
214
|
-
const
|
|
215
|
-
//
|
|
216
|
-
const
|
|
217
|
-
//
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
walletClient,
|
|
227
|
-
};
|
|
29
|
+
export const connect = async (options) => {
|
|
30
|
+
// resolve rpc url
|
|
31
|
+
const rpcUrl = await getRpcUrl(options);
|
|
32
|
+
// create test client
|
|
33
|
+
const client = createTestClient({
|
|
34
|
+
chain: cartesi,
|
|
35
|
+
mode: "anvil",
|
|
36
|
+
transport: http(rpcUrl),
|
|
37
|
+
})
|
|
38
|
+
.extend(publicActions)
|
|
39
|
+
.extend(walletActions);
|
|
40
|
+
return client;
|
|
228
41
|
};
|
|
229
|
-
export default createClients;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cartesi/cli",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.15",
|
|
4
4
|
"description": "Cartesi CLI",
|
|
5
5
|
"author": "Danilo Tuler <tuler@pobox.com>",
|
|
6
6
|
"bin": {
|
|
@@ -17,56 +17,57 @@
|
|
|
17
17
|
"/npm-shrinkwrap.json"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@commander-js/extra-typings": "^
|
|
21
|
-
"@inquirer/confirm": "^5.1.
|
|
22
|
-
"@inquirer/core": "^10.1.
|
|
23
|
-
"@inquirer/input": "^4.1.
|
|
24
|
-
"@inquirer/select": "^4.
|
|
25
|
-
"@inquirer/type": "^3.0.
|
|
20
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
21
|
+
"@inquirer/confirm": "^5.1.12",
|
|
22
|
+
"@inquirer/core": "^10.1.13",
|
|
23
|
+
"@inquirer/input": "^4.1.12",
|
|
24
|
+
"@inquirer/select": "^4.2.3",
|
|
25
|
+
"@inquirer/type": "^3.0.7",
|
|
26
26
|
"bytes": "^3.1.2",
|
|
27
27
|
"chalk": "^5.4.1",
|
|
28
28
|
"cli-table3": "^0.6.5",
|
|
29
|
-
"commander": "^
|
|
30
|
-
"execa": "^9.
|
|
29
|
+
"commander": "^14.0.0",
|
|
30
|
+
"execa": "^9.6.0",
|
|
31
31
|
"fs-extra": "^11.3.0",
|
|
32
|
+
"get-port": "^7.1.0",
|
|
32
33
|
"giget": "^2.0.0",
|
|
33
|
-
"listr2": "^8.
|
|
34
|
+
"listr2": "^8.3.3",
|
|
34
35
|
"lookpath": "^1.2.3",
|
|
35
|
-
"open": "^10.1.
|
|
36
|
+
"open": "^10.1.2",
|
|
36
37
|
"ora": "^8.2.0",
|
|
37
38
|
"p-retry": "^6.2.1",
|
|
38
39
|
"progress-stream": "^2.0.0",
|
|
39
|
-
"semver": "^7.7.
|
|
40
|
-
"smol-toml": "^1.3.
|
|
40
|
+
"semver": "^7.7.2",
|
|
41
|
+
"smol-toml": "^1.3.4",
|
|
41
42
|
"tmp": "^0.2.3",
|
|
42
|
-
"viem": "^2.
|
|
43
|
+
"viem": "^2.31.3"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@biomejs/biome": "^1.9.4",
|
|
46
47
|
"@cartesi/devnet": "2.0.0-alpha.7",
|
|
47
|
-
"@cartesi/rollups": "2.0.
|
|
48
|
+
"@cartesi/rollups": "2.0.1",
|
|
48
49
|
"@types/bytes": "^3.1.5",
|
|
49
50
|
"@types/fs-extra": "^11.0.4",
|
|
50
|
-
"@types/inquirer": "^9.0.
|
|
51
|
-
"@types/node": "^
|
|
51
|
+
"@types/inquirer": "^9.0.8",
|
|
52
|
+
"@types/node": "^24.0.3",
|
|
52
53
|
"@types/node-fetch": "^2.6.12",
|
|
53
54
|
"@types/progress-stream": "^2.0.5",
|
|
54
55
|
"@types/prompts": "^2.4.9",
|
|
55
|
-
"@types/semver": "^7.
|
|
56
|
+
"@types/semver": "^7.7.0",
|
|
56
57
|
"@types/tmp": "^0.2.6",
|
|
57
|
-
"@vitest/coverage-istanbul": "^2.
|
|
58
|
-
"@wagmi/cli": "^2.
|
|
58
|
+
"@vitest/coverage-istanbul": "^3.2.3",
|
|
59
|
+
"@wagmi/cli": "^2.3.1",
|
|
59
60
|
"copyfiles": "^2.4.1",
|
|
60
61
|
"npm-run-all": "^4.1.5",
|
|
61
62
|
"rimraf": "^6.0.1",
|
|
62
63
|
"ts-node": "^10.9.2",
|
|
63
64
|
"tslib": "^2.8.1",
|
|
64
|
-
"typescript": "^5.8.
|
|
65
|
-
"vitest": "^2.
|
|
65
|
+
"typescript": "^5.8.3",
|
|
66
|
+
"vitest": "^3.2.3",
|
|
66
67
|
"tsconfig": "0.0.0"
|
|
67
68
|
},
|
|
68
69
|
"engines": {
|
|
69
|
-
"node": ">=
|
|
70
|
+
"node": ">=20.0.0"
|
|
70
71
|
},
|
|
71
72
|
"bugs": "https://github.com/cartesi/cli/issues",
|
|
72
73
|
"types": "dist/index.d.ts",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Hex, WalletClient } from "viem";
|
|
2
|
-
import type { Address } from "viem/accounts";
|
|
3
|
-
type SendOptions = {
|
|
4
|
-
eip712TxUrl: string;
|
|
5
|
-
chainId: number;
|
|
6
|
-
maxGasPrice: number;
|
|
7
|
-
};
|
|
8
|
-
export declare const DEFAULT_SEND_CONFIG: Readonly<SendOptions>;
|
|
9
|
-
type TypedData = {
|
|
10
|
-
domain: {
|
|
11
|
-
name: string;
|
|
12
|
-
version: string;
|
|
13
|
-
chainId: number;
|
|
14
|
-
verifyingContract: Address;
|
|
15
|
-
};
|
|
16
|
-
types: Record<string, {
|
|
17
|
-
name: string;
|
|
18
|
-
type: string;
|
|
19
|
-
}[]>;
|
|
20
|
-
primaryType: string;
|
|
21
|
-
message: Record<string, unknown>;
|
|
22
|
-
};
|
|
23
|
-
/** Fetches the nonce for a given user and application */
|
|
24
|
-
export declare const getNonceForEip712: (application: Address, user: Address, sendOptions: SendOptions) => Promise<number>;
|
|
25
|
-
/** Submits a transaction to L2 */
|
|
26
|
-
export declare const postEip712Transaction: (data: Record<string, unknown>, sendOptions: SendOptions) => Promise<{
|
|
27
|
-
id: string;
|
|
28
|
-
}>;
|
|
29
|
-
/** Creates a Typed Data object for signing */
|
|
30
|
-
export declare const createEip712TypedData: (app: Address, data: Hex, nonce: number, sendOptions: SendOptions) => Promise<TypedData>;
|
|
31
|
-
/** Sends a transaction to L2 */
|
|
32
|
-
export declare const sendEip712: (walletClient: WalletClient, applicationAddress: Address, payload: Hex, sendOptions?: Partial<SendOptions>) => Promise<string>;
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=eip712.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eip712.d.ts","sourceRoot":"","sources":["../../../src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,MAAM,UAAU,GACnB,cAAc,YAAY,EAC1B,oBAAoB,OAAO,EAC3B,SAAS,GAAG,EACZ,cAAc,OAAO,CAAC,WAAW,CAAC,KACnC,OAAO,CAAC,MAAM,CAyBhB,CAAC"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_SEND_CONFIG = {
|
|
2
|
-
eip712TxUrl: "http://127.0.0.1:6751/transaction",
|
|
3
|
-
chainId: 31337,
|
|
4
|
-
maxGasPrice: 10,
|
|
5
|
-
};
|
|
6
|
-
const fetchJSON = async (url, options) => {
|
|
7
|
-
const response = await fetch(url, options);
|
|
8
|
-
if (!response.ok) {
|
|
9
|
-
throw new Error(`HTTP Error: ${response.status} - ${await response.text()}`);
|
|
10
|
-
}
|
|
11
|
-
return response.json();
|
|
12
|
-
};
|
|
13
|
-
const serializeBigInt = (_key, value) => typeof value === "bigint" ? value.toString() : value;
|
|
14
|
-
const createTypedDataTemplate = (chainId, verifyingContract) => ({
|
|
15
|
-
domain: {
|
|
16
|
-
name: "Cartesi",
|
|
17
|
-
version: "0.1.0",
|
|
18
|
-
chainId,
|
|
19
|
-
verifyingContract,
|
|
20
|
-
},
|
|
21
|
-
types: {
|
|
22
|
-
EIP712Domain: [
|
|
23
|
-
{ name: "name", type: "string" },
|
|
24
|
-
{ name: "version", type: "string" },
|
|
25
|
-
{ name: "chainId", type: "uint256" },
|
|
26
|
-
{ name: "verifyingContract", type: "address" },
|
|
27
|
-
],
|
|
28
|
-
CartesiMessage: [
|
|
29
|
-
{ name: "app", type: "address" },
|
|
30
|
-
{ name: "nonce", type: "uint64" },
|
|
31
|
-
{ name: "max_gas_price", type: "uint128" },
|
|
32
|
-
{ name: "data", type: "bytes" },
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
primaryType: "CartesiMessage",
|
|
36
|
-
message: {},
|
|
37
|
-
});
|
|
38
|
-
/** Fetches the nonce for a given user and application */
|
|
39
|
-
export const getNonceForEip712 = async (application, user, sendOptions) => {
|
|
40
|
-
return fetchJSON(`${sendOptions.eip712TxUrl}/nonce`, {
|
|
41
|
-
method: "POST",
|
|
42
|
-
headers: { "Content-Type": "application/json" },
|
|
43
|
-
body: JSON.stringify({ msg_sender: user, app_contract: application }),
|
|
44
|
-
}).then((res) => res.nonce);
|
|
45
|
-
};
|
|
46
|
-
/** Submits a transaction to L2 */
|
|
47
|
-
export const postEip712Transaction = async (data, sendOptions) => {
|
|
48
|
-
return fetchJSON(`${sendOptions.eip712TxUrl}/submit`, {
|
|
49
|
-
method: "POST",
|
|
50
|
-
headers: { "Content-Type": "application/json" },
|
|
51
|
-
body: JSON.stringify(data, serializeBigInt),
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
/** Creates a Typed Data object for signing */
|
|
55
|
-
export const createEip712TypedData = async (app, data, nonce, sendOptions) => {
|
|
56
|
-
return {
|
|
57
|
-
...createTypedDataTemplate(sendOptions.chainId, app),
|
|
58
|
-
message: {
|
|
59
|
-
app,
|
|
60
|
-
nonce,
|
|
61
|
-
data,
|
|
62
|
-
max_gas_price: BigInt(sendOptions.maxGasPrice),
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
/** Sends a transaction to L2 */
|
|
67
|
-
export const sendEip712 = async (walletClient, applicationAddress, payload, sendOptions) => {
|
|
68
|
-
if (!walletClient.account) {
|
|
69
|
-
throw new Error("Wallet account is missing.");
|
|
70
|
-
}
|
|
71
|
-
const options = { ...DEFAULT_SEND_CONFIG, ...sendOptions };
|
|
72
|
-
const account = walletClient.account.address;
|
|
73
|
-
const nonce = await getNonceForEip712(applicationAddress, account, options);
|
|
74
|
-
const typedData = await createEip712TypedData(applicationAddress, payload, nonce, options);
|
|
75
|
-
const signature = await walletClient.signTypedData({
|
|
76
|
-
account,
|
|
77
|
-
...typedData,
|
|
78
|
-
});
|
|
79
|
-
const { id } = await postEip712Transaction({ typedData, account, signature }, options);
|
|
80
|
-
return id;
|
|
81
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Command } from "@commander-js/extra-typings";
|
|
2
|
-
export declare const createErc20Command: () => Command<[], {
|
|
3
|
-
token?: string | undefined;
|
|
4
|
-
amount?: string | undefined;
|
|
5
|
-
}, {
|
|
6
|
-
chainId: number;
|
|
7
|
-
rpcUrl?: string | undefined;
|
|
8
|
-
mnemonic?: string | undefined;
|
|
9
|
-
mnemonicIndex: number;
|
|
10
|
-
dapp?: `0x${string}` | undefined;
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=erc20.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"erc20.d.ts","sourceRoot":"","sources":["../../../src/commands/send/erc20.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AA8DtD,eAAO,MAAM,kBAAkB;;;;;;;;;EAgD9B,CAAC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Command } from "@commander-js/extra-typings";
|
|
2
|
-
import input from "@inquirer/input";
|
|
3
|
-
import ora from "ora";
|
|
4
|
-
import { erc20Abi, getAddress, isAddress, parseEther, } from "viem";
|
|
5
|
-
import { erc20PortalAbi, erc20PortalAddress } from "../../contracts.js";
|
|
6
|
-
import { connect, getInputApplicationAddress, } from "../send.js";
|
|
7
|
-
const readToken = async (publicClient, address) => {
|
|
8
|
-
const args = { abi: erc20Abi, address };
|
|
9
|
-
const symbol = await publicClient.readContract({
|
|
10
|
-
...args,
|
|
11
|
-
functionName: "symbol",
|
|
12
|
-
});
|
|
13
|
-
const name = await publicClient.readContract({
|
|
14
|
-
...args,
|
|
15
|
-
functionName: "name",
|
|
16
|
-
});
|
|
17
|
-
const decimals = await publicClient.readContract({
|
|
18
|
-
...args,
|
|
19
|
-
functionName: "decimals",
|
|
20
|
-
});
|
|
21
|
-
return {
|
|
22
|
-
name,
|
|
23
|
-
symbol,
|
|
24
|
-
decimals,
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
const ercValidator = (publicClient) => async (value) => {
|
|
28
|
-
if (!isAddress(value)) {
|
|
29
|
-
return "Invalid address";
|
|
30
|
-
}
|
|
31
|
-
try {
|
|
32
|
-
await readToken(publicClient, value);
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
return "Invalid token";
|
|
36
|
-
}
|
|
37
|
-
return true;
|
|
38
|
-
};
|
|
39
|
-
export const createErc20Command = () => {
|
|
40
|
-
return new Command("erc20")
|
|
41
|
-
.description("Sends ERC-20 deposits to the application, optionally in interactive mode.")
|
|
42
|
-
.configureHelp({ showGlobalOptions: true })
|
|
43
|
-
.option("--token <address>", "token address")
|
|
44
|
-
.option("--amount <number>", "amount to send")
|
|
45
|
-
.action(async (options, command) => {
|
|
46
|
-
const sendOptions = command.optsWithGlobals();
|
|
47
|
-
// connect to RPC provider
|
|
48
|
-
const { publicClient, walletClient } = await connect(sendOptions);
|
|
49
|
-
// get dapp address from local node, or ask
|
|
50
|
-
const applicationAddress = await getInputApplicationAddress(sendOptions.dapp);
|
|
51
|
-
const tokenAddress = options.token && isAddress(options.token)
|
|
52
|
-
? getAddress(options.token)
|
|
53
|
-
: (await input({
|
|
54
|
-
message: "Token address",
|
|
55
|
-
validate: ercValidator(publicClient),
|
|
56
|
-
}));
|
|
57
|
-
const amount = options.amount || (await input({ message: "Amount" }));
|
|
58
|
-
const { request } = await publicClient.simulateContract({
|
|
59
|
-
address: erc20PortalAddress,
|
|
60
|
-
abi: erc20PortalAbi,
|
|
61
|
-
functionName: "depositERC20Tokens",
|
|
62
|
-
args: [
|
|
63
|
-
tokenAddress,
|
|
64
|
-
applicationAddress,
|
|
65
|
-
parseEther(amount), // XXX: we need to use the token decimals here!
|
|
66
|
-
"0x",
|
|
67
|
-
],
|
|
68
|
-
account: walletClient.account,
|
|
69
|
-
});
|
|
70
|
-
const hash = await walletClient.writeContract(request);
|
|
71
|
-
const progress = ora("Sending input...").start();
|
|
72
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
73
|
-
progress.succeed(`Input sent: ${hash}`);
|
|
74
|
-
});
|
|
75
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Command } from "@commander-js/extra-typings";
|
|
2
|
-
export declare const createErc721Command: () => Command<[], {
|
|
3
|
-
token?: string | undefined;
|
|
4
|
-
tokenId?: string | undefined;
|
|
5
|
-
}, {
|
|
6
|
-
chainId: number;
|
|
7
|
-
rpcUrl?: string | undefined;
|
|
8
|
-
mnemonic?: string | undefined;
|
|
9
|
-
mnemonicIndex: number;
|
|
10
|
-
dapp?: `0x${string}` | undefined;
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=erc721.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"erc721.d.ts","sourceRoot":"","sources":["../../../src/commands/send/erc721.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAuDtD,eAAO,MAAM,mBAAmB;;;;;;;;;EAuD/B,CAAC"}
|