@aboutcircles/sdk-runner 0.1.27 → 0.1.29
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/chain-types.d.ts +84 -0
- package/dist/chain-types.d.ts.map +1 -0
- package/dist/chain-types.js +63 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6953 -1467
- package/dist/safe-browser-runner.d.ts +19 -8
- package/dist/safe-browser-runner.d.ts.map +1 -1
- package/dist/safe-browser-runner.js +14 -9
- package/dist/safe-runner.d.ts +18 -6
- package/dist/safe-runner.d.ts.map +1 -1
- package/dist/safe-runner.js +14 -8
- package/package.json +3 -2
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Chain } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* Flexible chain configuration interface.
|
|
4
|
+
* Accepts both full viem Chain objects and minimal chain configs.
|
|
5
|
+
* This allows the runner to work without requiring the exact viem Chain branded type.
|
|
6
|
+
*/
|
|
7
|
+
export interface ChainConfig {
|
|
8
|
+
id: number;
|
|
9
|
+
name: string;
|
|
10
|
+
nativeCurrency: {
|
|
11
|
+
name: string;
|
|
12
|
+
symbol: string;
|
|
13
|
+
decimals: number;
|
|
14
|
+
};
|
|
15
|
+
rpcUrls: {
|
|
16
|
+
default: {
|
|
17
|
+
http: readonly string[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Type that accepts either a full viem Chain or our minimal ChainConfig.
|
|
23
|
+
* This provides flexibility while maintaining type safety.
|
|
24
|
+
*/
|
|
25
|
+
export type ChainLike = Chain | ChainConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Validates that a ChainLike object has the required fields for viem's createPublicClient.
|
|
28
|
+
* Throws an error if required fields are missing, making failures explicit.
|
|
29
|
+
*
|
|
30
|
+
* @param chain - The chain configuration to validate
|
|
31
|
+
* @returns The chain cast to viem's expected type
|
|
32
|
+
* @throws Error if required fields are missing
|
|
33
|
+
*/
|
|
34
|
+
export declare function asViemChain(chain: ChainLike): Chain;
|
|
35
|
+
/**
|
|
36
|
+
* Pre-configured chain configs for common networks.
|
|
37
|
+
* Use these instead of importing from viem/chains to avoid type mismatches.
|
|
38
|
+
*/
|
|
39
|
+
export declare const chains: {
|
|
40
|
+
readonly gnosis: {
|
|
41
|
+
id: number;
|
|
42
|
+
name: string;
|
|
43
|
+
nativeCurrency: {
|
|
44
|
+
name: string;
|
|
45
|
+
symbol: string;
|
|
46
|
+
decimals: number;
|
|
47
|
+
};
|
|
48
|
+
rpcUrls: {
|
|
49
|
+
default: {
|
|
50
|
+
http: readonly ["https://rpc.gnosischain.com"];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
readonly chiado: {
|
|
55
|
+
id: number;
|
|
56
|
+
name: string;
|
|
57
|
+
nativeCurrency: {
|
|
58
|
+
name: string;
|
|
59
|
+
symbol: string;
|
|
60
|
+
decimals: number;
|
|
61
|
+
};
|
|
62
|
+
rpcUrls: {
|
|
63
|
+
default: {
|
|
64
|
+
http: readonly ["https://rpc.chiadochain.net"];
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/** Alias for chiado - common testnet naming convention */
|
|
69
|
+
readonly gnosisChiado: {
|
|
70
|
+
id: number;
|
|
71
|
+
name: string;
|
|
72
|
+
nativeCurrency: {
|
|
73
|
+
name: string;
|
|
74
|
+
symbol: string;
|
|
75
|
+
decimals: number;
|
|
76
|
+
};
|
|
77
|
+
rpcUrls: {
|
|
78
|
+
default: {
|
|
79
|
+
http: readonly ["https://rpc.chiadochain.net"];
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=chain-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-types.d.ts","sourceRoot":"","sources":["../src/chain-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAElC;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;SACzB,CAAC;KACH,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,WAAW,CAAC;AAE5C;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,CAiBnD;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+BjB,0DAA0D;;;;;;;;;;;;;;;CAIlD,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates that a ChainLike object has the required fields for viem's createPublicClient.
|
|
3
|
+
* Throws an error if required fields are missing, making failures explicit.
|
|
4
|
+
*
|
|
5
|
+
* @param chain - The chain configuration to validate
|
|
6
|
+
* @returns The chain cast to viem's expected type
|
|
7
|
+
* @throws Error if required fields are missing
|
|
8
|
+
*/
|
|
9
|
+
export function asViemChain(chain) {
|
|
10
|
+
// Validate required fields exist at runtime
|
|
11
|
+
if (typeof chain.id !== 'number') {
|
|
12
|
+
throw new Error('Chain config missing required field: id');
|
|
13
|
+
}
|
|
14
|
+
if (typeof chain.name !== 'string') {
|
|
15
|
+
throw new Error('Chain config missing required field: name');
|
|
16
|
+
}
|
|
17
|
+
if (!chain.nativeCurrency || typeof chain.nativeCurrency.decimals !== 'number') {
|
|
18
|
+
throw new Error('Chain config missing required field: nativeCurrency');
|
|
19
|
+
}
|
|
20
|
+
if (!chain.rpcUrls?.default?.http?.length) {
|
|
21
|
+
throw new Error('Chain config missing required field: rpcUrls.default.http');
|
|
22
|
+
}
|
|
23
|
+
// Cast is safe after validation - ChainConfig satisfies viem's runtime requirements
|
|
24
|
+
return chain;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Pre-configured chain configs for common networks.
|
|
28
|
+
* Use these instead of importing from viem/chains to avoid type mismatches.
|
|
29
|
+
*/
|
|
30
|
+
export const chains = {
|
|
31
|
+
gnosis: {
|
|
32
|
+
id: 100,
|
|
33
|
+
name: 'Gnosis',
|
|
34
|
+
nativeCurrency: {
|
|
35
|
+
name: 'xDAI',
|
|
36
|
+
symbol: 'xDAI',
|
|
37
|
+
decimals: 18,
|
|
38
|
+
},
|
|
39
|
+
rpcUrls: {
|
|
40
|
+
default: {
|
|
41
|
+
http: ['https://rpc.gnosischain.com'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
chiado: {
|
|
46
|
+
id: 10200,
|
|
47
|
+
name: 'Chiado',
|
|
48
|
+
nativeCurrency: {
|
|
49
|
+
name: 'xDAI',
|
|
50
|
+
symbol: 'xDAI',
|
|
51
|
+
decimals: 18,
|
|
52
|
+
},
|
|
53
|
+
rpcUrls: {
|
|
54
|
+
default: {
|
|
55
|
+
http: ['https://rpc.chiadochain.net'],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
/** Alias for chiado - common testnet naming convention */
|
|
60
|
+
get gnosisChiado() {
|
|
61
|
+
return this.chiado;
|
|
62
|
+
},
|
|
63
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
export type { ContractRunner, BatchRun } from './runner.js';
|
|
8
8
|
export { SafeContractRunner, SafeBatchRun } from './safe-runner.js';
|
|
9
9
|
export { SafeBrowserRunner, SafeBrowserBatchRun } from './safe-browser-runner.js';
|
|
10
|
+
export type { ChainConfig, ChainLike } from './chain-types';
|
|
11
|
+
export { chains, asViemChain } from './chain-types';
|
|
10
12
|
export { RunnerError } from './errors.js';
|
|
11
13
|
export type { RunnerErrorSource } from './errors.js';
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGpE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGlF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGpE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGlF,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|