gulltoppr 0.1.0
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/README.md +72 -0
- package/dist/client.d.ts +80 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +116 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +147 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# gulltoppr
|
|
2
|
+
|
|
3
|
+
Typed TypeScript client for the [gulltoppr](../README.md) — resolve any
|
|
4
|
+
contract's ABI (verified *or* unverified, via the heimdall decompile rung) and
|
|
5
|
+
prepare safe, simulated, non-custodial interactions. The typed client over the REST
|
|
6
|
+
surface in [`../SPEC.md`](../SPEC.md) §4.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install gulltoppr viem
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { AbiNinja } from "gulltoppr";
|
|
16
|
+
|
|
17
|
+
// baseUrl defaults to the live engine; pass it only to override.
|
|
18
|
+
const ninja = new AbiNinja({ baseUrl: "https://gulltoppr.fly.dev" });
|
|
19
|
+
|
|
20
|
+
// Resolve — ABI is secondary; the capability manifest + provenance are the point.
|
|
21
|
+
const r = await ninja.resolveAbi("base", "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913");
|
|
22
|
+
if (r.provenance.confidence === "decompiled") {
|
|
23
|
+
console.warn("Decompiled ABI — names are inferred:", r.provenance.notes);
|
|
24
|
+
}
|
|
25
|
+
console.log(r.interface.reads.map((f) => f.signature)); // the "buttons"
|
|
26
|
+
|
|
27
|
+
// Read (no wallet)
|
|
28
|
+
const { decoded } = await ninja.read("base", r.address, "balanceOf", ["0xabc…"]);
|
|
29
|
+
|
|
30
|
+
// Prepare a write — returns an UNSIGNED tx + simulation + deeplink. Signs nothing.
|
|
31
|
+
const prep = await ninja.prepareTx("base", r.address, "transfer", ["0xdef…", "1000000"], {
|
|
32
|
+
from: "0xMyWallet…",
|
|
33
|
+
});
|
|
34
|
+
console.log(prep.human_summary, prep.warnings);
|
|
35
|
+
// → hand prep.deeplink to the user; they sign in their own wallet.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### `contract()` — resolve once, then act (viem-flavoured)
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
const usdc = ninja.contract("base", "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913");
|
|
42
|
+
const meta = await usdc.resolve(); // memoized
|
|
43
|
+
const bal = await usdc.read("balanceOf", ["0xabc…"]);
|
|
44
|
+
const tx = await usdc.prepare("approve", ["0xspender…", "1000000"], { from: "0xme…" });
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## API
|
|
48
|
+
|
|
49
|
+
| method | verb |
|
|
50
|
+
|--------|------|
|
|
51
|
+
| `resolveAbi(chain, address, opts?)` | resolve_abi |
|
|
52
|
+
| `read(chain, address, fn, args?, opts?)` | read_contract |
|
|
53
|
+
| `encode(chain, address, fn, args?, opts?)` | encode_call |
|
|
54
|
+
| `simulate(chain, { from, address/function/args \| to/data, value? }, opts?)` | simulate |
|
|
55
|
+
| `prepareTx(chain, address, fn, args, { from, value?, rpcUrl? })` | prepare_tx |
|
|
56
|
+
| `decodeTx(chain, txHash, opts?)` | decode_tx |
|
|
57
|
+
| `resolveName(nameOrAddress, chain?)` | resolve_name |
|
|
58
|
+
| `contract(chain, address)` | ergonomic handle |
|
|
59
|
+
|
|
60
|
+
- `chain` is an alias (`"ethereum"`, `"base"`, …) or a numeric id.
|
|
61
|
+
- `opts.rpcUrl` overrides the engine's RPC (required for `local`/31337).
|
|
62
|
+
- Errors throw `AbiNinjaError` with a stable `.code` (`NOT_A_VIEW_FN`,
|
|
63
|
+
`AMBIGUOUS_FUNCTION` with `.details.candidates`, `ABI_NOT_FOUND`, …) and `.status`.
|
|
64
|
+
- Bigints arrive as decimal strings (the engine serializes them on the wire).
|
|
65
|
+
|
|
66
|
+
## Build
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm run build # tsc → dist/ (js + d.ts)
|
|
70
|
+
npm run typecheck
|
|
71
|
+
npm test # vitest — client tests with an injected fetch (no network)
|
|
72
|
+
```
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AbiNinja — typed client for the abi.ninja engine REST surface (SPEC §4).
|
|
3
|
+
*
|
|
4
|
+
* Low-level verbs mirror the seven engine verbs 1:1. A `contract()` helper gives a
|
|
5
|
+
* viem-flavoured ergonomic surface (resolve once, then read/encode/prepare).
|
|
6
|
+
*/
|
|
7
|
+
import type { Address, Hex } from "viem";
|
|
8
|
+
import type { AbiResult, ChainInput, DecodeTxResult, EncodeResult, PreparedTx, ReadResult, ResolveNameResult, Simulation } from "./types.js";
|
|
9
|
+
export interface AbiNinjaOptions {
|
|
10
|
+
/** Engine base URL. Default: https://gulltoppr.fly.dev */
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
/** Inject a custom fetch (tests, Node < 18, proxies). Default: global fetch. */
|
|
13
|
+
fetch?: typeof globalThis.fetch;
|
|
14
|
+
/** Extra headers on every request (e.g. an API key). */
|
|
15
|
+
headers?: Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
export interface CallOpts {
|
|
18
|
+
/** Override the RPC the engine uses for this chain (required for local/31337). */
|
|
19
|
+
rpcUrl?: string;
|
|
20
|
+
}
|
|
21
|
+
interface SimulateArgs {
|
|
22
|
+
from: Address;
|
|
23
|
+
address?: Address;
|
|
24
|
+
function?: string;
|
|
25
|
+
args?: unknown[];
|
|
26
|
+
to?: Address;
|
|
27
|
+
data?: Hex;
|
|
28
|
+
value?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare class AbiNinja {
|
|
31
|
+
private readonly baseUrl;
|
|
32
|
+
private readonly fetchImpl;
|
|
33
|
+
private readonly headers;
|
|
34
|
+
constructor(opts?: AbiNinjaOptions);
|
|
35
|
+
/** resolve_abi — ABI + capability manifest + provenance + proxy chain. */
|
|
36
|
+
resolveAbi(chain: ChainInput, address: Address, opts?: CallOpts): Promise<AbiResult>;
|
|
37
|
+
/** read_contract — call a view/pure function, get the decoded result. */
|
|
38
|
+
read(chain: ChainInput, address: Address, fn: string, args?: unknown[], opts?: CallOpts): Promise<ReadResult>;
|
|
39
|
+
/** encode_call — function + args → calldata. */
|
|
40
|
+
encode(chain: ChainInput, address: Address, fn: string, args?: unknown[], opts?: CallOpts & {
|
|
41
|
+
value?: string;
|
|
42
|
+
}): Promise<EncodeResult>;
|
|
43
|
+
/** simulate — high-level {address,function,args} or raw {to,data}. */
|
|
44
|
+
simulate(chain: ChainInput, args: SimulateArgs, opts?: CallOpts): Promise<Simulation>;
|
|
45
|
+
/** prepare_tx — the non-custodial hand-off: unsigned tx + simulation + summary + deeplink. */
|
|
46
|
+
prepareTx(chain: ChainInput, address: Address, fn: string, args: unknown[], opts: CallOpts & {
|
|
47
|
+
from: Address;
|
|
48
|
+
value?: string;
|
|
49
|
+
}): Promise<PreparedTx>;
|
|
50
|
+
/** decode_tx — "explain what this tx did." */
|
|
51
|
+
decodeTx(chain: ChainInput, txHash: string, opts?: CallOpts): Promise<DecodeTxResult>;
|
|
52
|
+
/** resolve_name — ENS name → address, or address → primary ENS name. */
|
|
53
|
+
resolveName(nameOrAddress: string, chain?: ChainInput): Promise<ResolveNameResult>;
|
|
54
|
+
/** Ergonomic handle: resolve once, then read/encode/prepare against this contract. */
|
|
55
|
+
contract(chain: ChainInput, address: Address): Contract;
|
|
56
|
+
private url;
|
|
57
|
+
private get;
|
|
58
|
+
private post;
|
|
59
|
+
private request;
|
|
60
|
+
}
|
|
61
|
+
/** A resolved-on-demand handle to one contract — viem `getContract` flavour. */
|
|
62
|
+
export declare class Contract {
|
|
63
|
+
private readonly client;
|
|
64
|
+
readonly chain: ChainInput;
|
|
65
|
+
readonly address: Address;
|
|
66
|
+
private resolved?;
|
|
67
|
+
constructor(client: AbiNinja, chain: ChainInput, address: Address);
|
|
68
|
+
/** Resolve (and memoize) this contract's ABI + manifest. */
|
|
69
|
+
resolve(opts?: CallOpts): Promise<AbiResult>;
|
|
70
|
+
read(fn: string, args?: unknown[], opts?: CallOpts): Promise<ReadResult>;
|
|
71
|
+
encode(fn: string, args?: unknown[], opts?: CallOpts & {
|
|
72
|
+
value?: string;
|
|
73
|
+
}): Promise<EncodeResult>;
|
|
74
|
+
prepare(fn: string, args: unknown[], opts: CallOpts & {
|
|
75
|
+
from: Address;
|
|
76
|
+
value?: string;
|
|
77
|
+
}): Promise<PreparedTx>;
|
|
78
|
+
}
|
|
79
|
+
export {};
|
|
80
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,UAAU,EACX,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,eAAe;IAC9B,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,M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GAAE,OAAO,EAAO,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAIrG,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,GAAG;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC;CAG9G"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { AbiNinjaError } from "./errors.js";
|
|
2
|
+
export class AbiNinja {
|
|
3
|
+
baseUrl;
|
|
4
|
+
fetchImpl;
|
|
5
|
+
headers;
|
|
6
|
+
constructor(opts = {}) {
|
|
7
|
+
this.baseUrl = (opts.baseUrl ?? "https://gulltoppr.fly.dev").replace(/\/$/, "");
|
|
8
|
+
if (!opts.fetch && !globalThis.fetch) {
|
|
9
|
+
throw new Error("No fetch available; pass { fetch } in AbiNinjaOptions.");
|
|
10
|
+
}
|
|
11
|
+
// Native browser fetch must be invoked with `this === window`/global; calling it
|
|
12
|
+
// as a method (this.fetchImpl(...)) detaches it and throws "Illegal invocation".
|
|
13
|
+
// Bind the default global fetch; leave a caller-provided fetch untouched.
|
|
14
|
+
this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);
|
|
15
|
+
this.headers = opts.headers ?? {};
|
|
16
|
+
}
|
|
17
|
+
// ── verbs ───────────────────────────────────────────────────────────────────
|
|
18
|
+
/** resolve_abi — ABI + capability manifest + provenance + proxy chain. */
|
|
19
|
+
resolveAbi(chain, address, opts) {
|
|
20
|
+
return this.get(`/v1/${enc(chain)}/${address}/abi`, opts);
|
|
21
|
+
}
|
|
22
|
+
/** read_contract — call a view/pure function, get the decoded result. */
|
|
23
|
+
read(chain, address, fn, args = [], opts) {
|
|
24
|
+
return this.post(`/v1/${enc(chain)}/${address}/read`, { function: fn, args }, opts);
|
|
25
|
+
}
|
|
26
|
+
/** encode_call — function + args → calldata. */
|
|
27
|
+
encode(chain, address, fn, args = [], opts) {
|
|
28
|
+
return this.post(`/v1/${enc(chain)}/${address}/encode`, { function: fn, args, value: opts?.value }, opts);
|
|
29
|
+
}
|
|
30
|
+
/** simulate — high-level {address,function,args} or raw {to,data}. */
|
|
31
|
+
simulate(chain, args, opts) {
|
|
32
|
+
return this.post(`/v1/${enc(chain)}/simulate`, args, opts);
|
|
33
|
+
}
|
|
34
|
+
/** prepare_tx — the non-custodial hand-off: unsigned tx + simulation + summary + deeplink. */
|
|
35
|
+
prepareTx(chain, address, fn, args, opts) {
|
|
36
|
+
return this.post(`/v1/${enc(chain)}/${address}/prepare`, { function: fn, args, from: opts.from, value: opts.value }, opts);
|
|
37
|
+
}
|
|
38
|
+
/** decode_tx — "explain what this tx did." */
|
|
39
|
+
decodeTx(chain, txHash, opts) {
|
|
40
|
+
return this.get(`/v1/${enc(chain)}/tx/${txHash}`, opts);
|
|
41
|
+
}
|
|
42
|
+
/** resolve_name — ENS name → address, or address → primary ENS name. */
|
|
43
|
+
resolveName(nameOrAddress, chain = "ethereum") {
|
|
44
|
+
const isAddr = /^0x[0-9a-fA-F]{40}$/.test(nameOrAddress);
|
|
45
|
+
const path = isAddr
|
|
46
|
+
? `/v1/${enc(chain)}/name/by-address/${nameOrAddress}`
|
|
47
|
+
: `/v1/${enc(chain)}/name/${encodeURIComponent(nameOrAddress)}`;
|
|
48
|
+
return this.get(path);
|
|
49
|
+
}
|
|
50
|
+
/** Ergonomic handle: resolve once, then read/encode/prepare against this contract. */
|
|
51
|
+
contract(chain, address) {
|
|
52
|
+
return new Contract(this, chain, address);
|
|
53
|
+
}
|
|
54
|
+
// ── transport ─────────────────────────────────────────────────────────────────
|
|
55
|
+
url(path, opts) {
|
|
56
|
+
const u = this.baseUrl + path;
|
|
57
|
+
return opts?.rpcUrl ? `${u}?rpc_url=${encodeURIComponent(opts.rpcUrl)}` : u;
|
|
58
|
+
}
|
|
59
|
+
async get(path, opts) {
|
|
60
|
+
return this.request("GET", this.url(path, opts));
|
|
61
|
+
}
|
|
62
|
+
async post(path, body, opts) {
|
|
63
|
+
return this.request("POST", this.url(path, opts), body);
|
|
64
|
+
}
|
|
65
|
+
async request(method, url, body) {
|
|
66
|
+
let res;
|
|
67
|
+
try {
|
|
68
|
+
res = await this.fetchImpl(url, {
|
|
69
|
+
method,
|
|
70
|
+
headers: { "content-type": "application/json", ...this.headers },
|
|
71
|
+
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
throw new AbiNinjaError("NETWORK", `Request to ${url} failed: ${e.message}`, 0);
|
|
76
|
+
}
|
|
77
|
+
const text = await res.text();
|
|
78
|
+
const json = text ? JSON.parse(text) : undefined;
|
|
79
|
+
if (!res.ok) {
|
|
80
|
+
const err = json?.error;
|
|
81
|
+
throw new AbiNinjaError(err?.code ?? "INTERNAL", err?.message ?? `HTTP ${res.status}`, res.status, err?.details);
|
|
82
|
+
}
|
|
83
|
+
return json;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** A resolved-on-demand handle to one contract — viem `getContract` flavour. */
|
|
87
|
+
export class Contract {
|
|
88
|
+
client;
|
|
89
|
+
chain;
|
|
90
|
+
address;
|
|
91
|
+
resolved;
|
|
92
|
+
constructor(client, chain, address) {
|
|
93
|
+
this.client = client;
|
|
94
|
+
this.chain = chain;
|
|
95
|
+
this.address = address;
|
|
96
|
+
}
|
|
97
|
+
/** Resolve (and memoize) this contract's ABI + manifest. */
|
|
98
|
+
resolve(opts) {
|
|
99
|
+
this.resolved ??= this.client.resolveAbi(this.chain, this.address, opts);
|
|
100
|
+
return this.resolved;
|
|
101
|
+
}
|
|
102
|
+
read(fn, args = [], opts) {
|
|
103
|
+
return this.client.read(this.chain, this.address, fn, args, opts);
|
|
104
|
+
}
|
|
105
|
+
encode(fn, args = [], opts) {
|
|
106
|
+
return this.client.encode(this.chain, this.address, fn, args, opts);
|
|
107
|
+
}
|
|
108
|
+
prepare(fn, args, opts) {
|
|
109
|
+
return this.client.prepareTx(this.chain, this.address, fn, args, opts);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/** Chain segment: numbers and alias strings both pass through encodeURIComponent. */
|
|
113
|
+
function enc(chain) {
|
|
114
|
+
return encodeURIComponent(String(chain));
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAkB,MAAM,aAAa,CAAC;AAsC5D,MAAM,OAAO,QAAQ;IACF,OAAO,CAAS;IAChB,SAAS,CAA0B;IACnC,OAAO,CAAyB;IAEjD,YAAY,OAAwB,EAAE;QACpC,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,2BAA2B,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAChF,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;QACD,iFAAiF;QACjF,iFAAiF;QACjF,0EAA0E;QAC1E,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;IACpC,CAAC;IAED,+EAA+E;IAE/E,0EAA0E;IAC1E,UAAU,CAAC,KAAiB,EAAE,OAAgB,EAAE,IAAe;QAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,KAAK,CA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AFR,WAAM,GAAN,MAAM,CAAU;QACxB,UAAK,GAAL,KAAK,CAAY;QACjB,YAAO,GAAP,OAAO,CAAS;IACxB,CAAC;IAEJ,4DAA4D;IAC5D,OAAO,CAAC,IAAe;QACrB,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAI,CAAC,EAAU,EAAE,OAAkB,EAAE,EAAE,IAAe;QACpD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,CAAC,EAAU,EAAE,OAAkB,EAAE,EAAE,IAAoC;QAC3E,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,CAAC,EAAU,EAAE,IAAe,EAAE,IAAkD;QACrF,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;CACF;AAED,qFAAqF;AACrF,SAAS,GAAG,CAAC,KAAiB;IAC5B,OAAO,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side error — mirrors the engine's error envelope (SPEC §7). Carries the
|
|
3
|
+
* stable machine `code` so callers can branch on it (e.g. retry on RPC_ERROR,
|
|
4
|
+
* surface AMBIGUOUS_FUNCTION candidates).
|
|
5
|
+
*/
|
|
6
|
+
export type ErrorCode = "INVALID_ADDRESS" | "INVALID_ARGS" | "UNKNOWN_CHAIN" | "AMBIGUOUS_FUNCTION" | "FUNCTION_NOT_FOUND" | "NOT_A_VIEW_FN" | "ABI_NOT_FOUND" | "DECOMPILE_FAILED" | "RPC_ERROR" | "UPSTREAM_TIMEOUT" | "RATE_LIMITED" | "INTERNAL" | "NETWORK";
|
|
7
|
+
export declare class AbiNinjaError extends Error {
|
|
8
|
+
readonly code: ErrorCode;
|
|
9
|
+
readonly status: number;
|
|
10
|
+
readonly details?: Record<string, unknown>;
|
|
11
|
+
constructor(code: ErrorCode, message: string, status: number, details?: Record<string, unknown>);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GACjB,iBAAiB,GACjB,cAAc,GACd,eAAe,GACf,oBAAoB,GACpB,oBAAoB,GACpB,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,WAAW,GACX,kBAAkB,GAClB,cAAc,GACd,UAAU,GACV,SAAS,CAAC;AAEd,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAE/B,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAOhG"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class AbiNinjaError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
status;
|
|
4
|
+
details;
|
|
5
|
+
constructor(code, message, status, details) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "AbiNinjaError";
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.status = status;
|
|
10
|
+
this.details = details;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAoBA,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,IAAI,CAAY;IAChB,MAAM,CAAS;IACf,OAAO,CAA2B;IAE3C,YAAY,IAAe,EAAE,OAAe,EAAE,MAAc,EAAE,OAAiC;QAC7F,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** gulltoppr — typed client for the abi.ninja engine. */
|
|
2
|
+
export { AbiNinja, Contract } from "./client.js";
|
|
3
|
+
export type { AbiNinjaOptions, CallOpts } from "./client.js";
|
|
4
|
+
export { AbiNinjaError } from "./errors.js";
|
|
5
|
+
export type { ErrorCode } from "./errors.js";
|
|
6
|
+
export type * from "./types.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,mBAAmB,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public wire types — the JSON the abi.ninja engine returns (SPEC.md §2). These
|
|
3
|
+
* mirror the engine's `src/types.ts`; SPEC is the shared source of truth. Primitive
|
|
4
|
+
* onchain types come from viem so consumers get the same branded `Address`/`Hex`.
|
|
5
|
+
*
|
|
6
|
+
* Note on numbers: the engine serializes bigints as decimal strings on the wire, so
|
|
7
|
+
* fields like `decoded[]` / amounts arrive as strings, not bigints.
|
|
8
|
+
*/
|
|
9
|
+
import type { Abi, Address, Hex } from "viem";
|
|
10
|
+
export type ChainInput = number | string;
|
|
11
|
+
export type ProvenanceSource = "etherscan" | "sourcify" | "proxy-impl" | "heimdall-decompiled" | "4byte";
|
|
12
|
+
export type Confidence = "verified" | "partial" | "decompiled" | "selector-only";
|
|
13
|
+
export interface Provenance {
|
|
14
|
+
source: ProvenanceSource;
|
|
15
|
+
confidence: Confidence;
|
|
16
|
+
verified: boolean;
|
|
17
|
+
names_synthetic: boolean;
|
|
18
|
+
natspec: boolean;
|
|
19
|
+
notes?: string;
|
|
20
|
+
}
|
|
21
|
+
export type ProxyPattern = "eip1967" | "uups" | "transparent" | "beacon" | "diamond" | "minimal-1167" | "unknown";
|
|
22
|
+
export interface ProxyHop {
|
|
23
|
+
address: Address;
|
|
24
|
+
role: "proxy" | "implementation" | "beacon" | "facet";
|
|
25
|
+
}
|
|
26
|
+
export interface ProxyChain {
|
|
27
|
+
is_proxy: true;
|
|
28
|
+
pattern: ProxyPattern;
|
|
29
|
+
hops: ProxyHop[];
|
|
30
|
+
resolved_implementation?: Address;
|
|
31
|
+
}
|
|
32
|
+
export interface IoParam {
|
|
33
|
+
name: string;
|
|
34
|
+
type: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ReadCapability {
|
|
37
|
+
function: string;
|
|
38
|
+
signature: string;
|
|
39
|
+
inputs: IoParam[];
|
|
40
|
+
outputs: IoParam[];
|
|
41
|
+
names_synthetic: boolean;
|
|
42
|
+
hint?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface WriteCapability {
|
|
45
|
+
function: string;
|
|
46
|
+
signature: string;
|
|
47
|
+
inputs: IoParam[];
|
|
48
|
+
payable: boolean;
|
|
49
|
+
names_synthetic: boolean;
|
|
50
|
+
hint?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ContractInterface {
|
|
53
|
+
reads: ReadCapability[];
|
|
54
|
+
writes: WriteCapability[];
|
|
55
|
+
}
|
|
56
|
+
export interface TokenMeta {
|
|
57
|
+
kind: "erc20" | "erc721" | "erc1155" | null;
|
|
58
|
+
symbol?: string;
|
|
59
|
+
decimals?: number;
|
|
60
|
+
name?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface AbiResult {
|
|
63
|
+
chain: number;
|
|
64
|
+
address: Address;
|
|
65
|
+
interface: ContractInterface;
|
|
66
|
+
abi: Abi;
|
|
67
|
+
provenance: Provenance;
|
|
68
|
+
proxy?: ProxyChain;
|
|
69
|
+
token?: TokenMeta;
|
|
70
|
+
abi_for: Address;
|
|
71
|
+
cached: boolean;
|
|
72
|
+
}
|
|
73
|
+
export interface AssetChange {
|
|
74
|
+
address: Address;
|
|
75
|
+
token: Address;
|
|
76
|
+
symbol?: string;
|
|
77
|
+
delta: string;
|
|
78
|
+
kind: "erc20" | "erc721" | "erc1155" | "native";
|
|
79
|
+
}
|
|
80
|
+
export interface StateDiffEntry {
|
|
81
|
+
address: Address;
|
|
82
|
+
slot_label?: string;
|
|
83
|
+
before: string;
|
|
84
|
+
after: string;
|
|
85
|
+
}
|
|
86
|
+
export interface SimLog {
|
|
87
|
+
address: Address;
|
|
88
|
+
event?: string;
|
|
89
|
+
args?: Record<string, unknown>;
|
|
90
|
+
}
|
|
91
|
+
export interface Simulation {
|
|
92
|
+
success: boolean;
|
|
93
|
+
gas_used: number;
|
|
94
|
+
return_value?: {
|
|
95
|
+
decoded: unknown[];
|
|
96
|
+
raw: Hex;
|
|
97
|
+
};
|
|
98
|
+
state_diff: StateDiffEntry[];
|
|
99
|
+
asset_changes: AssetChange[];
|
|
100
|
+
logs: SimLog[];
|
|
101
|
+
revert?: {
|
|
102
|
+
reason: string;
|
|
103
|
+
decoded?: string;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export interface UnsignedTx {
|
|
107
|
+
chainId: number;
|
|
108
|
+
to: Address;
|
|
109
|
+
from: Address;
|
|
110
|
+
data: Hex;
|
|
111
|
+
value: string;
|
|
112
|
+
gas?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface PreparedTx {
|
|
115
|
+
unsigned_tx: UnsignedTx;
|
|
116
|
+
simulation: Simulation;
|
|
117
|
+
human_summary: string;
|
|
118
|
+
deeplink: string;
|
|
119
|
+
warnings: string[];
|
|
120
|
+
}
|
|
121
|
+
export interface ReadResult {
|
|
122
|
+
decoded: unknown[];
|
|
123
|
+
raw: Hex;
|
|
124
|
+
function_signature: string;
|
|
125
|
+
}
|
|
126
|
+
export interface EncodeResult {
|
|
127
|
+
data: Hex;
|
|
128
|
+
function_signature: string;
|
|
129
|
+
}
|
|
130
|
+
export interface DecodeTxResult {
|
|
131
|
+
chain: number;
|
|
132
|
+
tx_hash: string;
|
|
133
|
+
source: string;
|
|
134
|
+
cached: boolean;
|
|
135
|
+
decoded: unknown;
|
|
136
|
+
provenance: {
|
|
137
|
+
source: string;
|
|
138
|
+
confidence: "decompiled";
|
|
139
|
+
verified: false;
|
|
140
|
+
names_synthetic: true;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export interface ResolveNameResult {
|
|
144
|
+
address?: Address;
|
|
145
|
+
name?: string;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAE9C,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAGzC,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,qBAAqB,GAAG,OAAO,CAAC;AACzG,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,eAAe,CAAC;AACjF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,CAAC;AAClH,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,GAAG,gBAAgB,GAAG,QAAQ,GAAG,OAAO,CAAC;CACvD;AACD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,IAAI,CAAC;IACf,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,QAAQ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B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAGD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,GAAG,EAAE,GAAG,CAAC;IACT,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AACD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,GAAG,CAAC;IACV,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AACD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,YAAY,CAAC;QAAC,QAAQ,EAAE,KAAK,CAAC;QAAC,eAAe,EAAE,IAAI,CAAA;KAAE,CAAC;CAClG;AACD,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gulltoppr",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Typed client for gulltoppr — let agents interact with any contract on any EVM chain: resolve ABIs (even unverified), read, simulate, and prepare safe non-custodial transactions.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": ["dist", "README.md"],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc -p tsconfig.json",
|
|
18
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
19
|
+
"test": "vitest run"
|
|
20
|
+
},
|
|
21
|
+
"keywords": ["ethereum", "abi", "evm", "viem", "smart-contracts", "agents", "gulltoppr", "mcp"],
|
|
22
|
+
"homepage": "https://github.com/portdeveloper/gulltoppr",
|
|
23
|
+
"repository": { "type": "git", "url": "git+https://github.com/portdeveloper/gulltoppr.git", "directory": "sdk" },
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"viem": "^2"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"typescript": "^5.7.2",
|
|
30
|
+
"viem": "^2.21.55",
|
|
31
|
+
"vitest": "^2.1.8"
|
|
32
|
+
}
|
|
33
|
+
}
|