@cancore/contracts 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/LICENSE +202 -0
- package/README.md +112 -0
- package/dist/abi.d.ts +2613 -0
- package/dist/abi.js +3 -0
- package/dist/abi.js.map +1 -0
- package/dist/chunk-CIBYXHSX.js +92 -0
- package/dist/chunk-CIBYXHSX.js.map +1 -0
- package/dist/chunk-ZSX67S72.js +3423 -0
- package/dist/chunk-ZSX67S72.js.map +1 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -0
- package/dist/networks.d.ts +39 -0
- package/dist/networks.js +3 -0
- package/dist/networks.js.map +1 -0
- package/package.json +49 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export { CNRX_ABI, CNRX_ERRORS, FEE_VAULT_ABI, FEE_VAULT_ERRORS, HTLC_ABI, HTLC_ERRORS, IBURN_MINT_ERC20_ABI, IHTLC_ABI, IPERMIT2_ABI, MULTI_BALANCE_CHECKER_ABI } from './chunk-ZSX67S72.js';
|
|
2
|
+
export { NETWORKS, NETWORK_ALIASES, networkByChainId, networkKindOf, networkOf } from './chunk-CIBYXHSX.js';
|
|
3
|
+
|
|
4
|
+
// src/deployments.ts
|
|
5
|
+
var DEPLOYMENTS = {
|
|
6
|
+
mainnet: [
|
|
7
|
+
{ network: "ethereum", chainId: 1, htlc: "0xB3f8BD762fa2a895Ba8Cd35142b7b82b8b413F76", htlcBlock: 24699416, multiBalanceChecker: "0xe025CcCDf82F4165633C6033B7F13690B16c8a84" },
|
|
8
|
+
{ network: "bnb", chainId: 56, htlc: "0xB3f8BD762fa2a895Ba8Cd35142b7b82b8b413F76", htlcBlock: 87710517, multiBalanceChecker: "0xe025CcCDf82F4165633C6033B7F13690B16c8a84" },
|
|
9
|
+
{ network: "arbitrum", chainId: 42161, htlc: "0x1794fe17eB780619FAD46BAf80F7628F7495378b", htlcBlock: 443810007, multiBalanceChecker: "0x9ed2e0220e8d069C515972AE369C3FCE3bB29239" },
|
|
10
|
+
{ network: "robinhood", chainId: 4663, htlc: "0xB3f8BD762fa2a895Ba8Cd35142b7b82b8b413F76", htlcBlock: 26837336, multiBalanceChecker: "0x1794fe17eB780619FAD46BAf80F7628F7495378b" }
|
|
11
|
+
],
|
|
12
|
+
testnet: [
|
|
13
|
+
{ network: "sepolia", chainId: 11155111, htlc: "0xc705C735278AEeF773acb6d1028D8A241D8a9556", htlcBlock: 10334457, multiBalanceChecker: "0x99182E3F18555CFB08e6443e68a11982eF686522" },
|
|
14
|
+
{ network: "bnb_testnet", chainId: 97, htlc: "0x36D7BEBDB5f93b7b926D621E412132dF89628810", htlcBlock: 92435953, multiBalanceChecker: "0x079bDc94B34EC0e905DcfDB516bdE2f292Efcef2" },
|
|
15
|
+
{ network: "arbitrum_sepolia", chainId: 421614, htlc: "0x07a6ccF1f0113e2329Bb2460b28eC0d169f5080E", htlcBlock: 245190705, multiBalanceChecker: "0x555Bef5d2f89Fc81c77b930AB6c0D6734bDE569e" },
|
|
16
|
+
{ network: "robinhood_testnet", chainId: 46630, htlc: "0x5eBf3faAf3a86c37dDf6a46075b8366Ed4D8021A", htlcBlock: 96742769, multiBalanceChecker: "0x9548fd6fA8A3869b215E9D86F6a2628Bf2BEFB74" }
|
|
17
|
+
],
|
|
18
|
+
devnet: [
|
|
19
|
+
{ network: "sepolia", chainId: 11155111, htlc: "0xc74469B26206A7b3Aee2781EC21F9F47a1552DD6", htlcBlock: 10469876 },
|
|
20
|
+
{ network: "bnb_testnet", chainId: 97, htlc: "0xC649d578FD0122E2Ce3Bcf6b89E3ef2564d1a30D", htlcBlock: 96439032 },
|
|
21
|
+
{ network: "arbitrum_sepolia", chainId: 421614, htlc: "0xE23A046Df3542C4C548162adab4397956b136031", htlcBlock: 251260393 },
|
|
22
|
+
{ network: "robinhood_testnet", chainId: 46630, htlc: "0x58D154441Fd7efEd22E49Eda369909DdbE54cC0a", htlcBlock: 96651438, multiBalanceChecker: "0x1b2A32A976F904a1fca87D427239635Ccd97FaFb" }
|
|
23
|
+
]
|
|
24
|
+
};
|
|
25
|
+
var PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
26
|
+
function deploymentOf(env, network) {
|
|
27
|
+
return DEPLOYMENTS[env].find((d) => d.network === network);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/eip712.ts
|
|
31
|
+
var FEE_CLAIM_DOMAIN_NAME = "CancoreFeeVault";
|
|
32
|
+
var FEE_CLAIM_DOMAIN_VERSION = "1";
|
|
33
|
+
var FEE_CLAIM_TYPES = {
|
|
34
|
+
FeeClaim: [
|
|
35
|
+
{ name: "token", type: "address" },
|
|
36
|
+
{ name: "to", type: "address" },
|
|
37
|
+
{ name: "amount", type: "uint256" },
|
|
38
|
+
{ name: "nonce", type: "uint256" },
|
|
39
|
+
{ name: "deadline", type: "uint256" }
|
|
40
|
+
]
|
|
41
|
+
};
|
|
42
|
+
function feeClaimDomain(chainId, verifyingContract) {
|
|
43
|
+
return {
|
|
44
|
+
name: FEE_CLAIM_DOMAIN_NAME,
|
|
45
|
+
version: FEE_CLAIM_DOMAIN_VERSION,
|
|
46
|
+
chainId,
|
|
47
|
+
verifyingContract
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/generated/meta.ts
|
|
52
|
+
var CONTRACTS_RELEASE = {
|
|
53
|
+
"version": "1.4.0-dev",
|
|
54
|
+
"releaseChannel": "dev",
|
|
55
|
+
"updatedAt": "2026-07-24T19:55:00Z"
|
|
56
|
+
};
|
|
57
|
+
var BYTECODE_HASHES = {
|
|
58
|
+
"HTLC": {
|
|
59
|
+
"bytecodeHash": "17e8b4dfbb8cb7095ce9f0c0334a8f506233e70c3baa1c15784ccb594c5ba07f",
|
|
60
|
+
"deployedBytecodeHash": "86cff816f5875c8c5afefe9feb223c62ec5c0e2754606db2cecc96883c50c6a2",
|
|
61
|
+
"bytecodeLength": 14204,
|
|
62
|
+
"deployedBytecodeLength": 13914
|
|
63
|
+
},
|
|
64
|
+
"FeeVault": {
|
|
65
|
+
"bytecodeHash": "83785435a8a603143b3bbf0a68587a0df1f966bfdbb66b364ca4f39b9c276da4",
|
|
66
|
+
"deployedBytecodeHash": "e2458a305d0b8c4489cdf5cde2f1fa3411157292ffb7b2cfc95169550f093bec",
|
|
67
|
+
"bytecodeLength": 13680,
|
|
68
|
+
"deployedBytecodeLength": 11472
|
|
69
|
+
},
|
|
70
|
+
"MultiBalanceChecker": {
|
|
71
|
+
"bytecodeHash": "c0a0326694f2a1594e332ba06120692cc98bc06c57d6d8981cb3768e01fad423",
|
|
72
|
+
"deployedBytecodeHash": "93a1f0aa251715cc6a1b6a472f10762463b5c24668886630cbc6da5632e5739b",
|
|
73
|
+
"bytecodeLength": 2456,
|
|
74
|
+
"deployedBytecodeLength": 2394
|
|
75
|
+
},
|
|
76
|
+
"CNRX": {
|
|
77
|
+
"bytecodeHash": "61b4e114722e99f93aac4bd4ef3cfb7973dd050b66e6ffb326efad29d4cc8c95",
|
|
78
|
+
"deployedBytecodeHash": "2b23774e41fb25f820227a50de4f48d7ad79b0bd131c1956aab07c100e0c3948",
|
|
79
|
+
"bytecodeLength": 21266,
|
|
80
|
+
"deployedBytecodeLength": 17374
|
|
81
|
+
},
|
|
82
|
+
"BurnMintTokenPool": {
|
|
83
|
+
"bytecodeHash": "b5b19721149d9dd63e0650d0a1f95ac82affa4b9c650fdffd375db6ea361e416",
|
|
84
|
+
"deployedBytecodeHash": "c9aaa6a40ef4f0caadeb66f0a9adc68b1191949e9e0bdb420f331132bf651c3a",
|
|
85
|
+
"bytecodeLength": 41756,
|
|
86
|
+
"deployedBytecodeLength": 39936
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// src/index.ts
|
|
91
|
+
function describeRevert(selectorOrData, tables) {
|
|
92
|
+
const selector = selectorOrData.slice(0, 10).toLowerCase();
|
|
93
|
+
for (const table of tables) {
|
|
94
|
+
const hit = table[selector];
|
|
95
|
+
if (hit) return hit;
|
|
96
|
+
}
|
|
97
|
+
return void 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export { BYTECODE_HASHES, CONTRACTS_RELEASE, DEPLOYMENTS, FEE_CLAIM_DOMAIN_NAME, FEE_CLAIM_DOMAIN_VERSION, FEE_CLAIM_TYPES, PERMIT2_ADDRESS, deploymentOf, describeRevert, feeClaimDomain };
|
|
101
|
+
//# sourceMappingURL=index.js.map
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/deployments.ts","../src/eip712.ts","../src/generated/meta.ts","../src/index.ts"],"names":[],"mappings":";;;;AA0BO,IAAM,WAAA,GAAyE;AAAA,EACpF,OAAA,EAAS;AAAA,IACP,EAAE,OAAA,EAAS,UAAA,EAAY,OAAA,EAAS,CAAA,EAAG,MAAM,4CAAA,EAA8C,SAAA,EAAW,QAAA,EAAU,mBAAA,EAAqB,4CAAA,EAA6C;AAAA,IAC9K,EAAE,OAAA,EAAS,KAAA,EAAO,OAAA,EAAS,EAAA,EAAI,MAAM,4CAAA,EAA8C,SAAA,EAAW,QAAA,EAAU,mBAAA,EAAqB,4CAAA,EAA6C;AAAA,IAC1K,EAAE,OAAA,EAAS,UAAA,EAAY,OAAA,EAAS,KAAA,EAAO,MAAM,4CAAA,EAA8C,SAAA,EAAW,SAAA,EAAW,mBAAA,EAAqB,4CAAA,EAA6C;AAAA,IACnL,EAAE,OAAA,EAAS,WAAA,EAAa,OAAA,EAAS,IAAA,EAAM,MAAM,4CAAA,EAA8C,SAAA,EAAW,QAAA,EAAU,mBAAA,EAAqB,4CAAA;AAA6C,GACpL;AAAA,EACA,OAAA,EAAS;AAAA,IACP,EAAE,OAAA,EAAS,SAAA,EAAW,OAAA,EAAS,QAAA,EAAU,MAAM,4CAAA,EAA8C,SAAA,EAAW,QAAA,EA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AA,IACxB,gBAAA,EAAkB,KAAA;AAAA,IAClB,wBAAA,EAA0B;AAAA,GAC5B;AAAA,EACA,mBAAA,EAAqB;AAAA,IACnB,cAAA,EAAgB,kEAAA;AAAA,IAChB,sBAAA,EAAwB,kEAAA;AAAA,IACxB,gBAAA,EAAkB,KAAA;AAAA,IAClB,wBAAA,EAA0B;AAAA;AAE9B;;;AC5BO,SAAS,cAAA,CAAe,gBAAwB,MAAA,EAA6E;AAClI,EAAA,MAAM,WAAW,cAAA,CAAe,KAAA,CAAM,CAAA,EAAG,EAAE,EAAE,WAAA,EAAY;AACzD,EAAA,KAAA,MAAW,SAAS,MAAA,EAAQ;AAC1B,IAAA,MAAM,GAAA,GAAM,MAAM,QAAQ,CAAA;AAC1B,IAAA,IAAI,KAAK,OAAO,GAAA;AAAA,EAClB;AACA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["/**\n * Where the contracts are deployed, per environment.\n *\n * Three environments because three independent deployments: what is on Sepolia\n * for the dev stand is not what is on Sepolia for testnet. Pinned here per\n * release of this package, so an integrator on 0.1.x talks to the deployment\n * the backend of that period talks to; `htlcBlock` is where to start an event\n * scan, not before.\n *\n * `BYTECODE_HASHES` is the check: the runtime code at any `htlc` address below\n * hashes to `BYTECODE_HASHES.HTLC.deployedBytecodeHash` for the release it was\n * deployed from. An address alone is a claim; the hash is the proof.\n */\n\nexport type DeploymentEnv = 'mainnet' | 'testnet' | 'devnet';\n\nexport interface EvmDeployment {\n /** Key into `NETWORKS`. */\n network: string;\n chainId: number;\n htlc: `0x${string}`;\n /** Block the HTLC was deployed in — the floor for an event scan. */\n htlcBlock?: number;\n multiBalanceChecker?: `0x${string}`;\n}\n\nexport const DEPLOYMENTS: Readonly<Record<DeploymentEnv, readonly EvmDeployment[]>> = {\n mainnet: [\n { network: 'ethereum', chainId: 1, htlc: '0xB3f8BD762fa2a895Ba8Cd35142b7b82b8b413F76', htlcBlock: 24699416, multiBalanceChecker: '0xe025CcCDf82F4165633C6033B7F13690B16c8a84' },\n { network: 'bnb', chainId: 56, htlc: '0xB3f8BD762fa2a895Ba8Cd35142b7b82b8b413F76', htlcBlock: 87710517, multiBalanceChecker: '0xe025CcCDf82F4165633C6033B7F13690B16c8a84' },\n { network: 'arbitrum', chainId: 42161, htlc: '0x1794fe17eB780619FAD46BAf80F7628F7495378b', htlcBlock: 443810007, multiBalanceChecker: '0x9ed2e0220e8d069C515972AE369C3FCE3bB29239' },\n { network: 'robinhood', chainId: 4663, htlc: '0xB3f8BD762fa2a895Ba8Cd35142b7b82b8b413F76', htlcBlock: 26837336, multiBalanceChecker: '0x1794fe17eB780619FAD46BAf80F7628F7495378b' },\n ],\n testnet: [\n { network: 'sepolia', chainId: 11155111, htlc: '0xc705C735278AEeF773acb6d1028D8A241D8a9556', htlcBlock: 10334457, multiBalanceChecker: '0x99182E3F18555CFB08e6443e68a11982eF686522' },\n { network: 'bnb_testnet', chainId: 97, htlc: '0x36D7BEBDB5f93b7b926D621E412132dF89628810', htlcBlock: 92435953, multiBalanceChecker: '0x079bDc94B34EC0e905DcfDB516bdE2f292Efcef2' },\n { network: 'arbitrum_sepolia', chainId: 421614, htlc: '0x07a6ccF1f0113e2329Bb2460b28eC0d169f5080E', htlcBlock: 245190705, multiBalanceChecker: '0x555Bef5d2f89Fc81c77b930AB6c0D6734bDE569e' },\n { network: 'robinhood_testnet', chainId: 46630, htlc: '0x5eBf3faAf3a86c37dDf6a46075b8366Ed4D8021A', htlcBlock: 96742769, multiBalanceChecker: '0x9548fd6fA8A3869b215E9D86F6a2628Bf2BEFB74' },\n ],\n devnet: [\n { network: 'sepolia', chainId: 11155111, htlc: '0xc74469B26206A7b3Aee2781EC21F9F47a1552DD6', htlcBlock: 10469876 },\n { network: 'bnb_testnet', chainId: 97, htlc: '0xC649d578FD0122E2Ce3Bcf6b89E3ef2564d1a30D', htlcBlock: 96439032 },\n { network: 'arbitrum_sepolia', chainId: 421614, htlc: '0xE23A046Df3542C4C548162adab4397956b136031', htlcBlock: 251260393 },\n { network: 'robinhood_testnet', chainId: 46630, htlc: '0x58D154441Fd7efEd22E49Eda369909DdbE54cC0a', htlcBlock: 96651438, multiBalanceChecker: '0x1b2A32A976F904a1fca87D427239635Ccd97FaFb' },\n ],\n};\n\n/** Uniswap Permit2 — one canonical address across mainnets. */\nexport const PERMIT2_ADDRESS = '0x000000000022D473030F116dDEE9F6B43aC78BA3' as const;\n\nexport function deploymentOf(env: DeploymentEnv, network: string): EvmDeployment | undefined {\n return DEPLOYMENTS[env].find((d) => d.network === network);\n}\n","/**\n * The EIP-712 voucher `FeeVault.redeem` accepts: a signer the vault trusts\n * signs `FeeClaim` over this domain, and whoever holds the signature redeems it\n * on-chain. The struct and the domain are the contract's — this file has to\n * stay in lock-step with `FeeVault.sol` and with the backend's signer, which is\n * why both are written here once rather than re-typed by each consumer.\n */\n\nexport const FEE_CLAIM_DOMAIN_NAME = 'CancoreFeeVault';\nexport const FEE_CLAIM_DOMAIN_VERSION = '1';\n\n/** `FeeClaim(address token,address to,uint256 amount,uint256 nonce,uint256 deadline)` */\nexport const FEE_CLAIM_TYPES = {\n FeeClaim: [\n { name: 'token', type: 'address' },\n { name: 'to', type: 'address' },\n { name: 'amount', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n} as const;\n\nexport interface FeeClaim {\n token: `0x${string}`;\n to: `0x${string}`;\n amount: bigint;\n nonce: bigint;\n deadline: bigint;\n}\n\n/** The typed-data domain for one FeeVault deployment. */\nexport function feeClaimDomain(chainId: number, verifyingContract: `0x${string}`) {\n return {\n name: FEE_CLAIM_DOMAIN_NAME,\n version: FEE_CLAIM_DOMAIN_VERSION,\n chainId,\n verifyingContract,\n } as const;\n}\n","// Generated by scripts/sync.mjs from evm-contracts/version.json and abi/bytecode-hashes.json.\n\n/** The evm-contracts release these ABIs were taken from. */\nexport const CONTRACTS_RELEASE = {\n \"version\": \"1.4.0-dev\",\n \"releaseChannel\": \"dev\",\n \"updatedAt\": \"2026-07-24T19:55:00Z\"\n} as const;\n\n/**\n * keccak256 of the compiled creation and runtime bytecode per contract — what a\n * deployment can be checked against, independent of any address list.\n */\nexport const BYTECODE_HASHES = {\n \"HTLC\": {\n \"bytecodeHash\": \"17e8b4dfbb8cb7095ce9f0c0334a8f506233e70c3baa1c15784ccb594c5ba07f\",\n \"deployedBytecodeHash\": \"86cff816f5875c8c5afefe9feb223c62ec5c0e2754606db2cecc96883c50c6a2\",\n \"bytecodeLength\": 14204,\n \"deployedBytecodeLength\": 13914\n },\n \"FeeVault\": {\n \"bytecodeHash\": \"83785435a8a603143b3bbf0a68587a0df1f966bfdbb66b364ca4f39b9c276da4\",\n \"deployedBytecodeHash\": \"e2458a305d0b8c4489cdf5cde2f1fa3411157292ffb7b2cfc95169550f093bec\",\n \"bytecodeLength\": 13680,\n \"deployedBytecodeLength\": 11472\n },\n \"MultiBalanceChecker\": {\n \"bytecodeHash\": \"c0a0326694f2a1594e332ba06120692cc98bc06c57d6d8981cb3768e01fad423\",\n \"deployedBytecodeHash\": \"93a1f0aa251715cc6a1b6a472f10762463b5c24668886630cbc6da5632e5739b\",\n \"bytecodeLength\": 2456,\n \"deployedBytecodeLength\": 2394\n },\n \"CNRX\": {\n \"bytecodeHash\": \"61b4e114722e99f93aac4bd4ef3cfb7973dd050b66e6ffb326efad29d4cc8c95\",\n \"deployedBytecodeHash\": \"2b23774e41fb25f820227a50de4f48d7ad79b0bd131c1956aab07c100e0c3948\",\n \"bytecodeLength\": 21266,\n \"deployedBytecodeLength\": 17374\n },\n \"BurnMintTokenPool\": {\n \"bytecodeHash\": \"b5b19721149d9dd63e0650d0a1f95ac82affa4b9c650fdffd375db6ea361e416\",\n \"deployedBytecodeHash\": \"c9aaa6a40ef4f0caadeb66f0a9adc68b1191949e9e0bdb420f331132bf651c3a\",\n \"bytecodeLength\": 41756,\n \"deployedBytecodeLength\": 39936\n }\n} as const;\n","/**\n * `@cancore/contracts` — the Cancore EVM contracts as data.\n *\n * ABIs (`./abi`), the network registry (`./networks`), the EIP-712 voucher and\n * the release identity — no runtime code, no dependencies. What an integrator\n * needs to talk to the contracts without copying files out of our repositories,\n * and what our own frontend, backend and MCP server can stop carrying four\n * separate copies of.\n */\nexport * from './abi';\nexport * from './networks';\nexport * from './deployments';\nexport * from './eip712';\nexport { BYTECODE_HASHES, CONTRACTS_RELEASE } from './generated/meta';\n\n/** Decode a revert's 4-byte selector into the custom error it names, if it is one of ours. */\nexport function describeRevert(selectorOrData: string, tables: ReadonlyArray<Readonly<Record<string, string>>>): string | undefined {\n const selector = selectorOrData.slice(0, 10).toLowerCase();\n for (const table of tables) {\n const hit = table[selector];\n if (hit) return hit;\n }\n return undefined;\n}\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@cancore/contracts/networks` — the chains Cancore settles on, by the ids the
|
|
3
|
+
* API uses (`sourceNetwork`, `targetNetwork` in an order are these keys).
|
|
4
|
+
*
|
|
5
|
+
* Three kinds, because three address formats and three signing models:
|
|
6
|
+
* `evm` (0x…, EIP-155 chain id), `tron` (base58, same Solidity, no chain id in
|
|
7
|
+
* the EVM sense), `canton` (party ids, no addresses at all). A caller that
|
|
8
|
+
* branches on `kind` instead of on the id keeps working when a chain is added.
|
|
9
|
+
*
|
|
10
|
+
* Contract addresses live next door in `DEPLOYMENTS`, keyed by environment —
|
|
11
|
+
* dev, testnet and mainnet each have their own HTLC — and `BYTECODE_HASHES`
|
|
12
|
+
* (from `.`) is how a deployment at any of those addresses is verified.
|
|
13
|
+
*/
|
|
14
|
+
type NetworkKind = 'evm' | 'tron' | 'canton';
|
|
15
|
+
interface Network {
|
|
16
|
+
/** The id the Cancore API uses for this chain. */
|
|
17
|
+
id: string;
|
|
18
|
+
kind: NetworkKind;
|
|
19
|
+
name: string;
|
|
20
|
+
/** EIP-155 chain id; absent for Tron and Canton. */
|
|
21
|
+
chainId?: number;
|
|
22
|
+
/** Where a transaction or address of this chain can be looked at. */
|
|
23
|
+
explorerUrl?: string;
|
|
24
|
+
nativeCurrency?: {
|
|
25
|
+
name: string;
|
|
26
|
+
symbol: string;
|
|
27
|
+
decimals: number;
|
|
28
|
+
};
|
|
29
|
+
testnet: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare const NETWORKS: Readonly<Record<string, Network>>;
|
|
32
|
+
/** `eth` is an older alias of `ethereum` still seen in order payloads. */
|
|
33
|
+
declare const NETWORK_ALIASES: Readonly<Record<string, string>>;
|
|
34
|
+
declare function networkOf(id: string): Network | undefined;
|
|
35
|
+
declare function networkKindOf(id: string): NetworkKind | undefined;
|
|
36
|
+
/** The network for an EIP-155 chain id, e.g. from a wallet's `eth_chainId`. */
|
|
37
|
+
declare function networkByChainId(chainId: number): Network | undefined;
|
|
38
|
+
|
|
39
|
+
export { NETWORKS, NETWORK_ALIASES, type Network, type NetworkKind, networkByChainId, networkKindOf, networkOf };
|
package/dist/networks.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"networks.js"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cancore/contracts",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "The Cancore EVM contracts as data: ABIs of the deployed HTLC, FeeVault and CNRX contracts, their custom-error selectors, the EIP-712 FeeClaim voucher, the network registry. No runtime code, no dependencies.",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./abi": {
|
|
13
|
+
"types": "./dist/abi.d.ts",
|
|
14
|
+
"import": "./dist/abi.js",
|
|
15
|
+
"default": "./dist/abi.js"
|
|
16
|
+
},
|
|
17
|
+
"./networks": {
|
|
18
|
+
"types": "./dist/networks.d.ts",
|
|
19
|
+
"import": "./dist/networks.js",
|
|
20
|
+
"default": "./dist/networks.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"license": "Apache-2.0",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/Cancore-io/sdk.git",
|
|
30
|
+
"directory": "packages/contracts"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://docs.cancore.io/sdk/contracts",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/Cancore-io/sdk/issues"
|
|
35
|
+
},
|
|
36
|
+
"keywords": ["canton", "cancore", "abi", "htlc", "evm", "eip-712", "contracts"],
|
|
37
|
+
"files": ["dist", "README.md", "LICENSE"],
|
|
38
|
+
"publishConfig": { "access": "public" },
|
|
39
|
+
"engines": { "node": ">=20" },
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup",
|
|
42
|
+
"prepack": "tsup --silent",
|
|
43
|
+
"prepublishOnly": "npm run build",
|
|
44
|
+
"sync": "node scripts/sync.mjs"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@noble/hashes": "^1.3.2"
|
|
48
|
+
}
|
|
49
|
+
}
|