dequanto 0.2.50 → 0.2.51
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/lib/cjs/explorer/BlockchainExplorer.js +9 -9
- package/lib/cjs/explorer/BlockchainExplorer.js.map +1 -1
- package/lib/cjs/explorer/BlockchainExplorerFactory.js +1 -1
- package/lib/cjs/explorer/BlockchainExplorerFactory.js.map +1 -1
- package/lib/cjs/explorer/BlockchainExplorerProvider.js +1 -1
- package/lib/cjs/explorer/BlockchainExplorerProvider.js.map +1 -1
- package/lib/cjs/explorer/BlockchainExplorerStorage.js +2 -2
- package/lib/cjs/explorer/BlockchainExplorerStorage.js.map +1 -1
- package/lib/cjs/explorer/ContractVerifier.js +10 -10
- package/lib/cjs/explorer/ContractVerifier.js.map +1 -1
- package/lib/cjs/explorer/verifiers/FsHtmlVerifier.js +1 -1
- package/lib/cjs/explorer/verifiers/FsHtmlVerifier.js.map +1 -1
- package/lib/esm/explorer/BlockchainExplorer.js.map +1 -1
- package/lib/esm/explorer/BlockchainExplorer.mjs +9 -9
- package/lib/esm/explorer/BlockchainExplorerFactory.js.map +1 -1
- package/lib/esm/explorer/BlockchainExplorerFactory.mjs +1 -1
- package/lib/esm/explorer/BlockchainExplorerProvider.js.map +1 -1
- package/lib/esm/explorer/BlockchainExplorerProvider.mjs +1 -1
- package/lib/esm/explorer/BlockchainExplorerStorage.js.map +1 -1
- package/lib/esm/explorer/BlockchainExplorerStorage.mjs +2 -2
- package/lib/esm/explorer/ContractVerifier.js.map +1 -1
- package/lib/esm/explorer/ContractVerifier.mjs +10 -10
- package/lib/esm/explorer/verifiers/FsHtmlVerifier.js.map +1 -1
- package/lib/esm/explorer/verifiers/FsHtmlVerifier.mjs +1 -1
- package/lib/types/explorer/BlockchainExplorerFactory.d.ts +1 -1
- package/package.json +1 -1
- package/skills/README.md +45 -0
- package/{docs/ai → skills/dequanto}/INDEX.md +12 -2
- package/{docs/ai/skill → skills}/dequanto/SKILL.md +27 -17
- package/{docs/ai → skills/dequanto}/examples/config.spec.ts +5 -5
- package/{docs/ai → skills/dequanto}/examples/contract-read.spec.ts +7 -7
- package/{docs/ai → skills/dequanto}/examples/contract-write.spec.ts +7 -7
- package/{docs/ai → skills/dequanto}/examples/deploy-contract.spec.ts +5 -5
- package/{docs/ai → skills/dequanto}/examples/erc4337-userop.spec.ts +7 -7
- package/{docs/ai → skills/dequanto}/examples/explorer-abi.spec.ts +3 -3
- package/{docs/ai → skills/dequanto}/examples/generate-contract-class.spec.ts +2 -2
- package/skills/dequanto/examples/hardhat-debug.spec.ts +29 -0
- package/skills/dequanto/examples/hardhat-fork.spec.ts +31 -0
- package/{docs/ai → skills/dequanto}/examples/index-events.spec.ts +4 -4
- package/{docs/ai → skills/dequanto}/examples/rpc-read.spec.ts +21 -4
- package/{docs/ai → skills/dequanto}/examples/safe-batch.spec.ts +6 -6
- package/{docs/ai → skills/dequanto}/examples/send-transaction.spec.ts +7 -7
- package/skills/dequanto/examples/storage.spec.ts +58 -0
- package/{docs/ai → skills/dequanto}/examples/token-transfer.spec.ts +5 -5
- package/skills/dequanto/examples/utils.spec.ts +63 -0
- package/{docs/ai → skills/dequanto}/references/contracts.md +1 -1
- package/{docs/ai → skills/dequanto}/references/deployments.md +4 -2
- package/{docs/ai → skills/dequanto}/references/events-indexing.md +1 -1
- package/{docs/ai → skills/dequanto}/references/explorer.md +1 -1
- package/{docs/ai → skills/dequanto}/references/generation.md +6 -6
- package/skills/dequanto/references/hardhat.md +113 -0
- package/{docs/ai → skills/dequanto}/references/rpc-clients.md +25 -5
- package/{docs/ai → skills/dequanto}/references/safe-erc4337.md +2 -2
- package/skills/dequanto/references/storage.md +122 -0
- package/{docs/ai → skills/dequanto}/references/tokens-accounts.md +12 -6
- package/{docs/ai → skills/dequanto}/references/transactions.md +6 -4
- package/skills/dequanto/references/utils.md +131 -0
- package/src/explorer/BlockchainExplorer.ts +9 -9
- package/src/explorer/BlockchainExplorerFactory.ts +1 -1
- package/src/explorer/BlockchainExplorerProvider.ts +1 -1
- package/src/explorer/BlockchainExplorerStorage.ts +2 -2
- package/src/explorer/ContractVerifier.ts +10 -10
- package/src/explorer/verifiers/FsHtmlVerifier.ts +1 -1
- package/tsconfig.json +2 -1
- package/docs/ai/examples/storage-read.spec.ts +0 -35
- package/docs/ai/references/storage.md +0 -93
- /package/{docs/ai → skills/dequanto}/references/migration-from-ethers-viem.md +0 -0
|
@@ -47,7 +47,7 @@ export class BlockchainExplorerStorage {
|
|
|
47
47
|
let $address = opts?.implementation ?? address;
|
|
48
48
|
let $contract = this.contracts[$address.toLowerCase()];
|
|
49
49
|
$require.notNull($contract, `Contract "${$address}" not found`);
|
|
50
|
-
// @TODO: L1:
|
|
50
|
+
// @TODO: L1: Return ABI as JSON. *scan providers should serialize it earlier.
|
|
51
51
|
return {
|
|
52
52
|
implementation: $address,
|
|
53
53
|
abi: JSON.stringify($contract.abi)
|
|
@@ -57,7 +57,7 @@ export class BlockchainExplorerStorage {
|
|
|
57
57
|
let _address = address;
|
|
58
58
|
let _contract = this.contracts[_address.toLowerCase()];
|
|
59
59
|
$require.notNull(_contract, `Contract "${_address}" not found`);
|
|
60
|
-
// @TODO: L1:
|
|
60
|
+
// @TODO: L1: Return ABI as JSON. *scan providers should serialize it earlier.
|
|
61
61
|
return {
|
|
62
62
|
SourceCode: {
|
|
63
63
|
contractName: _contract.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractVerifier.js","sourceRoot":"","sources":["../../../src/explorer/ContractVerifier.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,qCAA+B;AAE/B,2CAAuC;AAEvC,kFAA+E;AAE/E,mEAAgE;AAEhE,0EAAuE;AACvE,6CAA0C;AAC1C,iDAA8C;AAC9C,uDAAoD;AACpD,uDAAoD;AAEpD,yDAAsD;AACtD,uDAAoD;AAiBpD,MAAa,gBAAgB;IAEzB,YACW,WAAwB,EACxB,QAAmB,EACnB,SAA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CAAC,8BAA8B,MAAM,EAAE,CAAC,CAAC;gBACxD,OAAO,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aAC7C;YAAC,OAAO,CAAC,EAAE;gBACR,IAAI,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;gBACxB,IAAI,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;oBACnC,oBAAoB;oBACpB,OAAO,IAAI,CAAC;iBACf;gBACD,IAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;oBAClC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uDAAuD,IAAI,EAAE,CAAC,CAAC;oBAC/E,OAAO,KAAK,CAAC;iBAChB;gBACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,8BAA8B,OAAO,EAAE,CAAC,CAAC;gBACzD,MAAM,CAAC,CAAC;aACX;QACL,CAAC,EAAE;YACC,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,YAAY;SACxC,CAAC,CAAC;IACP,CAAC;CACJ;AA5QD,4CA4QC"}
|
|
@@ -17,7 +17,7 @@ export class ContractVerifier {
|
|
|
17
17
|
this.logger = logger;
|
|
18
18
|
}
|
|
19
19
|
async ensure(Ctor, opts = {}) {
|
|
20
|
-
this.logger.log(`
|
|
20
|
+
this.logger.log(`Submitting sources for ${typeof Ctor === 'string' ? Ctor : Ctor.name}`);
|
|
21
21
|
let status = await this.submit(Ctor, opts);
|
|
22
22
|
await this.waitForVerification(status, opts);
|
|
23
23
|
if ($is.Address(opts.proxyFor)) {
|
|
@@ -39,7 +39,7 @@ export class ContractVerifier {
|
|
|
39
39
|
catch (e) {
|
|
40
40
|
let message = e.message;
|
|
41
41
|
if (/verified/i.test(message)) {
|
|
42
|
-
//
|
|
42
|
+
// Already verified.
|
|
43
43
|
return true;
|
|
44
44
|
}
|
|
45
45
|
if (/(pending|queue)/i.test(message)) {
|
|
@@ -64,14 +64,14 @@ export class ContractVerifier {
|
|
|
64
64
|
address = deployment.implementation ?? deployment.address;
|
|
65
65
|
}
|
|
66
66
|
try {
|
|
67
|
-
this.logger.log(`Checking
|
|
67
|
+
this.logger.log(`Checking whether contract ${address} is already verified`);
|
|
68
68
|
let currentSources = await this.explorer.getContractSource(address);
|
|
69
69
|
if ($is.notEmpty(currentSources?.ContractName)) {
|
|
70
70
|
return { status: 'verified' };
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
catch (error) {
|
|
74
|
-
//
|
|
74
|
+
// Ignore pre-check errors and continue with verification.
|
|
75
75
|
}
|
|
76
76
|
let deployedBytecode = await client.getCode(address);
|
|
77
77
|
$require.True($is.HexBytes32(deployedBytecode), `Bytecode ${client.platform}:${address} is invalid: "${deployedBytecode}"`);
|
|
@@ -100,18 +100,18 @@ export class ContractVerifier {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
let jsonMetaPath = info.ctx.source.path;
|
|
103
|
-
$require.notEmpty(jsonMetaPath, `Deployment should return a path to compilation JSON`);
|
|
103
|
+
$require.notEmpty(jsonMetaPath, `Deployment should return a path to the compilation JSON`);
|
|
104
104
|
$require.True(await File.existsAsync(jsonMetaPath), `${jsonMetaPath} does not exist`);
|
|
105
105
|
let jsonMeta = await File.readAsync(jsonMetaPath);
|
|
106
106
|
let jsonMetaDbgPath = jsonMetaPath.replace('.json', '.dbg.json');
|
|
107
107
|
$require.True(await File.existsAsync(jsonMetaDbgPath), `${jsonMetaDbgPath} does not exist`);
|
|
108
108
|
let jsonMetaDbg = await File.readAsync(jsonMetaDbgPath);
|
|
109
109
|
let jsonMetaBuildInfoPath = jsonMetaDbg.buildInfo;
|
|
110
|
-
$require.notEmpty(jsonMetaPath, `${jsonMetaDbgPath} should contain the path to the
|
|
110
|
+
$require.notEmpty(jsonMetaPath, `${jsonMetaDbgPath} should contain the path to the build info JSON file`);
|
|
111
111
|
let buildInfoPath = new class_Uri(new class_Uri(jsonMetaPath).toDir()).combine(jsonMetaBuildInfoPath).toString();
|
|
112
112
|
$require.True(await File.existsAsync(buildInfoPath), `${buildInfoPath} does not exist`);
|
|
113
113
|
let buildInfo = await File.readAsync(buildInfoPath);
|
|
114
|
-
$require.notNull(buildInfo.solcLongVersion, `${buildInfoPath} should contain the "solcLongVersion"
|
|
114
|
+
$require.notNull(buildInfo.solcLongVersion, `${buildInfoPath} should contain the "solcLongVersion" value`);
|
|
115
115
|
let sources = await this.getSources(jsonMeta.sourceName);
|
|
116
116
|
let sourcesSerialized = JSON.stringify({
|
|
117
117
|
language: "Solidity",
|
|
@@ -119,7 +119,7 @@ export class ContractVerifier {
|
|
|
119
119
|
settings: buildInfo.input.settings
|
|
120
120
|
}, null, 4);
|
|
121
121
|
let sourcesSerializedWrapped = `${sourcesSerialized}`;
|
|
122
|
-
this.logger.log(`
|
|
122
|
+
this.logger.log(`Submitting ${jsonMeta.sourceName}:${jsonMeta.contractName} and dependencies to verify contract ${address}`);
|
|
123
123
|
try {
|
|
124
124
|
let guid = await this.explorer.submitContractVerification({
|
|
125
125
|
address: address,
|
|
@@ -168,7 +168,7 @@ export class ContractVerifier {
|
|
|
168
168
|
}).toArrayAsync({ threads: 4 });
|
|
169
169
|
}
|
|
170
170
|
await crawlSourceFile(new SourceFile(main));
|
|
171
|
-
this.logger.log(`Found ${Object.keys(sources).length} source files
|
|
171
|
+
this.logger.log(`Found ${Object.keys(sources).length} source files:`, Object.keys(sources));
|
|
172
172
|
return sources;
|
|
173
173
|
}
|
|
174
174
|
async submitProxy(opts) {
|
|
@@ -208,7 +208,7 @@ export class ContractVerifier {
|
|
|
208
208
|
catch (e) {
|
|
209
209
|
let message = e.message;
|
|
210
210
|
if (/verified|success/i.test(message)) {
|
|
211
|
-
//
|
|
211
|
+
// Already verified.
|
|
212
212
|
return true;
|
|
213
213
|
}
|
|
214
214
|
if (/(pending|queue)/i.test(message)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FsHtmlVerif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G,YAAY,CAAC,OAAO,EAAE,CAAC;IAC3C,CAAC;CACJ;AAtJD,wCAsJC"}
|
|
@@ -85,7 +85,7 @@ export class FsHtmlVerifier {
|
|
|
85
85
|
.replace('__apikey__', this.config.api.key ?? '')
|
|
86
86
|
.replace('__constructorArguements__', contractData.arguments?.replace(/^0x/, '') || '');
|
|
87
87
|
if (contractData.contractName.includes('Utils/Proxy')) {
|
|
88
|
-
//
|
|
88
|
+
// Rename duplicate Proxy contracts before writing the verification form.
|
|
89
89
|
html = html.replaceAll('contracts/Utils/Proxy.sol:Proxy', 'contracts/Utils/TUProxy.sol:TUProxy');
|
|
90
90
|
html = html.replace('Utils/Proxy.sol":', 'Utils/TUProxy.sol":');
|
|
91
91
|
html = html.replace('contract Proxy is ', 'contract TUProxy is ');
|
|
@@ -12,7 +12,7 @@ export declare namespace BlockchainExplorerFactory {
|
|
|
12
12
|
function get(config: TExplorerDefinition): IBlockchainExplorer;
|
|
13
13
|
/** @obsolete */
|
|
14
14
|
function get(platform: TPlatform | number, opts: IBlockchainExplorerFactoryParams): IBlockchainExplorer;
|
|
15
|
-
/** Same as
|
|
15
|
+
/** Same as the synchronous variant, but ensures the config has been fetched */
|
|
16
16
|
function getAsync(platform: TPlatform, opts?: IBlockchainExplorerFactoryParams): Promise<IBlockchainExplorer>;
|
|
17
17
|
/** @obsolete Create instance directly with the get/getAsync method */
|
|
18
18
|
function create(opts: IBlockchainExplorerFactoryParams): Constructor<IBlockchainExplorer>;
|
package/package.json
CHANGED
package/skills/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Install The Dequanto Skill
|
|
2
|
+
|
|
3
|
+
The portable skill is the complete [dequanto](dequanto/) directory. It includes `SKILL.md`, `INDEX.md`, `references/`, and `examples/`. It can stay in this repository; no separate repository or server is needed.
|
|
4
|
+
|
|
5
|
+
## Install From This Checkout
|
|
6
|
+
|
|
7
|
+
Run from the dequanto repository root in PowerShell:
|
|
8
|
+
|
|
9
|
+
```powershell
|
|
10
|
+
# Codex: available across your projects.
|
|
11
|
+
New-Item -ItemType Directory -Force "$HOME/.agents/skills" | Out-Null
|
|
12
|
+
Copy-Item -Recurse ./skills/dequanto "$HOME/.agents/skills/"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
For a project-specific Codex installation, copy the folder to `<project>/.agents/skills/dequanto`. For Claude Code, use `<project>/.claude/skills/dequanto`. Copy the entire folder, including its resources.
|
|
16
|
+
|
|
17
|
+
Use a destination where `dequanto` does not already exist. When updating, replace the previous skill directory with the new complete directory so removed resources do not remain.
|
|
18
|
+
|
|
19
|
+
In Codex, invoke `$dequanto` or let Codex select it for relevant tasks. Restart Codex if the installed skill does not appear. See the [Codex skill documentation](https://learn.chatgpt.com/docs/build-skills).
|
|
20
|
+
|
|
21
|
+
## Install From GitHub With Codex
|
|
22
|
+
|
|
23
|
+
After the skill directory has been committed and pushed, ask Codex:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
$skill-installer Install the dequanto skill from
|
|
27
|
+
https://github.com/0xweb-org/dequanto/tree/master/skills/dequanto
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Installation provides agent instructions and examples. Install the `dequanto` npm dependency separately in the project where you use it. Examples run as tests inside the dequanto repository. In other projects, adapt their generated-contract imports and fixture paths; see the skill index for prerequisites.
|
|
31
|
+
|
|
32
|
+
## Maintain And Test
|
|
33
|
+
|
|
34
|
+
Edit `skills/dequanto/SKILL.md`, `INDEX.md`, `references/`, and `examples/` directly. This directory is the single source of truth and the installable skill; no bundling or synchronization step is needed.
|
|
35
|
+
|
|
36
|
+
Use published `dequanto/...` imports. The repository test runner maps them to `src/...` through `tsconfig-build.json`, so examples exercise the current source.
|
|
37
|
+
|
|
38
|
+
Run a focused example from the repository root:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npx atma test skills/dequanto/examples/hardhat-debug.spec.ts
|
|
42
|
+
npm run typecheck -- --pretty false
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Examples using forks require RPC access; deployment and generation examples may also require the repository fixtures and Hardhat configuration.
|
|
@@ -11,7 +11,8 @@ Before using an unfamiliar dequanto API, verify the exact signature in `src/` or
|
|
|
11
11
|
| Goal | Use | Reference | Examples |
|
|
12
12
|
| --- | --- | --- | --- |
|
|
13
13
|
| Configure RPC endpoints, explorer keys, or custom chains | `Config.fetch`, `ConfigDefaults`, `RPC_<PLATFORM>` env vars, `blockchainExplorer` | `src/config/ConfigDefaults.ts` | `examples/config.spec.ts` |
|
|
14
|
-
| Create an RPC client
|
|
14
|
+
| Create an RPC client; read blocks, balances, logs, storage, or raw tx data; resolve blocks by date | `Web3ClientFactory`, `Web3Client`, `BlockDateResolver`, chain clients | `references/rpc-clients.md` | `examples/rpc-read.spec.ts` |
|
|
15
|
+
| Develop contracts or experiment on a Hardhat fork; impersonate accounts, change balances/storage, mine, or roll back | `Web3ClientFactory`, `client.debug`, `$erc20.setBalanceAny` | `references/hardhat.md` | `examples/hardhat-debug.spec.ts`, `examples/hardhat-fork.spec.ts` |
|
|
15
16
|
| Call a smart contract | generated contract classes extending `ContractBase`, or `ContractReader` for ad hoc ABI calls | `references/contracts.md` | `examples/contract-read.spec.ts` |
|
|
16
17
|
| Send a contract transaction | generated write methods returning `TxWriter`; use `$receipt()` when the receipt is needed | `references/contracts.md`, `references/transactions.md` | `examples/contract-write.spec.ts` |
|
|
17
18
|
| Generate typed contract classes | `Generator`, `HardhatProvider`, 0xweb-generated classes | `references/generation.md` | `examples/generate-contract-class.spec.ts` |
|
|
@@ -19,7 +20,8 @@ Before using an unfamiliar dequanto API, verify the exact signature in `src/` or
|
|
|
19
20
|
| Build, sign, save, submit, or inspect transactions | `TxDataBuilder`, `TxWriter`, `TokenTransferService` | `references/transactions.md` | `examples/send-transaction.spec.ts` |
|
|
20
21
|
| Fetch or cache historical contract events | generated `getPastLogs*` helpers or `EventsIndexer` | `references/events-indexing.md` | `examples/index-events.spec.ts` |
|
|
21
22
|
| Fetch ABI/source/creation data from an explorer | `BlockchainExplorerFactory`, `BlockchainExplorer`, `ContractAbiProvider` | `references/explorer.md` | `examples/explorer-abi.spec.ts` |
|
|
22
|
-
|
|
|
23
|
+
| Encode/decode ABI data, hash Solidity values, validate inputs, manipulate hex, work with dates, sign data, or capture promise errors | `$abi`, `$contract`, `$require`, `$hex`, `$date`, `$sig`, `$promise` | `references/utils.md` | `examples/utils.spec.ts` |
|
|
24
|
+
| Read Solidity storage, structs, mappings, arrays, or diamond storage | `SlotsParser`, `SlotsStorage`, generated storage readers | `references/storage.md` | `examples/storage.spec.ts` |
|
|
23
25
|
| Work with tokens and balances | `TokensService`, `TokensServiceFactory`, `TokenTransferService`, generated ERC20 wrappers | `references/tokens-accounts.md` | `examples/token-transfer.spec.ts` |
|
|
24
26
|
| Work with accounts, signing, Safe, or ERC-4337 | `ChainAccountService`, `$sig`, `GnosisSafeHandler`, `SafeTx`, `Erc4337Service`, `Erc4337TxWriter` | `references/safe-erc4337.md`, `references/tokens-accounts.md` | `examples/safe-batch.spec.ts`, `examples/erc4337-userop.spec.ts` |
|
|
25
27
|
| Convert code from ethers or viem habits | Use the dequanto equivalents instead of adding external clients | `references/migration-from-ethers-viem.md` | all examples |
|
|
@@ -32,6 +34,14 @@ Before using an unfamiliar dequanto API, verify the exact signature in `src/` or
|
|
|
32
34
|
- Tests under `test/` are often the best runnable examples.
|
|
33
35
|
- Generated contract clients are published under `dequanto/prebuilt/...` and can be imported or required by subpath in the same way.
|
|
34
36
|
|
|
37
|
+
## Installed Skill Context
|
|
38
|
+
|
|
39
|
+
When this directory is installed as a skill, `references/` and `examples/` are relative to the skill directory. Paths under `src/`, `test/`, and `0xc/` identify files in the dequanto repository and are not bundled resources.
|
|
40
|
+
|
|
41
|
+
In a consuming project, inspect the installed package's `lib/types/` declarations (typically `node_modules/dequanto/lib/types/`) instead of assuming the project's `src/` contains dequanto. Import package APIs through `dequanto/...`.
|
|
42
|
+
|
|
43
|
+
Examples are executable `UTest` tests when run from the dequanto repository root. Some need generated contracts, Solidity/artifact fixtures, Hardhat configuration, or RPC access. Reuse their relevant code in the target project; replace repository-relative generated-contract imports and fixture paths with that project's equivalents. The installed skill provides guidance, not a standalone runnable test suite.
|
|
44
|
+
|
|
35
45
|
## Agent Workflow
|
|
36
46
|
|
|
37
47
|
1. Identify the goal from the task router.
|
|
@@ -10,12 +10,20 @@ Use dequanto as the primary EVM toolkit.
|
|
|
10
10
|
## Workflow
|
|
11
11
|
|
|
12
12
|
1. Identify the requested blockchain task.
|
|
13
|
-
2. Read
|
|
14
|
-
3. Read the matching file in
|
|
15
|
-
4. Reuse the nearest example from
|
|
16
|
-
5. Verify unfamiliar APIs
|
|
13
|
+
2. Read `./INDEX.md` to choose the dequanto surface.
|
|
14
|
+
3. Read the matching file in `./references/`.
|
|
15
|
+
4. Reuse the nearest example from `./examples/`.
|
|
16
|
+
5. Verify unfamiliar APIs against the target project's installed dequanto package. See the path conventions below.
|
|
17
17
|
6. After TypeScript edits in the dequanto repo, run `npm run typecheck -- --pretty false`.
|
|
18
18
|
|
|
19
|
+
## Paths And Example Usage
|
|
20
|
+
|
|
21
|
+
Resolve `./INDEX.md`, `./references/`, and `./examples/` relative to this skill directory, regardless of the working directory.
|
|
22
|
+
|
|
23
|
+
Source paths such as `src/models/TAccount.ts` refer to the dequanto repository, not this skill directory. In a consuming project, resolve the installed `dequanto` package and inspect its corresponding `lib/types/**/*.d.ts` declarations; a typical location is `node_modules/dequanto/lib/types/`. Use the installed version as the API source of truth.
|
|
24
|
+
|
|
25
|
+
Examples use published `dequanto/...` imports. They retain the repository's `UTest` harness and may reference generated `0xc/` contracts or `test/fixtures/` files that are not bundled. Adapt the relevant function to the target project's runner, generated contracts, and fixtures. Do not execute examples directly from the installed skill directory or interpret repository-relative imports as installed resource paths.
|
|
26
|
+
|
|
19
27
|
## Defaults
|
|
20
28
|
|
|
21
29
|
- Load configuration before any RPC, explorer, indexing, token, or contract action. Prefer `await Config.fetch()` when preparing the runtime, or `await Web3ClientFactory.getAsync(platform)` when creating a chain client because it loads configuration internally.
|
|
@@ -34,24 +42,26 @@ Use dequanto as the primary EVM toolkit.
|
|
|
34
42
|
- Account agents can be chained. For example, a Timelock account can use a Safe account as `operator`, so the initial calldata is wrapped first as Timelock calldata and then as Safe transaction calldata.
|
|
35
43
|
- Use `EventsIndexer` for resumable historical event indexing.
|
|
36
44
|
- Use `BlockchainExplorerFactory` for explorer ABI, source, creation, transactions, and transfers.
|
|
37
|
-
-
|
|
45
|
+
- Prefer generated `contract.storage` readers and `storage.$set(name, value)` when available; use `SlotsParser` and `SlotsStorage` for manual Solidity layouts.
|
|
38
46
|
- Use `Deployments` for idempotent deployments, proxy deployments, beacon deployments, and verification.
|
|
39
47
|
- Use dequanto account-agent flows when the account type says `safe`, `timelock`, or `erc4337`.
|
|
40
48
|
|
|
41
49
|
## Reference Routing
|
|
42
50
|
|
|
43
|
-
- Contract reads, writes, generated helper facets:
|
|
44
|
-
- Configuration, RPC endpoint, and explorer setup:
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
51
|
+
- Contract reads, writes, generated helper facets: `./references/contracts.md`
|
|
52
|
+
- Configuration, RPC endpoint, and explorer setup: `./examples/config.spec.ts`, `src/config/ConfigDefaults.ts`
|
|
53
|
+
- Hardhat development, forks, impersonation, balance/storage changes, mining, snapshots: `./references/hardhat.md`
|
|
54
|
+
- RPC clients, blocks, balances, raw logs, subscriptions: `./references/rpc-clients.md`
|
|
55
|
+
- Transaction builders, tx writer lifecycle, receipts, nonces: `./references/transactions.md`
|
|
56
|
+
- Contract generation: `./references/generation.md`
|
|
57
|
+
- Deployment and proxy flows: `./references/deployments.md`
|
|
58
|
+
- Historical events and indexing: `./references/events-indexing.md`
|
|
59
|
+
- Explorer integration: `./references/explorer.md`
|
|
60
|
+
- ABI, hashing, validation, hex, dates, signing, and promise helpers: `./references/utils.md`
|
|
61
|
+
- Solidity storage: `./references/storage.md`
|
|
62
|
+
- Tokens and accounts: `./references/tokens-accounts.md`
|
|
63
|
+
- Safe and ERC-4337: `./references/safe-erc4337.md`
|
|
64
|
+
- Translating ethers/viem habits: `./references/migration-from-ethers-viem.md`
|
|
55
65
|
|
|
56
66
|
## Rules
|
|
57
67
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Config } from '
|
|
2
|
-
import { IRpcConfig } from '
|
|
3
|
-
import { Web3ClientFactory } from '
|
|
4
|
-
import { $require } from '
|
|
5
|
-
import { BlockchainExplorerFactory } from '
|
|
1
|
+
import { Config } from 'dequanto/config/Config';
|
|
2
|
+
import { IRpcConfig } from 'dequanto/clients/ClientPool';
|
|
3
|
+
import { Web3ClientFactory } from 'dequanto/clients/Web3ClientFactory';
|
|
4
|
+
import { $require } from 'dequanto/utils/$require';
|
|
5
|
+
import { BlockchainExplorerFactory } from 'dequanto/explorer/BlockchainExplorerFactory';
|
|
6
6
|
|
|
7
7
|
UTest({
|
|
8
8
|
async 'load default configuration before RPC actions' () {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Web3ClientFactory } from '
|
|
2
|
-
import { ContractClassFactory } from '
|
|
1
|
+
import { Web3ClientFactory } from 'dequanto/clients/Web3ClientFactory';
|
|
2
|
+
import { ContractClassFactory } from 'dequanto/contracts/ContractClassFactory';
|
|
3
3
|
// dequanto ships prebuilt TypeScript clients for all OpenZeppelin contracts.
|
|
4
|
-
import { ERC20 } from '
|
|
4
|
+
import { ERC20 } from 'dequanto/prebuilt/openzeppelin/ERC20';
|
|
5
5
|
// Use 0xweb CLI to download and generate simple TypeScript clients for verified contracts from Etherscan-compatible explorers:
|
|
6
6
|
// 0xweb install <address> --name AavePool --chain eth --save-sources false
|
|
7
7
|
import { AavePool } from '../../../0xc/eth/AavePool/AavePool';
|
|
8
|
-
import { $abi } from '
|
|
9
|
-
import { $require } from '
|
|
10
|
-
import type { TEth } from '
|
|
11
|
-
import { $address } from '
|
|
8
|
+
import { $abi } from 'dequanto/abi/$abi';
|
|
9
|
+
import { $require } from 'dequanto/utils/$require';
|
|
10
|
+
import type { TEth } from 'dequanto/models/TEth';
|
|
11
|
+
import { $address } from 'dequanto/utils/$address';
|
|
12
12
|
|
|
13
13
|
const USDC = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' as const;
|
|
14
14
|
const AAVE_POOL = '0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2' as const;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Web3ClientFactory } from '
|
|
2
|
-
import { ContractReader } from '
|
|
3
|
-
import { ERC20 } from '
|
|
1
|
+
import { Web3ClientFactory } from 'dequanto/clients/Web3ClientFactory';
|
|
2
|
+
import { ContractReader } from 'dequanto/contracts/ContractReader';
|
|
3
|
+
import { ERC20 } from 'dequanto/prebuilt/openzeppelin/ERC20';
|
|
4
4
|
import { AavePool } from '../../../0xc/eth/AavePool/AavePool';
|
|
5
|
-
import type { TEth } from '
|
|
6
|
-
import { $account } from '
|
|
7
|
-
import { $address } from '
|
|
8
|
-
import { $require } from '
|
|
5
|
+
import type { TEth } from 'dequanto/models/TEth';
|
|
6
|
+
import { $account } from 'dequanto/utils/$account';
|
|
7
|
+
import { $address } from 'dequanto/utils/$address';
|
|
8
|
+
import { $require } from 'dequanto/utils/$require';
|
|
9
9
|
|
|
10
10
|
const USDC = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' as const;
|
|
11
11
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Web3ClientFactory } from '
|
|
2
|
-
import { Deployments } from '
|
|
3
|
-
import { Generator } from '
|
|
4
|
-
import { $account } from '
|
|
5
|
-
import { $require } from '
|
|
1
|
+
import { Web3ClientFactory } from 'dequanto/clients/Web3ClientFactory';
|
|
2
|
+
import { Deployments } from 'dequanto/contracts/deploy/Deployments';
|
|
3
|
+
import { Generator } from 'dequanto/gen/Generator';
|
|
4
|
+
import { $account } from 'dequanto/utils/$account';
|
|
5
|
+
import { $require } from 'dequanto/utils/$require';
|
|
6
6
|
import { File } from 'atma-io';
|
|
7
7
|
|
|
8
8
|
// In a Hardhat project, include the @0xweb/hardhat plugin in hardhat.config.*.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Web3ClientFactory } from '
|
|
2
|
-
import { BlockchainExplorerFactory } from '
|
|
3
|
-
import { Erc4337Service } from '
|
|
4
|
-
import { UserOperation } from '
|
|
5
|
-
import { $address } from '
|
|
6
|
-
import { $erc4337 } from '
|
|
7
|
-
import { $require } from '
|
|
1
|
+
import { Web3ClientFactory } from 'dequanto/clients/Web3ClientFactory';
|
|
2
|
+
import { BlockchainExplorerFactory } from 'dequanto/explorer/BlockchainExplorerFactory';
|
|
3
|
+
import { Erc4337Service } from 'dequanto/erc4337/Erc4337Service';
|
|
4
|
+
import { UserOperation } from 'dequanto/erc4337/models/UserOperation';
|
|
5
|
+
import { $address } from 'dequanto/utils/$address';
|
|
6
|
+
import { $erc4337 } from 'dequanto/erc4337/utils/$erc4337';
|
|
7
|
+
import { $require } from 'dequanto/utils/$require';
|
|
8
8
|
|
|
9
9
|
UTest({
|
|
10
10
|
async 'hash a UserOperation and create an ERC-4337 service' () {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BlockchainExplorerFactory } from '
|
|
2
|
-
import { $address } from '
|
|
3
|
-
import { $require } from '
|
|
1
|
+
import { BlockchainExplorerFactory } from 'dequanto/explorer/BlockchainExplorerFactory';
|
|
2
|
+
import { $address } from 'dequanto/utils/$address';
|
|
3
|
+
import { $require } from 'dequanto/utils/$require';
|
|
4
4
|
|
|
5
5
|
UTest({
|
|
6
6
|
async 'fetch stable USDC ABI and source from configured Ethereum explorer' () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Generator } from '
|
|
2
|
-
import { $require } from '
|
|
1
|
+
import { Generator } from 'dequanto/gen/Generator';
|
|
2
|
+
import { $require } from 'dequanto/utils/$require';
|
|
3
3
|
import { File } from 'atma-io';
|
|
4
4
|
|
|
5
5
|
// Generator is the low-level API for creating contract classes programmatically.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Web3ClientFactory } from 'dequanto/clients/Web3ClientFactory';
|
|
2
|
+
import { $require } from 'dequanto/utils/$require';
|
|
3
|
+
|
|
4
|
+
UTest({
|
|
5
|
+
async 'change balances, storage, and time on Hardhat and roll back'() {
|
|
6
|
+
const client = await Web3ClientFactory.getAsync('hh:memory');
|
|
7
|
+
const address = '0x0000000000000000000000000000000000001234';
|
|
8
|
+
const balanceBefore = await client.getBalance(address);
|
|
9
|
+
const storageBefore = await client.getStorageAt(address, 0);
|
|
10
|
+
const blockBefore = await client.getBlockNumber();
|
|
11
|
+
const id = await client.debug.snapshot();
|
|
12
|
+
|
|
13
|
+
await client.debug.setBalance(address, 10n ** 18n);
|
|
14
|
+
$require.eq(await client.getBalance(address), 10n ** 18n);
|
|
15
|
+
|
|
16
|
+
// The same operation writes a known slot at any contract address.
|
|
17
|
+
await client.debug.setStorageAt(address, 0, '0x2a');
|
|
18
|
+
$require.eq(BigInt(await client.getStorageAt(address, 0)), 42n);
|
|
19
|
+
|
|
20
|
+
await client.debug.mine('5days');
|
|
21
|
+
$require.eq(await client.getBlockNumber(), blockBefore + 432_000);
|
|
22
|
+
|
|
23
|
+
await client.debug.revert(id);
|
|
24
|
+
|
|
25
|
+
$require.eq(await client.getBalance(address), balanceBefore);
|
|
26
|
+
$require.eq(await client.getStorageAt(address, 0), storageBefore);
|
|
27
|
+
$require.eq(await client.getBlockNumber(), blockBefore);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Web3ClientFactory } from 'dequanto/clients/Web3ClientFactory';
|
|
2
|
+
import { ERC20 } from 'dequanto/prebuilt/openzeppelin/ERC20';
|
|
3
|
+
import { $erc20 } from 'dequanto/utils/$erc20';
|
|
4
|
+
import { $require } from 'dequanto/utils/$require';
|
|
5
|
+
|
|
6
|
+
UTest({
|
|
7
|
+
async 'set an ERC20 balance and transfer from an impersonated account on a fork' () {
|
|
8
|
+
// Requires an accessible Ethereum RPC from the dequanto configuration.
|
|
9
|
+
const client = await Web3ClientFactory.getAsync('hh:memory:eth');
|
|
10
|
+
// To use an already running local Ethereum fork, use getAsync('hh:eth').
|
|
11
|
+
const usdc = new ERC20('0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', client);
|
|
12
|
+
const account = {
|
|
13
|
+
address: '0x0000000000000000000000000000000000001234',
|
|
14
|
+
type: 'impersonated'
|
|
15
|
+
} as const;
|
|
16
|
+
const to = '0x0000000000000000000000000000000000005678';
|
|
17
|
+
const amount = 1_000_000n; // 1 USDC (6 decimals).
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
await client.debug.setBalance(account.address, 10n ** 18n);
|
|
21
|
+
await $erc20.setBalanceAny(client, usdc.address, account.address, amount);
|
|
22
|
+
$require.eq(await usdc.balanceOf(account.address), amount);
|
|
23
|
+
|
|
24
|
+
const recipientBalance = await usdc.balanceOf(to);
|
|
25
|
+
const writer = await usdc.$receipt().transfer(account, to, amount);
|
|
26
|
+
|
|
27
|
+
$require.Hex(writer.receipt.transactionHash);
|
|
28
|
+
$require.eq(await usdc.balanceOf(account.address), 0n);
|
|
29
|
+
$require.eq(await usdc.balanceOf(to), recipientBalance + amount);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Web3ClientFactory } from '
|
|
2
|
-
import { EventsIndexer } from '
|
|
3
|
-
import { ERC20 } from '
|
|
4
|
-
import { $require } from '
|
|
1
|
+
import { Web3ClientFactory } from 'dequanto/clients/Web3ClientFactory';
|
|
2
|
+
import { EventsIndexer } from 'dequanto/indexer/EventsIndexer';
|
|
3
|
+
import { ERC20 } from 'dequanto/prebuilt/openzeppelin/ERC20';
|
|
4
|
+
import { $require } from 'dequanto/utils/$require';
|
|
5
5
|
|
|
6
6
|
UTest({
|
|
7
7
|
async 'index stable USDC Transfer logs from live Ethereum RPC' () {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Web3ClientFactory } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Web3ClientFactory } from 'dequanto/clients/Web3ClientFactory';
|
|
2
|
+
import { BlockDateResolver } from 'dequanto/blocks/BlockDateResolver';
|
|
3
|
+
import { Config } from 'dequanto/config/Config';
|
|
4
|
+
import { $date } from 'dequanto/utils/$date';
|
|
5
|
+
import { $require } from 'dequanto/utils/$require';
|
|
4
6
|
|
|
5
7
|
UTest({
|
|
6
|
-
async '
|
|
8
|
+
async 'read common RPC data via Web3Client directly' () {
|
|
7
9
|
const cfg = await Config.fetch();
|
|
8
10
|
|
|
9
11
|
const client = await Web3ClientFactory.getAsync('eth');
|
|
@@ -38,5 +40,20 @@ UTest({
|
|
|
38
40
|
params: []
|
|
39
41
|
});
|
|
40
42
|
$require.gt(Number(response), 0);
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
async 'resolve a block number and timestamp from a date' () {
|
|
46
|
+
const client = await Web3ClientFactory.getAsync('eth');
|
|
47
|
+
const resolver = new BlockDateResolver(client);
|
|
48
|
+
const date = new Date('2026-03-03T10:20:00Z');
|
|
49
|
+
|
|
50
|
+
const blockNumber = await resolver.getBlockNumberFor(date);
|
|
51
|
+
const info = await resolver.getBlockInfoFor(date);
|
|
52
|
+
const blockDate = await resolver.getDate(blockNumber);
|
|
53
|
+
|
|
54
|
+
$require.eq(blockNumber, 24576295);
|
|
55
|
+
$require.eq(blockNumber, 24576295);
|
|
56
|
+
$require.lte(Math.abs($date.toUnixTimestamp(date) - info.timestamp), 1);
|
|
57
|
+
$require.eq(blockDate.toISOString(), new Date('2026-03-03T10:19:59Z').toISOString());
|
|
41
58
|
}
|
|
42
59
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { HardhatProvider } from '
|
|
2
|
-
import { InMemoryServiceTransport } from '
|
|
3
|
-
import { SafeTx } from '
|
|
4
|
-
import { $address } from '
|
|
5
|
-
import { $require } from '
|
|
6
|
-
import { SafeAccount } from '
|
|
1
|
+
import { HardhatProvider } from 'dequanto/hardhat/HardhatProvider';
|
|
2
|
+
import { InMemoryServiceTransport } from 'dequanto/safe/transport/InMemoryServiceTransport';
|
|
3
|
+
import { SafeTx } from 'dequanto/safe/SafeTx';
|
|
4
|
+
import { $address } from 'dequanto/utils/$address';
|
|
5
|
+
import { $require } from 'dequanto/utils/$require';
|
|
6
|
+
import { SafeAccount } from 'dequanto/models/TAccount';
|
|
7
7
|
|
|
8
8
|
UTest({
|
|
9
9
|
async 'build a Safe batch from generated tx data' () {
|