@xyo-network/chain-sdk 1.2.7 → 1.3.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.
@@ -170,7 +170,7 @@ var createTestGenesisBlock = /* @__PURE__ */ __name(async (blockProducerAccounts
170
170
  return await buildBlock(randomChainId, signedStakedBlockProducerIntents, [
171
171
  ...intents,
172
172
  ...payloads
173
- ], blockProducerAccounts);
173
+ ], blockProducerAccounts, {});
174
174
  }, "createTestGenesisBlock");
175
175
  export {
176
176
  approveTestStakeChainAddress,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.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-model'\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) {\n console.log('Stopping Ganache CLI...')\n\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 type { AccountInstance, WalletInstance } from '@xyo-network/account'\nimport { Account } from '@xyo-network/account'\nimport { createChain } from '@xyo-network/chain-ethereum'\nimport { buildBlock, buildTransaction } from '@xyo-network/chain-protocol'\nimport { XYO_ZERO_ADDRESS } from '@xyo-network/chain-utils'\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 { ChainStakeIntent, HydratedBlock } from '@xyo-network/xl1-model'\nimport { ChainStakeIntentSchema } from '@xyo-network/xl1-model'\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 buildBlock(randomChainId, signedStakedBlockProducerIntents, [...intents, ...payloads], blockProducerAccounts)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;ACAA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,qCAAc;AACd,oCAAc;AACd,0CAAc;AACd,qCAAc;AACd,qCAAc;AACd,kCAAc;AACd,uCAAc;AACd,gCAAc;;;ADPd,0BAAc;;;AECd,SAASA,aAAa;AAEtB,SAASC,aAAa;AACtB,SAASC,uBAAuB;AAEhC,eAAeC,iBAAiBC,KAAW;AACzC,MAAI;AACF,UAAMC,WAAW,IAAIC,gBAAgBF,GAAAA;AACrC,UAAMC,SAASE,eAAc;AAC7B,WAAO;EACT,QAAQ;AACN,WAAO;EACT;AACF;AAReJ;AAUf,eAAsBK,aAAaC,MAAcC,UAAgB;AAC/DC,UAAQC,IAAI,yBAAA;AAGZ,QAAMC,iBAAiBC,MACrB,QACA;IAAC;IAAW;IAAU,GAAGL,IAAAA;IAAQ;IAAmB;IAAQ;IAAcC;KAC1E;IAAEK,OAAO;EAAU,CAAA;AAIrB,SAAO,CAAC,MAAMZ,iBAAiB,oBAAoBM,IAAAA,EAAM,GAAG;AAC1D,UAAMO,MAAM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AASlB,YAAYqB,SAAAA;AACzD,QAAMK,uBAAuBxB,aAAaQ,QAAQF,WAAWD,YAAAA,GAAee,gBAAAA;AAE5E,QAAMW,mBAAmB,OAAO,MAAMP,qBAAqBQ,QAAQ1B,WAAWqB,uBAAAA,GAA0BtC,WAAW,OAAO,EAAA,GAAKH,UAAAA,CAAAA,GAAcqC,KAAI;AACnJ,GAN4C;AAQrC,IAAMU,yBAAyB,8BACpCC,0BAAAA;AAEA,QAAMC,iBAAiB,MAAMC,QAAQC,OAAM,GAAI1B;AAE/C,QAAM2B,mCAAmC,MAAMC,QAAQC,IAAIN,sBAAsBO,IAAI,OAAOC,yBAAAA;AAC1F,UAAMC,cAAc,IAAIC,eAAiC;MAAEC,QAAQC;IAAuB,CAAA,EAAGC,OAAO;MAClGC,MAAMN,qBAAqB/B;MAC3BsC,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,WAAWzB,eAAeG,kCAAkC;OAAImB;OAAYC;KAAWxB,qBAAAA;AACtG,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","buildBlock","buildTransaction","XYO_ZERO_ADDRESS","PayloadBuilder","BurnableErc20__factory","Erc20Factory","ChainStakeIntentSchema","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","buildBlock"]}
1
+ {"version":3,"sources":["../../src/index.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-model'\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) {\n console.log('Stopping Ganache CLI...')\n\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 type { AccountInstance, WalletInstance } from '@xyo-network/account'\nimport { Account } from '@xyo-network/account'\nimport { createChain } from '@xyo-network/chain-ethereum'\nimport { buildBlock, buildTransaction } from '@xyo-network/chain-protocol'\nimport { XYO_ZERO_ADDRESS } from '@xyo-network/chain-utils'\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 { ChainStakeIntent, HydratedBlock } from '@xyo-network/xl1-model'\nimport { ChainStakeIntentSchema } from '@xyo-network/xl1-model'\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 buildBlock(randomChainId, signedStakedBlockProducerIntents, [...intents, ...payloads], blockProducerAccounts, {})\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;ACAA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,qCAAc;AACd,oCAAc;AACd,0CAAc;AACd,qCAAc;AACd,qCAAc;AACd,kCAAc;AACd,uCAAc;AACd,gCAAc;;;ADPd,0BAAc;;;AECd,SAASA,aAAa;AAEtB,SAASC,aAAa;AACtB,SAASC,uBAAuB;AAEhC,eAAeC,iBAAiBC,KAAW;AACzC,MAAI;AACF,UAAMC,WAAW,IAAIC,gBAAgBF,GAAAA;AACrC,UAAMC,SAASE,eAAc;AAC7B,WAAO;EACT,QAAQ;AACN,WAAO;EACT;AACF;AAReJ;AAUf,eAAsBK,aAAaC,MAAcC,UAAgB;AAC/DC,UAAQC,IAAI,yBAAA;AAGZ,QAAMC,iBAAiBC,MACrB,QACA;IAAC;IAAW;IAAU,GAA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+B,8BAAOvC,aAAqBc,cAAuBsB,yBAAkCX,aAAAA;AAC/H,QAAMG,YAAY,IAAIxB,iBAAgB,oBAAoBJ,WAAAA,IAAe,IAAA;AACzE,QAAM6B,mBAAmB,IAAIvB,OAAOmB,SAASlB,YAAYqB,SAAAA;AACzD,QAAMK,uBAAuBxB,aAAaQ,QAAQF,WAAWD,YAAAA,GAAee,gBAAAA;AAE5E,QAAMW,mBAAmB,OAAO,MAAMP,qBAAqBQ,QAAQ1B,WAAWqB,uBAAAA,GAA0BtC,WAAW,OAAO,EAAA,GAAKH,UAAAA,CAAAA,GAAcqC,KAAI;AACnJ,GAN4C;AAQrC,IAAMU,yBAAyB,8BACpCC,0BAAAA;AAEA,QAAMC,iBAAiB,MAAMC,QAAQC,OAAM,GAAI1B;AAE/C,QAAM2B,mCAAmC,MAAMC,QAAQC,IAAIN,sBAAsBO,IAAI,OAAOC,yBAAAA;AAC1F,UAAMC,cAAc,IAAIC,eAAiC;MAAEC,QAAQC;IAAuB,CAAA,EAAGC,OAAO;MAClGC,MAAMN,qBAAqB/B;MAC3BsC,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,WAAWzB,eAAeG,kCAAkC;OAAImB;OAAYC;KAAWxB,uBAAuB,CAAC,CAAA;AAC9H,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","buildBlock","buildTransaction","XYO_ZERO_ADDRESS","PayloadBuilder","BurnableErc20__factory","Erc20Factory","ChainStakeIntentSchema","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","buildBlock"]}
@@ -182,7 +182,7 @@ var createTestGenesisBlock = /* @__PURE__ */ __name(async (blockProducerAccounts
182
182
  return await buildBlock(randomChainId, signedStakedBlockProducerIntents, [
183
183
  ...intents,
184
184
  ...payloads
185
- ], blockProducerAccounts);
185
+ ], blockProducerAccounts, {});
186
186
  }, "createTestGenesisBlock");
