@xyo-network/chain-sdk 1.8.4 → 1.10.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/dist/browser/index-browser.mjs.map +1 -1
- package/dist/node/index-node.mjs +38 -38
- package/dist/node/index-node.mjs.map +1 -1
- package/package.json +35 -35
- package/src/e2e/spec/EvmBlockRewardService.spec.ts +4 -3
- package/src/e2e/spec/EvmChainService.spec.ts +2 -2
- package/src/test/evm/setup.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index-browser.ts","../../src/index-shared.ts"],"sourcesContent":["export * from './index-shared.ts'\n","export * from '@xyo-network/chain-ethereum'\nexport * from '@xyo-network/chain-modules'\nexport * from '@xyo-network/chain-orchestration'\nexport * from '@xyo-network/chain-protocol'\nexport * from '@xyo-network/chain-services'\nexport * from '@xyo-network/chain-utils'\nexport * from '@xyo-network/chain-validation'\nexport * from '@xyo-network/xl1-protocol'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;;ACAA
|
|
1
|
+
{"version":3,"sources":["../../src/index-browser.ts","../../src/index-shared.ts"],"sourcesContent":["export * from './index-shared.ts'\n","export * from '@xyo-network/chain-ethereum'\nexport * from '@xyo-network/chain-modules'\nexport * from '@xyo-network/chain-orchestration'\nexport * from '@xyo-network/chain-protocol'\nexport * from '@xyo-network/chain-services'\nexport * from '@xyo-network/chain-utils'\nexport * from '@xyo-network/chain-validation'\nexport * from '@xyo-network/xl1-protocol'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;;ACAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,qCAAc;AACd,oCAAc;AACd,0CAAc;AACd,qCAAc;AACd,qCAAc;AACd,kCAAc;AACd,uCAAc;AACd,mCAAc;;;ADPd,kCAAc;","names":[]}
|
package/dist/node/index-node.mjs
CHANGED
|
@@ -2,7 +2,6 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -64,26 +63,18 @@ async function isGanacheRunning(url) {
|
|
|
64
63
|
return false;
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
|
-
__name(isGanacheRunning, "isGanacheRunning");
|
|
68
66
|
async function startGanache(port, mnemonic) {
|
|
69
67
|
console.log("Starting Ganache CLI...");
|
|
70
|
-
const ganacheProcess = spawn(
|
|
71
|
-
"
|
|
72
|
-
"--port",
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"1337",
|
|
76
|
-
"--mnemonic",
|
|
77
|
-
mnemonic
|
|
78
|
-
], {
|
|
79
|
-
stdio: "inherit"
|
|
80
|
-
});
|
|
68
|
+
const ganacheProcess = spawn(
|
|
69
|
+
"yarn",
|
|
70
|
+
["ganache", "--port", `${port}`, "--chain.chainId", "1337", "--mnemonic", mnemonic],
|
|
71
|
+
{ stdio: "inherit" }
|
|
72
|
+
);
|
|
81
73
|
while (!await isGanacheRunning(`http://127.0.0.1:${port}`)) {
|
|
82
74
|
await delay(500);
|
|
83
75
|
}
|
|
84
76
|
return ganacheProcess;
|
|
85
77
|
}
|
|
86
|
-
__name(startGanache, "startGanache");
|
|
87
78
|
function stopGanache(process) {
|
|
88
79
|
console.log("Stopping Ganache CLI...");
|
|
89
80
|
if (process) {
|
|
@@ -91,7 +82,6 @@ function stopGanache(process) {
|
|
|
91
82
|
console.log("Ganache CLI stopped.");
|
|
92
83
|
}
|
|
93
84
|
}
|
|
94
|
-
__name(stopGanache, "stopGanache");
|
|
95
85
|
|
|
96
86
|
// src/test/evm/stakingContractUtils.ts
|
|
97
87
|
import { assertEx } from "@xylabs/assert";
|
|
@@ -107,13 +97,14 @@ import { getAddress } from "ethers/address";
|
|
|
107
97
|
import { JsonRpcProvider as JsonRpcProvider2 } from "ethers/providers";
|
|
108
98
|
import { parseUnits } from "ethers/utils";
|
|
109
99
|
import { Wallet } from "ethers/wallet";
|
|
110
|
-
var gasConfig =
|
|
100
|
+
var gasConfig = () => {
|
|
111
101
|
return {
|
|
112
102
|
gasLimit: 2e6,
|
|
103
|
+
// Set the gas limit
|
|
113
104
|
gasPrice: parseUnits("100", "gwei")
|
|
114
105
|
};
|
|
115
|
-
}
|
|
116
|
-
var createTestErc20 =
|
|
106
|
+
};
|
|
107
|
+
var createTestErc20 = async (ganachePort, testPhrase, contractCreator) => {
|
|
117
108
|
const provider = new JsonRpcProvider2(`http://127.0.0.1:${ganachePort}`, 1337);
|
|
118
109
|
const ethWallet = new Wallet(contractCreator.privateKey, provider);
|
|
119
110
|
const erc20 = new Erc20Factory(ethWallet);
|
|
@@ -124,8 +115,8 @@ var createTestErc20 = /* @__PURE__ */ __name(async (ganachePort, testPhrase, con
|
|
|
124
115
|
const balance = await erc20ContractPerson0.balanceOf(ethWallet.address);
|
|
125
116
|
assertEx(balance === totalSupply, () => "Balance does not match total supply");
|
|
126
117
|
return assertEx(asAddress(erc20Address), () => "Invalid ERC20 contract address");
|
|
127
|
-
}
|
|
128
|
-
var transferTestTokens =
|
|
118
|
+
};
|
|
119
|
+
var transferTestTokens = async (ganachePort, erc20Address, account0, account1) => {
|
|
129
120
|
const provider0 = new JsonRpcProvider2(`http://127.0.0.1:${ganachePort}`, 1337);
|
|
130
121
|
const ethWalletPerson0 = new Wallet(account0.privateKey, provider0);
|
|
131
122
|
const provider1 = new JsonRpcProvider2(`http://127.0.0.1:${ganachePort}`, 1337);
|
|
@@ -136,42 +127,51 @@ var transferTestTokens = /* @__PURE__ */ __name(async (ganachePort, erc20Address
|
|
|
136
127
|
const erc20ContractPerson1 = Erc20Factory.connect(getAddress(erc20Address), ethWalletPerson1);
|
|
137
128
|
const balance = await erc20ContractPerson1.balanceOf(ethWalletPerson1.address);
|
|
138
129
|
assertEx(balance === transferAmount, () => "Balance does not match transfer amount");
|
|
139
|
-
}
|
|
140
|
-
var createTestChainContract =
|
|
130
|
+
};
|
|
131
|
+
var createTestChainContract = async (ganachePort, erc20Address, account0, initialProducer) => {
|
|
141
132
|
const provider0 = new JsonRpcProvider2(`http://127.0.0.1:${ganachePort}`, 1337);
|
|
142
133
|
const ethWalletPerson0 = new Wallet(account0.privateKey, provider0);
|
|
143
|
-
const [xyoChainContractAddress] = await createChain(
|
|
134
|
+
const [xyoChainContractAddress] = await createChain(
|
|
135
|
+
ethWalletPerson0,
|
|
136
|
+
erc20Address,
|
|
137
|
+
initialProducer,
|
|
138
|
+
XYO_ZERO_ADDRESS,
|
|
139
|
+
0n,
|
|
140
|
+
XYO_ZERO_ADDRESS,
|
|
141
|
+
50000n,
|
|
142
|
+
gasConfig()
|
|
143
|
+
);
|
|
144
144
|
return assertEx(asAddress(xyoChainContractAddress), () => "Invalid staking contract address");
|
|
145
|
-
}
|
|
146
|
-
var approveTestStakeChainAddress =
|
|
145
|
+
};
|
|
146
|
+
var approveTestStakeChainAddress = async (ganachePort, erc20Address, xyoChainContractAddress, account1) => {
|
|
147
147
|
const provider1 = new JsonRpcProvider2(`http://127.0.0.1:${ganachePort}`, 1337);
|
|
148
148
|
const ethWalletPerson1 = new Wallet(account1.privateKey, provider1);
|
|
149
149
|
const erc20ContractPerson1 = Erc20Factory.connect(getAddress(erc20Address), ethWalletPerson1);
|
|
150
150
|
const _approveResultTx = await (await erc20ContractPerson1.approve(getAddress(xyoChainContractAddress), parseUnits("100", 18), gasConfig())).wait();
|
|
151
|
-
}
|
|
152
|
-
var createTestGenesisBlock =
|
|
151
|
+
};
|
|
152
|
+
var createTestGenesisBlock = async (blockProducerAccounts) => {
|
|
153
153
|
const randomChainId = (await Account.random()).address;
|
|
154
154
|
const signedStakedBlockProducerIntents = await Promise.all(blockProducerAccounts.map(async (blockProducerAccount) => {
|
|
155
|
-
const stakeIntent = new PayloadBuilder({
|
|
156
|
-
schema: ChainStakeIntentSchema
|
|
157
|
-
}).fields({
|
|
155
|
+
const stakeIntent = new PayloadBuilder({ schema: ChainStakeIntentSchema }).fields({
|
|
158
156
|
from: blockProducerAccount.address,
|
|
159
157
|
exp: Number.MAX_SAFE_INTEGER,
|
|
160
158
|
nbf: 0,
|
|
161
159
|
intent: "producer"
|
|
162
160
|
}).build();
|
|
163
|
-
const signedStakedBlockProducerIntent = await buildTransaction(
|
|
164
|
-
|
|
165
|
-
|
|
161
|
+
const signedStakedBlockProducerIntent = await buildTransaction(
|
|
162
|
+
randomChainId,
|
|
163
|
+
[stakeIntent],
|
|
164
|
+
[],
|
|
165
|
+
blockProducerAccount,
|
|
166
|
+
0,
|
|
167
|
+
1e3
|
|
168
|
+
);
|
|
166
169
|
return signedStakedBlockProducerIntent;
|
|
167
170
|
}));
|
|
168
171
|
const intents = signedStakedBlockProducerIntents.map((intent) => intent[0]);
|
|
169
172
|
const payloads = signedStakedBlockProducerIntents.flatMap((intent) => intent[1]);
|
|
170
|
-
return await buildGenesisBlock(randomChainId, signedStakedBlockProducerIntents, [
|
|
171
|
-
|
|
172
|
-
...payloads
|
|
173
|
-
], blockProducerAccounts);
|
|
174
|
-
}, "createTestGenesisBlock");
|
|
173
|
+
return await buildGenesisBlock(randomChainId, signedStakedBlockProducerIntents, [...intents, ...payloads], blockProducerAccounts);
|
|
174
|
+
};
|
|
175
175
|
export {
|
|
176
176
|
approveTestStakeChainAddress,
|
|
177
177
|
createTestChainContract,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index-node.ts","../../src/index-shared.ts","../../src/test/evm/runGanache.ts","../../src/test/evm/stakingContractUtils.ts"],"sourcesContent":["export * from './index-shared.ts'\nexport * from './test/index.ts'\n","export * from '@xyo-network/chain-ethereum'\nexport * from '@xyo-network/chain-modules'\nexport * from '@xyo-network/chain-orchestration'\nexport * from '@xyo-network/chain-protocol'\nexport * from '@xyo-network/chain-services'\nexport * from '@xyo-network/chain-utils'\nexport * from '@xyo-network/chain-validation'\nexport * from '@xyo-network/xl1-protocol'\n","import type { ChildProcess } from 'node:child_process'\nimport { spawn } from 'node:child_process'\n\nimport { delay } from '@xylabs/delay'\nimport { JsonRpcProvider } from 'ethers/providers'\n\nasync function isGanacheRunning(url: string) {\n try {\n const provider = new JsonRpcProvider(url)\n await provider.getBlockNumber() // Try to fetch the latest block number\n return true // If this succeeds, the server is running\n } catch {\n return false // If this fails, the server is not running\n }\n}\n\nexport async function startGanache(port: number, mnemonic: string) {\n console.log('Starting Ganache CLI...')\n\n // Start Ganache CLI\n const ganacheProcess = spawn(\n 'yarn',\n ['ganache', '--port', `${port}`, '--chain.chainId', '1337', '--mnemonic', mnemonic],\n { stdio: 'inherit' },\n )\n\n // Wait for Ganache to be ready\n while (!await isGanacheRunning(`http://127.0.0.1:${port}`)) {\n await delay(500)\n }\n\n return ganacheProcess\n}\n\nexport function stopGanache(process?: ChildProcess | undefined) {\n console.log('Stopping Ganache CLI...')\n if (process) {\n process.kill('SIGTERM')\n console.log('Ganache CLI stopped.')\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Address } from '@xylabs/hex'\nimport { asAddress } from '@xylabs/hex'\nimport { Account } from '@xyo-network/account'\nimport type { AccountInstance } from '@xyo-network/account-model'\nimport { createChain } from '@xyo-network/chain-ethereum'\nimport { buildGenesisBlock } from '@xyo-network/chain-protocol'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { BurnableErc20__factory as Erc20Factory } from '@xyo-network/typechain'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport type { ChainStakeIntent, HydratedBlock } from '@xyo-network/xl1-protocol'\nimport { ChainStakeIntentSchema, XYO_ZERO_ADDRESS } from '@xyo-network/xl1-protocol'\nimport { buildTransaction } from '@xyo-network/xl1-protocol-sdk'\nimport { getAddress } from 'ethers/address'\nimport { JsonRpcProvider } from 'ethers/providers'\nimport { parseUnits } from 'ethers/utils'\nimport { Wallet } from 'ethers/wallet'\n\nconst gasConfig = () => {\n return {\n gasLimit: 2_000_000, // Set the gas limit\n gasPrice: parseUnits('100', 'gwei'),\n }\n}\n\nexport const createTestErc20 = async (ganachePort: number, testPhrase: string, contractCreator: WalletInstance): Promise<Address> => {\n const provider = new JsonRpcProvider(`http://127.0.0.1:${ganachePort}`, 1337)\n const ethWallet = new Wallet(contractCreator.privateKey, provider)\n const erc20 = new Erc20Factory(ethWallet)\n const totalSupply = parseUnits('1000000', 18)\n const erc20Contract = await (await erc20.deploy('Test Token', 'TST', totalSupply, gasConfig())).waitForDeployment()\n const erc20Address = await erc20Contract.getAddress()\n const erc20ContractPerson0 = Erc20Factory.connect(erc20Address, ethWallet)\n const balance = await erc20ContractPerson0.balanceOf(ethWallet.address)\n assertEx(balance === totalSupply, () => 'Balance does not match total supply')\n return assertEx(asAddress(erc20Address), () => 'Invalid ERC20 contract address')\n}\n\nexport const transferTestTokens = async (ganachePort: number, erc20Address: Address, account0: WalletInstance, account1: WalletInstance) => {\n const provider0 = new JsonRpcProvider(`http://127.0.0.1:${ganachePort}`, 1337)\n const ethWalletPerson0 = new Wallet(account0.privateKey, provider0)\n const provider1 = new JsonRpcProvider(`http://127.0.0.1:${ganachePort}`, 1337)\n const ethWalletPerson1 = new Wallet(account1.privateKey, provider1)\n const erc20ContractPerson0 = Erc20Factory.connect(getAddress(erc20Address), ethWalletPerson0)\n const transferAmount = parseUnits('1000', 18)\n await (await erc20ContractPerson0.transfer(ethWalletPerson1.address, transferAmount, gasConfig())).wait()\n const erc20ContractPerson1 = Erc20Factory.connect(getAddress(erc20Address), ethWalletPerson1)\n const balance = await erc20ContractPerson1.balanceOf(ethWalletPerson1.address)\n assertEx(balance === transferAmount, () => 'Balance does not match transfer amount')\n}\n\nexport const createTestChainContract = async (\n ganachePort: number,\n erc20Address: Address,\n account0: WalletInstance,\n initialProducer: AccountInstance,\n): Promise<Address> => {\n const provider0 = new JsonRpcProvider(`http://127.0.0.1:${ganachePort}`, 1337)\n const ethWalletPerson0 = new Wallet(account0.privateKey, provider0)\n const [xyoChainContractAddress] = await createChain(\n ethWalletPerson0,\n erc20Address,\n initialProducer,\n XYO_ZERO_ADDRESS,\n 0n,\n XYO_ZERO_ADDRESS,\n 50_000n,\n gasConfig(),\n )\n return assertEx(asAddress(xyoChainContractAddress), () => 'Invalid staking contract address')\n}\n\nexport const approveTestStakeChainAddress = async (ganachePort: number, erc20Address: Address, xyoChainContractAddress: Address, account1: WalletInstance) => {\n const provider1 = new JsonRpcProvider(`http://127.0.0.1:${ganachePort}`, 1337)\n const ethWalletPerson1 = new Wallet(account1.privateKey, provider1)\n const erc20ContractPerson1 = Erc20Factory.connect(getAddress(erc20Address), ethWalletPerson1)\n\n const _approveResultTx = await (await erc20ContractPerson1.approve(getAddress(xyoChainContractAddress), parseUnits('100', 18), gasConfig())).wait()\n}\n\nexport const createTestGenesisBlock = async (\n blockProducerAccounts: WalletInstance[],\n): Promise<HydratedBlock> => {\n const randomChainId = (await Account.random()).address\n // Create staked intents for all the block producers declaring their intent to produce blocks\n const signedStakedBlockProducerIntents = await Promise.all(blockProducerAccounts.map(async (blockProducerAccount) => {\n const stakeIntent = new PayloadBuilder<ChainStakeIntent>({ schema: ChainStakeIntentSchema }).fields({\n from: blockProducerAccount.address,\n exp: Number.MAX_SAFE_INTEGER,\n nbf: 0,\n intent: 'producer',\n })\n .build()\n\n const signedStakedBlockProducerIntent = await buildTransaction(\n randomChainId,\n [stakeIntent],\n [],\n blockProducerAccount,\n 0,\n 1000,\n )\n return signedStakedBlockProducerIntent\n }))\n const intents = signedStakedBlockProducerIntents.map(intent => intent[0])\n const payloads = signedStakedBlockProducerIntents.flatMap(intent => intent[1]) as WithStorageMeta<ChainStakeIntent>[]\n return await buildGenesisBlock(randomChainId, signedStakedBlockProducerIntents, [...intents, ...payloads], blockProducer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sC,KAAKC,OAAOC;MACZC,KAAK;MACLC,QAAQ;IACV,CAAA,EACGC,MAAK;AAER,UAAMC,kCAAkC,MAAMC,iBAC5CrB,eACA;MAACQ;OACD,CAAA,GACAD,sBACA,GACA,GAAA;AAEF,WAAOa;EACT,CAAA,CAAA;AACA,QAAME,UAAUnB,iCAAiCG,IAAIY,CAAAA,WAAUA,OAAO,CAAA,CAAE;AACxE,QAAMK,WAAWpB,iCAAiCqB,QAAQN,CAAAA,WAAUA,OAAO,CAAA,CAAE;AAC7E,SAAO,MAAMO,kBAAkBzB,eAAeG,kCAAkC;OAAImB;OAAYC;KAAWxB,qBAAAA;AAC7G,GA3BsC;","names":["spawn","delay","JsonRpcProvider","isGanacheRunning","url","provider","JsonRpcProvider","getBlockNumber","startGanache","port","mnemonic","console","log","ganacheProcess","spawn","stdio","delay","stopGanache","process","kill","assertEx","asAddress","Account","createChain","buildGenesisBlock","PayloadBuilder","BurnableErc20__factory","Erc20Factory","ChainStakeIntentSchema","XYO_ZERO_ADDRESS","buildTransaction","getAddress","JsonRpcProvider","parseUnits","Wallet","gasConfig","gasLimit","gasPrice","parseUnits","createTestErc20","ganachePort","testPhrase","contractCreator","provider","JsonRpcProvider","ethWallet","Wallet","privateKey","erc20","Erc20Factory","totalSupply","erc20Contract","deploy","waitForDeployment","erc20Address","getAddress","erc20ContractPerson0","connect","balance","balanceOf","address","assertEx","asAddress","transferTestTokens","account0","account1","provider0","ethWalletPerson0","provider1","ethWalletPerson1","transferAmount","transfer","wait","erc20ContractPerson1","createTestChainContract","initialProducer","xyoChainContractAddress","createChain","XYO_ZERO_ADDRESS","approveTestStakeChainAddress","_approveResultTx","approve","createTestGenesisBlock","blockProducerAccounts","randomChainId","Account","random","signedStakedBlockProducerIntents","Promise","all","map","blockProducerAccount","stakeIntent","PayloadBuilder","schema","ChainStakeIntentSchema","fields","from","exp","Number","MAX_SAFE_INTEGER","nbf","intent","build","signedStakedBlockProducerIntent","buildTransaction","intents","payloads","flatMap","buildGenesisBlock"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index-node.ts","../../src/index-shared.ts","../../src/test/evm/runGanache.ts","../../src/test/evm/stakingContractUtils.ts"],"sourcesContent":["export * from './index-shared.ts'\nexport * from './test/index.ts'\n","export * from '@xyo-network/chain-ethereum'\nexport * from '@xyo-network/chain-modules'\nexport * from '@xyo-network/chain-orchestration'\nexport * from '@xyo-network/chain-protocol'\nexport * from '@xyo-network/chain-services'\nexport * from '@xyo-network/chain-utils'\nexport * from '@xyo-network/chain-validation'\nexport * from '@xyo-network/xl1-protocol'\n","import type { ChildProcess } from 'node:child_process'\nimport { spawn } from 'node:child_process'\n\nimport { delay } from '@xylabs/delay'\nimport { JsonRpcProvider } from 'ethers/providers'\n\nasync function isGanacheRunning(url: string) {\n try {\n const provider = new JsonRpcProvider(url)\n await provider.getBlockNumber() // Try to fetch the latest block number\n return true // If this succeeds, the server is running\n } catch {\n return false // If this fails, the server is not running\n }\n}\n\nexport async function startGanache(port: number, mnemonic: string) {\n console.log('Starting Ganache CLI...')\n\n // Start Ganache CLI\n const ganacheProcess = spawn(\n 'yarn',\n ['ganache', '--port', `${port}`, '--chain.chainId', '1337', '--mnemonic', mnemonic],\n { stdio: 'inherit' },\n )\n\n // Wait for Ganache to be ready\n while (!await isGanacheRunning(`http://127.0.0.1:${port}`)) {\n await delay(500)\n }\n\n return ganacheProcess\n}\n\nexport function stopGanache(process?: ChildProcess | undefined) {\n console.log('Stopping Ganache CLI...')\n if (process) {\n process.kill('SIGTERM')\n console.log('Ganache CLI stopped.')\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Address } from '@xylabs/hex'\nimport { asAddress } from '@xylabs/hex'\nimport { Account } from '@xyo-network/account'\nimport type { AccountInstance } from '@xyo-network/account-model'\nimport { createChain } from '@xyo-network/chain-ethereum'\nimport { buildGenesisBlock } from '@xyo-network/chain-protocol'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { BurnableErc20__factory as Erc20Factory } from '@xyo-network/typechain'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport type { ChainStakeIntent, HydratedBlock } from '@xyo-network/xl1-protocol'\nimport { ChainStakeIntentSchema, XYO_ZERO_ADDRESS } from '@xyo-network/xl1-protocol'\nimport { buildTransaction } from '@xyo-network/xl1-protocol-sdk'\nimport { getAddress } from 'ethers/address'\nimport { JsonRpcProvider } from 'ethers/providers'\nimport { parseUnits } from 'ethers/utils'\nimport { Wallet } from 'ethers/wallet'\n\nconst gasConfig = () => {\n return {\n gasLimit: 2_000_000, // Set the gas limit\n gasPrice: parseUnits('100', 'gwei'),\n }\n}\n\nexport const createTestErc20 = async (ganachePort: number, testPhrase: string, contractCreator: WalletInstance): Promise<Address> => {\n const provider = new JsonRpcProvider(`http://127.0.0.1:${ganachePort}`, 1337)\n const ethWallet = new Wallet(contractCreator.privateKey, provider)\n const erc20 = new Erc20Factory(ethWallet)\n const totalSupply = parseUnits('1000000', 18)\n const erc20Contract = await (await erc20.deploy('Test Token', 'TST', totalSupply, gasConfig())).waitForDeployment()\n const erc20Address = await erc20Contract.getAddress()\n const erc20ContractPerson0 = Erc20Factory.connect(erc20Address, ethWallet)\n const balance = await erc20ContractPerson0.balanceOf(ethWallet.address)\n assertEx(balance === totalSupply, () => 'Balance does not match total supply')\n return assertEx(asAddress(erc20Address), () => 'Invalid ERC20 contract address')\n}\n\nexport const transferTestTokens = async (ganachePort: number, erc20Address: Address, account0: WalletInstance, account1: WalletInstance) => {\n const provider0 = new JsonRpcProvider(`http://127.0.0.1:${ganachePort}`, 1337)\n const ethWalletPerson0 = new Wallet(account0.privateKey, provider0)\n const provider1 = new JsonRpcProvider(`http://127.0.0.1:${ganachePort}`, 1337)\n const ethWalletPerson1 = new Wallet(account1.privateKey, provider1)\n const erc20ContractPerson0 = Erc20Factory.connect(getAddress(erc20Address), ethWalletPerson0)\n const transferAmount = parseUnits('1000', 18)\n await (await erc20ContractPerson0.transfer(ethWalletPerson1.address, transferAmount, gasConfig())).wait()\n const erc20ContractPerson1 = Erc20Factory.connect(getAddress(erc20Address), ethWalletPerson1)\n const balance = await erc20ContractPerson1.balanceOf(ethWalletPerson1.address)\n assertEx(balance === transferAmount, () => 'Balance does not match transfer amount')\n}\n\nexport const createTestChainContract = async (\n ganachePort: number,\n erc20Address: Address,\n account0: WalletInstance,\n initialProducer: AccountInstance,\n): Promise<Address> => {\n const provider0 = new JsonRpcProvider(`http://127.0.0.1:${ganachePort}`, 1337)\n const ethWalletPerson0 = new Wallet(account0.privateKey, provider0)\n const [xyoChainContractAddress] = await createChain(\n ethWalletPerson0,\n erc20Address,\n initialProducer,\n XYO_ZERO_ADDRESS,\n 0n,\n XYO_ZERO_ADDRESS,\n 50_000n,\n gasConfig(),\n )\n return assertEx(asAddress(xyoChainContractAddress), () => 'Invalid staking contract address')\n}\n\nexport const approveTestStakeChainAddress = async (ganachePort: number, erc20Address: Address, xyoChainContractAddress: Address, account1: WalletInstance) => {\n const provider1 = new JsonRpcProvider(`http://127.0.0.1:${ganachePort}`, 1337)\n const ethWalletPerson1 = new Wallet(account1.privateKey, provider1)\n const erc20ContractPerson1 = Erc20Factory.connect(getAddress(erc20Address), ethWalletPerson1)\n\n const _approveResultTx = await (await erc20ContractPerson1.approve(getAddress(xyoChainContractAddress), parseUnits('100', 18), gasConfig())).wait()\n}\n\nexport const createTestGenesisBlock = async (\n blockProducerAccounts: WalletInstance[],\n): Promise<HydratedBlock> => {\n const randomChainId = (await Account.random()).address\n // Create staked intents for all the block producers declaring their intent to produce blocks\n const signedStakedBlockProducerIntents = await Promise.all(blockProducerAccounts.map(async (blockProducerAccount) => {\n const stakeIntent = new PayloadBuilder<ChainStakeIntent>({ schema: ChainStakeIntentSchema }).fields({\n from: blockProducerAccount.address,\n exp: Number.MAX_SAFE_INTEGER,\n nbf: 0,\n intent: 'producer',\n })\n .build()\n\n const signedStakedBlockProducerIntent = await buildTransaction(\n randomChainId,\n [stakeIntent],\n [],\n blockProducerAccount,\n 0,\n 1000,\n )\n return signedStakedBlockProducerIntent\n }))\n const intents = signedStakedBlockProducerIntents.map(intent => intent[0])\n const payloads = signedStakedBlockProducerIntents.flatMap(intent => intent[1]) as WithStorageMeta<ChainStakeIntent>[]\n return await buildGenesisBlock(randomChainId, signedStakedBlockProducerIntents, [...intents, ...payloads], blockProducerAccounts)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,qCAAc;AACd,oCAAc;AACd,0CAAc;AACd,qCAAc;AACd,qCAAc;AACd,kCAAc;AACd,uCAAc;AACd,mCAAc;;;ADPd,+BAAc;;;AECd,SAAS,aAAa;AAEtB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAEhC,eAAe,iBAAiB,KAAa;AAC3C,MAAI;AACF,UAAM,WAAW,IAAI,gBAAgB,GAAG;AACxC,UAAM,SAAS,eAAe;AAC9B,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAsB,aAAa,MAAc,UAAkB;AACjE,UAAQ,IAAI,yBAAyB;AAGrC,QAAM,iBAAiB;AAAA,IACrB;AAAA,IACA,CAAC,WAAW,UAAU,GAAG,IAAI,IAAI,mBAAmB,QAAQ,cAAc,QAAQ;AAAA,IAClF,EAAE,OAAO,UAAU;AAAA,EACrB;AAGA,SAAO,CAAC,MAAM,iBAAiB,oBAAoB,IAAI,EAAE,GAAG;AAC1D,UAAM,MAAM,GAAG;AAAA,EACjB;AAEA,SAAO;AACT;AAEO,SAAS,YAAY,SAAoC;AAC9D,UAAQ,IAAI,yBAAyB;AACrC,MAAI,SAAS;AACX,YAAQ,KAAK,SAAS;AACtB,YAAQ,IAAI,sBAAsB;AAAA,EACpC;AACF;;;ACxCA,SAAS,gBAAgB;AAEzB,SAAS,iBAAiB;AAC1B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C,EAAE,OAAO;AAAA,MAClG,MAAM,qBAAqB;AAAA,MAC3B,KAAK,OAAO;AAAA,MACZ,KAAK;AAAA,MACL,QAAQ;AAAA,IACV,CAAC,EACE,MAAM;AAET,UAAM,kCAAkC,MAAM;AAAA,MAC5C;AAAA,MACA,CAAC,WAAW;AAAA,MACZ,CAAC;AAAA,MACD;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,WAAO;AAAA,EACT,CAAC,CAAC;AACF,QAAM,UAAU,iCAAiC,IAAI,YAAU,OAAO,CAAC,CAAC;AACxE,QAAM,WAAW,iCAAiC,QAAQ,YAAU,OAAO,CAAC,CAAC;AAC7E,SAAO,MAAM,kBAAkB,eAAe,kCAAkC,CAAC,GAAG,SAAS,GAAG,QAAQ,GAAG,qBAAqB;AAClI;","names":["JsonRpcProvider"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/chain-sdk",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.10.0",
|
|
5
5
|
"description": "XYO Layer One SDK",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -57,43 +57,43 @@
|
|
|
57
57
|
"deploy3": "echo Deploy3 not allowed!"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@xylabs/assert": "
|
|
61
|
-
"@xylabs/delay": "
|
|
62
|
-
"@xylabs/hex": "
|
|
63
|
-
"@xyo-network/account": "
|
|
64
|
-
"@xyo-network/account-model": "
|
|
65
|
-
"@xyo-network/chain-ethereum": "
|
|
66
|
-
"@xyo-network/chain-modules": "
|
|
67
|
-
"@xyo-network/chain-orchestration": "
|
|
68
|
-
"@xyo-network/chain-protocol": "
|
|
69
|
-
"@xyo-network/chain-services": "
|
|
70
|
-
"@xyo-network/chain-utils": "
|
|
71
|
-
"@xyo-network/chain-validation": "
|
|
72
|
-
"@xyo-network/payload-builder": "
|
|
73
|
-
"@xyo-network/typechain": "
|
|
74
|
-
"@xyo-network/wallet-model": "
|
|
75
|
-
"@xyo-network/xl1-protocol": "
|
|
76
|
-
"@xyo-network/xl1-protocol-sdk": "
|
|
60
|
+
"@xylabs/assert": "~5.0.2",
|
|
61
|
+
"@xylabs/delay": "~5.0.2",
|
|
62
|
+
"@xylabs/hex": "~5.0.2",
|
|
63
|
+
"@xyo-network/account": "~5.0.0",
|
|
64
|
+
"@xyo-network/account-model": "~5.0.0",
|
|
65
|
+
"@xyo-network/chain-ethereum": "~1.10.0",
|
|
66
|
+
"@xyo-network/chain-modules": "~1.10.0",
|
|
67
|
+
"@xyo-network/chain-orchestration": "~1.10.0",
|
|
68
|
+
"@xyo-network/chain-protocol": "~1.10.0",
|
|
69
|
+
"@xyo-network/chain-services": "~1.10.0",
|
|
70
|
+
"@xyo-network/chain-utils": "~1.10.0",
|
|
71
|
+
"@xyo-network/chain-validation": "~1.10.0",
|
|
72
|
+
"@xyo-network/payload-builder": "~5.0.0",
|
|
73
|
+
"@xyo-network/typechain": "~3.5.4",
|
|
74
|
+
"@xyo-network/wallet-model": "~5.0.0",
|
|
75
|
+
"@xyo-network/xl1-protocol": "~1.9.3",
|
|
76
|
+
"@xyo-network/xl1-protocol-sdk": "~1.10.0",
|
|
77
77
|
"ethers": "6.15.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@types/node": "
|
|
81
|
-
"@xylabs/
|
|
82
|
-
"@xylabs/
|
|
83
|
-
"@xylabs/
|
|
84
|
-
"@xylabs/
|
|
85
|
-
"@
|
|
86
|
-
"@xyo-network/account
|
|
87
|
-
"@xyo-network/
|
|
88
|
-
"@xyo-network/archivist-
|
|
89
|
-
"@xyo-network/
|
|
90
|
-
"@xyo-network/
|
|
91
|
-
"@xyo-network/
|
|
92
|
-
"@xyo-network/
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"typescript": "
|
|
96
|
-
"vitest": "
|
|
80
|
+
"@types/node": "~24.2.0",
|
|
81
|
+
"@xylabs/creatable": "~5.0.2",
|
|
82
|
+
"@xylabs/decimal-precision": "~5.0.2",
|
|
83
|
+
"@xylabs/delay": "~5.0.2",
|
|
84
|
+
"@xylabs/ts-scripts-yarn3": "~7.0.3",
|
|
85
|
+
"@xylabs/tsconfig": "~7.0.3",
|
|
86
|
+
"@xyo-network/account": "~5.0.0",
|
|
87
|
+
"@xyo-network/account-model": "~5.0.0",
|
|
88
|
+
"@xyo-network/archivist-memory": "~5.0.0",
|
|
89
|
+
"@xyo-network/archivist-model": "~5.0.0",
|
|
90
|
+
"@xyo-network/boundwitness-builder": "~5.0.0",
|
|
91
|
+
"@xyo-network/chain-analyze": "~1.10.0",
|
|
92
|
+
"@xyo-network/payload-model": "~5.0.0",
|
|
93
|
+
"@xyo-network/wallet": "~5.0.0",
|
|
94
|
+
"eslint": "~9.32.0",
|
|
95
|
+
"typescript": "~5.9.2",
|
|
96
|
+
"vitest": "~3.2.4"
|
|
97
97
|
},
|
|
98
98
|
"engineStrict": true,
|
|
99
99
|
"publishConfig": {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ChildProcess } from 'node:child_process'
|
|
2
2
|
|
|
3
3
|
import { assertEx } from '@xylabs/assert'
|
|
4
|
+
import type { CreatableName } from '@xylabs/creatable'
|
|
5
|
+
import { Creatable } from '@xylabs/creatable'
|
|
4
6
|
import { toFixedPoint } from '@xylabs/decimal-precision'
|
|
5
7
|
import { delay } from '@xylabs/delay'
|
|
6
|
-
import type { Hash } from '@xylabs/hex'
|
|
8
|
+
import type { EthAddress, Hash } from '@xylabs/hex'
|
|
7
9
|
import { Account } from '@xyo-network/account'
|
|
8
|
-
import type { EthAddress } from '@xyo-network/chain-ethereum'
|
|
9
10
|
import {
|
|
10
11
|
createChainContract, createChainRewardsContract, getDefaultGasConfig,
|
|
11
12
|
} from '@xyo-network/chain-ethereum'
|
|
@@ -69,7 +70,7 @@ describe('EvmBlockRewardService', () => {
|
|
|
69
70
|
account,
|
|
70
71
|
chainService,
|
|
71
72
|
config,
|
|
72
|
-
name: 'EvmBlockRewardService',
|
|
73
|
+
name: 'EvmBlockRewardService' as CreatableName,
|
|
73
74
|
provider,
|
|
74
75
|
}
|
|
75
76
|
service = await EvmBlockRewardService.create(params)
|
|
@@ -2,9 +2,9 @@ import type { ChildProcess } from 'node:child_process'
|
|
|
2
2
|
|
|
3
3
|
import { assertEx } from '@xylabs/assert'
|
|
4
4
|
import { delay } from '@xylabs/delay'
|
|
5
|
-
import { asAddress } from '@xylabs/hex'
|
|
5
|
+
import { asAddress, toEthAddress } from '@xylabs/hex'
|
|
6
6
|
import type { AccountInstance } from '@xyo-network/account-model'
|
|
7
|
-
import { createChain
|
|
7
|
+
import { createChain } from '@xyo-network/chain-ethereum'
|
|
8
8
|
import { EvmChainService } from '@xyo-network/chain-services'
|
|
9
9
|
import type { BurnableErc20 } from '@xyo-network/typechain'
|
|
10
10
|
import { BurnableErc20__factory as Erc20Factory, StakedXyoChain__factory as StakedXyoChainFactory } from '@xyo-network/typechain'
|
package/src/test/evm/setup.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import { asAddress } from '@xylabs/hex'
|
|
3
|
-
import { createChain
|
|
2
|
+
import { asAddress, toEthAddress } from '@xylabs/hex'
|
|
3
|
+
import { createChain } from '@xyo-network/chain-ethereum'
|
|
4
4
|
import { EvmChainService } from '@xyo-network/chain-services'
|
|
5
5
|
import { BurnableErc20__factory as Erc20Factory, StakedXyoChain__factory as StakedXyoChainFactory } from '@xyo-network/typechain'
|
|
6
6
|
import { HDWallet } from '@xyo-network/wallet'
|