@sign-global/tokentable-core 1.14.0 → 1.14.2
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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +72 -1
- package/dist/index.d.ts +72 -1
- package/dist/index.js +36 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/constants/chain-config.ts +6 -0
- package/src/constants/network.ts +29 -0
- package/src/contracts/sui/SuiContractClient.ts +1 -1
- package/src/contracts/sui/__tests__/SuiContractClient.test.ts +48 -0
package/package.json
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import {
|
|
23
23
|
aptosTestNet,
|
|
24
24
|
hyperEVM,
|
|
25
|
+
megaeth,
|
|
25
26
|
mevmDevNet,
|
|
26
27
|
signBrBTestnet,
|
|
27
28
|
solanaDevNet,
|
|
@@ -43,6 +44,7 @@ export const SupportedChains = [
|
|
|
43
44
|
monad,
|
|
44
45
|
cronos,
|
|
45
46
|
memecore,
|
|
47
|
+
megaeth,
|
|
46
48
|
tonTestNet,
|
|
47
49
|
tonMainNet,
|
|
48
50
|
signBrBTestnet,
|
|
@@ -88,6 +90,10 @@ export const ChainConfig: Record<SupportedChainIds, ChainConfigItem> = {
|
|
|
88
90
|
contractAddress: '0xa6A2d42E16a690E03bDe181319fDD085880F2605',
|
|
89
91
|
rpcUrl: memecore.rpcUrls.default.http[0]
|
|
90
92
|
},
|
|
93
|
+
[megaeth.id]: {
|
|
94
|
+
contractAddress: '0xa6A2d42E16a690E03bDe181319fDD085880F2605',
|
|
95
|
+
rpcUrl: megaeth.rpcUrls.default.http[0]
|
|
96
|
+
},
|
|
91
97
|
[cyber.id]: {
|
|
92
98
|
contractAddress: '0x7915dA247674E430b2a4Dcf01e4471f709428Bc0',
|
|
93
99
|
rpcUrl: cyber.rpcUrls.default.http[0]
|
package/src/constants/network.ts
CHANGED
|
@@ -254,3 +254,32 @@ export const hyperEVM = defineChain({
|
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
});
|
|
257
|
+
|
|
258
|
+
export const megaeth = /*#__PURE__*/ defineChain({
|
|
259
|
+
id: 4326,
|
|
260
|
+
blockTime: 1_000,
|
|
261
|
+
name: 'MegaETH',
|
|
262
|
+
nativeCurrency: {
|
|
263
|
+
name: 'Ether',
|
|
264
|
+
symbol: 'ETH',
|
|
265
|
+
decimals: 18
|
|
266
|
+
},
|
|
267
|
+
rpcUrls: {
|
|
268
|
+
default: {
|
|
269
|
+
http: ['https://mainnet.megaeth.com/rpc'],
|
|
270
|
+
webSocket: ['wss://mainnet.megaeth.com/ws']
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
blockExplorers: {
|
|
274
|
+
default: {
|
|
275
|
+
name: 'Blockscout',
|
|
276
|
+
url: 'https://megaeth.blockscout.com',
|
|
277
|
+
apiUrl: 'https://megaeth.blockscout.com/api'
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
contracts: {
|
|
281
|
+
multicall3: {
|
|
282
|
+
address: '0xcA11bde05977b3631167028862bE2a173976CA11'
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
});
|
|
@@ -26,7 +26,7 @@ export abstract class SuiContractClientBase {
|
|
|
26
26
|
this.moduleName = contractInfo.moduleName;
|
|
27
27
|
this.distributorId = contractInfo.distributorId;
|
|
28
28
|
this.wallet = contractInfo.walletClient;
|
|
29
|
-
this.client = new SuiClient({ network: this.chainId, url: getFullnodeUrl(this.chainId) });
|
|
29
|
+
this.client = new SuiClient({ network: this.chainId, url: contractInfo.chainRpc || getFullnodeUrl(this.chainId) });
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
async signAndExecute(tx: Transaction) {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
|
|
3
|
+
const suiClientArgs = vi.fn();
|
|
4
|
+
|
|
5
|
+
vi.mock('@mysten/sui/client', () => ({
|
|
6
|
+
SuiClient: class {
|
|
7
|
+
constructor(args: { network: string; url: string }) {
|
|
8
|
+
suiClientArgs(args);
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
getFullnodeUrl: (network: string) => `https://fullnode.${network}.sui.io:443`
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
import { SuiContractClientBase, SuiContractInfo } from '../SuiContractClient';
|
|
15
|
+
|
|
16
|
+
class TestClient extends SuiContractClientBase {}
|
|
17
|
+
|
|
18
|
+
const baseInfo: SuiContractInfo & { moduleName: string } = {
|
|
19
|
+
packageId: '0xb15f286ba26aa10fc237c2c905fe630c840947234fe0b307b93deae271967380',
|
|
20
|
+
chainId: 'mainnet',
|
|
21
|
+
moduleName: 'distributor',
|
|
22
|
+
coinType: '0x2::sui::SUI',
|
|
23
|
+
walletClient: null as any
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
describe('SuiContractClientBase RPC selection', () => {
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
suiClientArgs.mockClear();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('uses chainRpc when provided', () => {
|
|
32
|
+
new TestClient({ ...baseInfo, chainRpc: 'https://sui-mainnet.g.alchemy.com/v2/key' });
|
|
33
|
+
|
|
34
|
+
expect(suiClientArgs).toHaveBeenCalledWith({
|
|
35
|
+
network: 'mainnet',
|
|
36
|
+
url: 'https://sui-mainnet.g.alchemy.com/v2/key'
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('falls back to the public fullnode when chainRpc is absent', () => {
|
|
41
|
+
new TestClient(baseInfo);
|
|
42
|
+
|
|
43
|
+
expect(suiClientArgs).toHaveBeenCalledWith({
|
|
44
|
+
network: 'mainnet',
|
|
45
|
+
url: 'https://fullnode.mainnet.sui.io:443'
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|