187
187
 
188
188
  // src/index-node.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index-node.ts","../../src/index.ts","../../src/index-shared.ts","../../src/test/evm/runGanache.ts","../../src/test/evm/stakingContractUtils.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nexport * from './index.ts'\n","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-model'\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) {\n console.log('Stopping Ganache CLI...')\n\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 type { AccountInstance, WalletInstance } from '@xyo-network/account'\nimport { Account } from '@xyo-network/account'\nimport { createChain } from '@xyo-network/chain-ethereum'\nimport { buildBlock, buildTransaction } from '@xyo-network/chain-protocol'\nimport { XYO_ZERO_ADDRESS } from '@xyo-network/chain-utils'\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 { ChainStakeIntent, HydratedBlock } from '@xyo-network/xl1-model'\nimport { ChainStakeIntentSchema } from '@xyo-network/xl1-model'\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 buildBlock(randomChainId, signedStakedBlockProducerIntents, [...intents, ...payloads], blockProducerAccounts)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;ACAA;;;;;;;;;;;;ACAA;;AACA;AACA;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CAAkC,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,WAAWzB,eAAeG,kCAAkC;OAAImB;OAAYC;KAAWxB,qBAAAA;AACtG,GA3BsC;;;AJ/EtC,+BAAc;","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","buildBlock","buildTransaction","XYO_ZERO_ADDRESS","PayloadBuilder","BurnableErc20__factory","Erc20Factory","ChainStakeIntentSchema","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","buildBlock"]}
1
+ {"version":3,"sources":["../../src/index-node.ts","../../src/index.ts","../../src/index-shared.ts","../../src/test/evm/runGanache.ts","../../src/test/evm/stakingContractUtils.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nexport * from './index.ts'\n","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-model'\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) {\n console.log('Stopping Ganache CLI...')\n\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 type { AccountInstance, WalletInstance } from '@xyo-network/account'\nimport { Account } from '@xyo-network/account'\nimport { createChain } from '@xyo-network/chain-ethereum'\nimport { buildBlock, buildTransaction } from '@xyo-network/chain-protocol'\nimport { XYO_ZERO_ADDRESS } from '@xyo-network/chain-utils'\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 { ChainStakeIntent, HydratedBlock } from '@xyo-network/xl1-model'\nimport { ChainStakeIntentSchema } from '@xyo-network/xl1-model'\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 buildBlock(randomChainId, signedStakedBlockProducerIntents, [...intents, ...payloads], blockProducerAccounts, {})\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;ACAA;;;;;;;;;;;;ACAA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,qCAAc;AACd,oCAAc;AACd,0CAAc;AACd,qCAAc;AACd,qCAAc;AACd,kCAAc;AACd,uCAAc;AACd,gCAAc;;;ADPd,0BAAc;;;AECd,SAASA,aAAa;AAEtB,SAASC,aAAa;AACtB,SAASC,uBAAuB;AAEhC,eAAeC,iBAAiBC,KAAW;AACzC,MAAI;AACF,UAAMC,WAAW,IAAIC,gBAAgBF,GAAAA;AACrC,UAAMC,SAASE,eAAc;AAC7B,WAAO;EACT,QAAQ;AACN,WAAO;EACT;AACF;AAReJ;AAUf,eAAsBK,aAAaC,MAAcC,UAAgB;AAC/DC,UAAQC,IAAI,yBAAA;AAGZ,QAAMC,iBAAiBC,MACrB,QACA;IAAC;IAAW;IAAU,GAAGL,IAAAA;IAAQ;IAAmB;IAAQ;IAAcC;KAC1E;IAAEK,OAAO;EAAU,CAAA;AAIrB,SAAO,CAAC,MAAMZ,iBAAiB,oBAAoBM,IAAAA,EAAM,GAAG;AAC1D,UAAMO,MAAM,GAAA;EACd;AAEA,SAAOH;AACT;AAhBsBL;AAkBf,SAASS,YAAYC,SAAqB;AAC/CP,UAAQC,IAAI,yBAAA;AAEZ,MAAIM,SAAS;AACXA,YAAQC,KAAK,SAAA;AACbR,YAAQC,IAAI,sBAAA;EACd;AACF;AAPgBK;;;AClChB,SAASG,gBAAgB;AAEzB,SAASC,iBAAiB;AAE1B,SAASC,eAAe;AACxB,SAASC,mBAAmB;AAC5B,SAASC,YAAYC,wBAAwB;AAC7C,SAASC,wBAAwB;AACjC,SAASC,sBAAsB;AAE/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,mCAAmC,MAAMC,QAAQC,IAAIN,sBAAsBO,IAAI,OAAOC,yBAAAA;AAC1F,UAAMC,cAAc,IAAIC,eAAiC;MAAEC,QAAQC;IAAuB,CAAA,EAAGC,OAAO;MAClGC,MAAMN,qBAAqB/B;MAC3BsC,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,WAAWzB,eAAeG,kCAAkC;OAAImB;OAAYC;KAAWxB,uBAAuB,CAAC,CAAA;AAC9H,GA3BsC;;;AJ/EtC,+BAAc;","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","buildBlock","buildTransaction","XYO_ZERO_ADDRESS","PayloadBuilder","BurnableErc20__factory","Erc20Factory","ChainStakeIntentSchema","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","buildBlock"]}
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.2.7",
4
+ "version": "1.3.0",
5
5
  "description": "XYO Layer One SDK",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -46,45 +46,45 @@
46
46
  "deploy3": "echo Deploy3 not allowed!"
47
47
  },
48
48
  "dependencies": {
49
- "@xylabs/assert": "^4.8.5",
50
- "@xylabs/delay": "^4.8.5",
51
- "@xylabs/hex": "^4.8.5",
52
- "@xyo-network/account": "^3.12.4",
53
- "@xyo-network/archivist-model": "^3.12.4",
54
- "@xyo-network/bridge-http": "^3.12.4",
55
- "@xyo-network/bridge-model": "^3.12.4",
56
- "@xyo-network/chain-ethereum": "^1.2.7",
57
- "@xyo-network/chain-modules": "^1.2.7",
58
- "@xyo-network/chain-orchestration": "^1.2.7",
59
- "@xyo-network/chain-protocol": "^1.2.7",
60
- "@xyo-network/chain-services": "^1.2.7",
61
- "@xyo-network/chain-utils": "^1.2.7",
62
- "@xyo-network/chain-validation": "^1.2.7",
63
- "@xyo-network/diviner-model": "^3.12.4",
64
- "@xyo-network/module-model": "^3.12.4",
65
- "@xyo-network/node-memory": "^3.12.4",
66
- "@xyo-network/payload-builder": "^3.12.4",
67
- "@xyo-network/payload-model": "^3.12.4",
68
- "@xyo-network/sentinel-memory": "^3.12.4",
69
- "@xyo-network/sentinel-model": "^3.12.4",
49
+ "@xylabs/assert": "^4.8.7",
50
+ "@xylabs/delay": "^4.8.7",
51
+ "@xylabs/hex": "^4.8.7",
52
+ "@xyo-network/account": "^3.13.0",
53
+ "@xyo-network/archivist-model": "^3.13.0",
54
+ "@xyo-network/bridge-http": "^3.13.0",
55
+ "@xyo-network/bridge-model": "^3.13.0",
56
+ "@xyo-network/chain-ethereum": "^1.3.0",
57
+ "@xyo-network/chain-modules": "^1.3.0",
58
+ "@xyo-network/chain-orchestration": "^1.3.0",
59
+ "@xyo-network/chain-protocol": "^1.3.0",
60
+ "@xyo-network/chain-services": "^1.3.0",
61
+ "@xyo-network/chain-utils": "^1.3.0",
62
+ "@xyo-network/chain-validation": "^1.3.0",
63
+ "@xyo-network/diviner-model": "^3.13.0",
64
+ "@xyo-network/module-model": "^3.13.0",
65
+ "@xyo-network/node-memory": "^3.13.0",
66
+ "@xyo-network/payload-builder": "^3.13.0",
67
+ "@xyo-network/payload-model": "^3.13.0",
68
+ "@xyo-network/sentinel-memory": "^3.13.0",
69
+ "@xyo-network/sentinel-model": "^3.13.0",
70
70
  "@xyo-network/typechain": "^3.5.1",
71
- "@xyo-network/xl1-model": "^1.2.7",
71
+ "@xyo-network/xl1-model": "^1.3.0",
72
72
  "ethers": "6.13.6"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/node": "^22.14.1",
76
- "@xylabs/decimal-precision": "^4.8.5",
77
- "@xylabs/delay": "^4.8.5",
78
- "@xylabs/ts-scripts-yarn3": "^6.2.1",
79
- "@xylabs/tsconfig": "^6.2.1",
80
- "@xyo-network/account": "^3.12.4",
81
- "@xyo-network/account-model": "^3.12.4",
82
- "@xyo-network/archivist-memory": "^3.12.4",
83
- "@xyo-network/boundwitness-builder": "^3.12.4",
84
- "@xyo-network/payload-model": "^3.12.4",
85
- "eslint": "^9.24.0",
76
+ "@xylabs/decimal-precision": "^4.8.7",
77
+ "@xylabs/delay": "^4.8.7",
78
+ "@xylabs/ts-scripts-yarn3": "^6.3.4",
79
+ "@xylabs/tsconfig": "^6.3.4",
80
+ "@xyo-network/account": "^3.13.0",
81
+ "@xyo-network/account-model": "^3.13.0",
82
+ "@xyo-network/archivist-memory": "^3.13.0",
83
+ "@xyo-network/boundwitness-builder": "^3.13.0",
84
+ "@xyo-network/payload-model": "^3.13.0",
85
+ "eslint": "^9.25.1",
86
86
  "typescript": "^5.8.3",
87
- "vitest": "^3.1.1"
87
+ "vitest": "^3.1.2"
88
88
  },
89
89
  "engineStrict": true,
90
90
  "publishConfig": {
@@ -104,5 +104,5 @@ export const createTestGenesisBlock = async (
104
104
  }))
105
105
  const intents = signedStakedBlockProducerIntents.map(intent => intent[0])
106
106
  const payloads = signedStakedBlockProducerIntents.flatMap(intent => intent[1]) as WithStorageMeta<ChainStakeIntent>[]
107
- return await buildBlock(randomChainId, signedStakedBlockProducerIntents, [...intents, ...payloads], blockProducerAccounts)
107
+ return await buildBlock(randomChainId, signedStakedBlockProducerIntents, [...intents, ...payloads], blockProducerAccounts, {})
108
108
  }