diff --git a/dist/package.json b/dist/package.json index 77c621d9..ef7fd434 100644 --- a/dist/package.json +++ b/dist/package.json @@ -40,24 +40,24 @@ "@babel/preset-env": "^7.24.3", "@babel/preset-typescript": "^7.9.0", "@types/jest": "^29.5.11", - "@types/node": "^20.11.30", + "@types/node": "^22.3.0", "babel-loader": "^9.1.2", "eslint": "^6.8.0", "eslint-loader": "^4.0.0", "gts": "^5.3.1", "jest": "29.7.0", - "rimraf": "^5.0.7", + "rimraf": "^6.0.1", "ts-loader": "^9.4.4", "tslint": "^6.1.0", - "typedoc": "^0.25.7", + "typedoc": "^0.26.5", "typescript": "^5.4.5" }, "dependencies": { "@babel/runtime": "^7.23.8", - "@cosmjs/crypto": "^0.32.3", - "@types/mathjs": "6.0.11", + "@cosmjs/crypto": "^0.32.4", + "@types/mathjs": "^9.4.2", "@types/ws": "^8.5.10", - "axios": "^1.7.2", + "axios": "^1.7.4", "bcryptjs": "^2.4.3", "bech32": "^1.1.3", "buffer": "^6.0.3", @@ -67,7 +67,7 @@ "grpc-web": "^1.2.1", "is_js": "^0.9.0", "isomorphic-ws": "^5.0.0", - "mathjs": "12.3.0", + "mathjs": "13.0.3", "ndjson": "^2.0.0", "pumpify": "^2.0.1", "secure-random": "^1.1.2", @@ -75,6 +75,6 @@ "sm-crypto-bj": "0.2.2", "tslib": "^2.6.2", "tweetnacl": "^1.0.3", - "uuid": "^9.0.0" + "uuid": "^10.0.0" } } \ No newline at end of file diff --git a/package.json b/package.json index a7caaec3..ef7fd434 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@babel/preset-env": "^7.24.3", "@babel/preset-typescript": "^7.9.0", "@types/jest": "^29.5.11", - "@types/node": "^22.2.0", + "@types/node": "^22.3.0", "babel-loader": "^9.1.2", "eslint": "^6.8.0", "eslint-loader": "^4.0.0", @@ -57,7 +57,7 @@ "@cosmjs/crypto": "^0.32.4", "@types/mathjs": "^9.4.2", "@types/ws": "^8.5.10", - "axios": "^1.7.2", + "axios": "^1.7.4", "bcryptjs": "^2.4.3", "bech32": "^1.1.3", "buffer": "^6.0.3", @@ -77,4 +77,4 @@ "tweetnacl": "^1.0.3", "uuid": "^10.0.0" } -} +} \ No newline at end of file diff --git a/test/gov.test.ts b/test/gov.test.ts index ca313208..696d98e5 100644 --- a/test/gov.test.ts +++ b/test/gov.test.ts @@ -1,6 +1,6 @@ import { BaseTest } from './basetest'; import * as types from '../src/types'; - +const timeout = 9999; describe('Gov Tests', () => { describe('Query', () => { test('query proposal', async () => { @@ -15,7 +15,7 @@ describe('Gov Tests', () => { }); test('query proposals', async () => { await BaseTest.getClient().gov - .queryProposals({},{ + .queryProposals({}, { page_number: 1, page_size: 100 }) @@ -102,13 +102,13 @@ describe('Gov Tests', () => { await BaseTest.getClient().gov .submitProposal( { - type:types.ProposalType.Text_Proposal, - value:{ - title:'test3', - description:'test3' + type: types.ProposalType.Text_Proposal, + value: { + title: 'test3', + description: 'test3' } }, - initDeposit, + initDeposit, BaseTest.baseTx) .then(res => { console.log(JSON.stringify(res)); @@ -116,7 +116,7 @@ describe('Gov Tests', () => { .catch(error => { console.log(error); }); - } + }, timeout ); }); @@ -127,11 +127,11 @@ describe('Gov Tests', () => { await BaseTest.getClient().gov .submitProposal( { - type:types.ProposalType.Parameter_Change_Proposal, - value:{ - title:'3333', - description:'3333', - changes:[ + type: types.ProposalType.Parameter_Change_Proposal, + value: { + title: '3333', + description: '3333', + changes: [ { subspace: 'staking', key: 'MaxValidators', @@ -140,7 +140,7 @@ describe('Gov Tests', () => { ] } }, - initDeposit, + initDeposit, BaseTest.baseTx) .then(res => { console.log(JSON.stringify(res)); @@ -148,7 +148,7 @@ describe('Gov Tests', () => { .catch(error => { console.log(error); }); - } + }, timeout ); }); @@ -159,15 +159,15 @@ describe('Gov Tests', () => { await BaseTest.getClient().gov .submitProposal( { - type:types.ProposalType.Community_Pool_Spend_Proposal, - value:{ - title:'1111', - description:'1111', + type: types.ProposalType.Community_Pool_Spend_Proposal, + value: { + title: '1111', + description: '1111', recipient: 'iaa176dd0tgn38grpc8hpxfmwl6sl8jfmkneg8mkxr', - amount: [{denom: 'udev',amount: '100'}] + amount: [{ denom: 'udev', amount: '100' }] } }, - initDeposit, + initDeposit, BaseTest.baseTx) .then(res => { console.log(JSON.stringify(res)); @@ -175,7 +175,7 @@ describe('Gov Tests', () => { .catch(error => { console.log(error); }); - } + }, timeout ); }); @@ -186,21 +186,21 @@ describe('Gov Tests', () => { await BaseTest.getClient().gov .submitProposal( { - type:types.ProposalType.Software_Upgrade_Proposal, - value:{ - title:'6666', - description:'6666', - plan:{ - name:'6666', - time:{ - seconds: new Date().getTime()/1000 + 3000, - nanos:0 + type: types.ProposalType.Software_Upgrade_Proposal, + value: { + title: '6666', + description: '6666', + plan: { + name: '6666', + time: { + seconds: new Date().getTime() / 1000 + 3000, + nanos: 0 }, - info:'123123', + info: '123123', } } }, - initDeposit, + initDeposit, BaseTest.baseTx) .then(res => { console.log(JSON.stringify(res)); @@ -208,7 +208,7 @@ describe('Gov Tests', () => { .catch(error => { console.log(error); }); - } + }, timeout ); }); @@ -219,13 +219,13 @@ describe('Gov Tests', () => { await BaseTest.getClient().gov .submitProposal( { - type:types.ProposalType.Cancel_Software_Upgrade_Proposal, - value:{ - title:'5555', - description:'5555' + type: types.ProposalType.Cancel_Software_Upgrade_Proposal, + value: { + title: '5555', + description: '5555' } }, - initDeposit, + initDeposit, BaseTest.baseTx) .then(res => { console.log(JSON.stringify(res)); @@ -233,7 +233,7 @@ describe('Gov Tests', () => { .catch(error => { console.log(error); }); - } + }, timeout ); }); @@ -253,7 +253,7 @@ describe('Gov Tests', () => { .catch(error => { console.log(error); }); - } + }, timeout ); }); @@ -269,7 +269,7 @@ describe('Gov Tests', () => { .catch(error => { console.log(error); }); - } + }, timeout ); }); @@ -302,7 +302,7 @@ describe('Gov Tests', () => { .catch(error => { console.log(error); }); - } + }, timeout ); }); }); diff --git a/test/staking.test.ts b/test/staking.test.ts index ec484287..404a7e6a 100644 --- a/test/staking.test.ts +++ b/test/staking.test.ts @@ -1,5 +1,6 @@ import { BaseTest } from './basetest'; +let timeout = 9999; describe('Staking Tests', () => { describe('Query', () => { test('query delegation', async () => { @@ -311,7 +312,7 @@ describe('Staking Tests', () => { .catch(error => { console.log(error); }); - }); + }, timeout); }); describe('Unbond', () => { test('unbond', async () => { @@ -327,7 +328,7 @@ describe('Staking Tests', () => { .catch(error => { console.log(error); }); - }); + }, timeout); }); describe('Redelegate', () => { test('redelegate', async () => { @@ -344,7 +345,7 @@ describe('Staking Tests', () => { .catch(error => { console.log(error); }); - }); + }, timeout); }); describe('TokenizeShares', () => { test('tokenizeShares', async () => { @@ -387,7 +388,7 @@ describe('Staking Tests', () => { .catch(error => { console.log(error); }); - }); + }, timeout); }); describe('DisableTokenizeShares', () => { test('disableTokenizeShares', async () => { @@ -401,7 +402,7 @@ describe('Staking Tests', () => { .catch(error => { console.log(error); }); - }); + }, timeout); }); describe('EnableTokenizeShares', () => { test('enableTokenizeShares', async () => { @@ -415,7 +416,7 @@ describe('Staking Tests', () => { .catch(error => { console.log(error); }); - }); + }, timeout); }); describe('ValidatorBond', () => { test('validatorBond', async () => { @@ -430,7 +431,7 @@ describe('Staking Tests', () => { .catch(error => { console.log(error); }); - }); + }, timeout); }); describe('UnbondValidator', () => { test('unbondValidator', async () => { @@ -444,6 +445,6 @@ describe('Staking Tests', () => { .catch(error => { }) - }) + }, timeout) }) }); diff --git a/test/tx.test.ts b/test/tx.test.ts index 8752ca97..e9c0fca4 100644 --- a/test/tx.test.ts +++ b/test/tx.test.ts @@ -13,10 +13,10 @@ describe('Tx Tests', () => { const msgs: any[] = [ { - type:types.TxType.MsgSend, - value:{ - from_address:'iaa176dd0tgn38grpc8hpxfmwl6sl8jfmkneg8mkxr', - to_address:'iaa1eqvkfthtrr93g4p9qspp54w6dtjtrn27ar7rpw', + type: types.TxType.MsgSend, + value: { + from_address: 'iaa176dd0tgn38grpc8hpxfmwl6sl8jfmkneg8mkxr', + to_address: 'iaa1eqvkfthtrr93g4p9qspp54w6dtjtrn27ar7rpw', amount } } @@ -24,18 +24,18 @@ describe('Tx Tests', () => { const moreMessages: any[] = [ { - type:types.TxType.MsgSend, - value:{ - from_address:'iaa176dd0tgn38grpc8hpxfmwl6sl8jfmkneg8mkxr', - to_address:'iaa1eqvkfthtrr93g4p9qspp54w6dtjtrn27ar7rpw', + type: types.TxType.MsgSend, + value: { + from_address: 'iaa176dd0tgn38grpc8hpxfmwl6sl8jfmkneg8mkxr', + to_address: 'iaa1eqvkfthtrr93g4p9qspp54w6dtjtrn27ar7rpw', amount } }, { - type:types.TxType.MsgSend, - value:{ - from_address:'iaa176dd0tgn38grpc8hpxfmwl6sl8jfmkneg8mkxr', - to_address:'iaa1eqvkfthtrr93g4p9qspp54w6dtjtrn27ar7rpw', + type: types.TxType.MsgSend, + value: { + from_address: 'iaa176dd0tgn38grpc8hpxfmwl6sl8jfmkneg8mkxr', + to_address: 'iaa1eqvkfthtrr93g4p9qspp54w6dtjtrn27ar7rpw', amount } } @@ -43,71 +43,71 @@ describe('Tx Tests', () => { describe('watch/cold wallet', () => { test('watch/cold wallet tx', async () => { - let baseTx = {...BaseTest.baseTx}; + let baseTx = { ...BaseTest.baseTx }; baseTx.account_number = 2; baseTx.sequence = 40; baseTx.chainId = BaseTest.getClient().config.chainId; // watch wallet - let unsignedStdTx = BaseTest.getClient().tx.buildTx(msgs, baseTx); + let unsignedStdTx = BaseTest.getClient().tx.buildTx(msgs, baseTx); let unsignedTxStr = Buffer.from(unsignedStdTx.getData()).toString('base64'); // cold wallet let recover_unsigned_std_tx = BaseTest.getClient().tx.newStdTxFromTxData(unsignedTxStr); let recover_signed_std_tx = await BaseTest.getClient().tx.sign(recover_unsigned_std_tx, baseTx, true); - let recover_signed_std_tx_str = Buffer.from(recover_signed_std_tx.getData()).toString('base64'); + let recover_signed_std_tx_str = Buffer.from(recover_signed_std_tx.getData()).toString('base64'); // watch wallet let signed_std_tx = BaseTest.getClient().tx.newStdTxFromTxData(recover_signed_std_tx_str); - await BaseTest.getClient().tx.broadcast(signed_std_tx, baseTx.mode).then(res=>{ + await BaseTest.getClient().tx.broadcast(signed_std_tx, baseTx.mode).then(res => { console.log(res); }).catch(error => { console.log(error); }); - }); + }, timeout); }); - let signedTx:any; + let signedTx: any; describe('Signing', () => { test('sign tx online', async () => { let unsignedTx = BaseTest.getClient().tx.buildTx(msgs, BaseTest.baseTx); - signedTx = await BaseTest.getClient().tx.sign(unsignedTx, BaseTest.baseTx); + signedTx = await BaseTest.getClient().tx.sign(unsignedTx, BaseTest.baseTx); console.log(signedTx); - }); + }, timeout); test('sign tx offline', async () => { - let baseTx = {...BaseTest.baseTx}; + let baseTx = { ...BaseTest.baseTx }; baseTx.account_number = 8; baseTx.sequence = 356; let unsignedTx = BaseTest.getClient().tx.buildTx(msgs, BaseTest.baseTx); - - let offlineSignedTx = await BaseTest.getClient().tx.sign(unsignedTx,baseTx); + + let offlineSignedTx = await BaseTest.getClient().tx.sign(unsignedTx, baseTx); console.log(offlineSignedTx); - }); + }, timeout); }); describe('Broadcast', () => { test('broadcast tx', async () => { - await BaseTest.getClient() - .tx.broadcast(signedTx, types.BroadcastMode.Commit) - .then(res => { - console.log(JSON.stringify(res)); - }) - .catch(error => { - console.log(error); - }); - }, + await BaseTest.getClient() + .tx.broadcast(signedTx, types.BroadcastMode.Commit) + .then(res => { + console.log(JSON.stringify(res)); + }) + .catch(error => { + console.log(error); + }); + }, timeout ); test('more messages', async () => { - await BaseTest.getClient() - .tx.buildAndSend(moreMessages,BaseTest.baseTx) + await BaseTest.getClient() + .tx.buildAndSend(moreMessages, BaseTest.baseTx) .then(res => { - console.log(JSON.stringify(res)); + console.log(JSON.stringify(res)); }) .catch(error => { console.log(error); });; - }, + }, timeout ); }); diff --git a/yarn.lock b/yarn.lock index 9792d82f..ae744551 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1550,12 +1550,12 @@ dependencies: undici-types "~5.26.4" -"@types/node@^22.2.0": - version "22.2.0" - resolved "https://registry.npmmirror.com/@types/node/-/node-22.2.0.tgz#7cf046a99f0ba4d628ad3088cb21f790df9b0c5b" - integrity sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ== +"@types/node@^22.3.0": + version "22.3.0" + resolved "https://registry.npmmirror.com/@types/node/-/node-22.3.0.tgz#7f8da0e2b72c27c4f9bd3cb5ef805209d04d4f9e" + integrity sha512-nrWpWVaDZuaVc5X84xJ0vNrLvomM205oQyLsRt7OHNZbSHslcWsvgFR7O7hire2ZonjLrWBbedmotmIlJDVd6g== dependencies: - undici-types "~6.13.0" + undici-types "~6.18.2" "@types/normalize-package-data@^2.4.0": version "2.4.4" @@ -1825,10 +1825,10 @@ asynckit@^0.4.0: resolved "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== -axios@^1.7.2: - version "1.7.2" - resolved "https://registry.npmmirror.com/axios/-/axios-1.7.2.tgz#b625db8a7051fbea61c35a3cbb3a1daa7b9c7621" - integrity sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw== +axios@^1.7.4: + version "1.7.4" + resolved "https://registry.npmmirror.com/axios/-/axios-1.7.4.tgz#4c8ded1b43683c8dd362973c393f3ede24052aa2" + integrity sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw== dependencies: follow-redirects "^1.15.6" form-data "^4.0.0" @@ -5225,10 +5225,10 @@ undici-types@~5.26.4: resolved "https://registry.npmmirror.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== -undici-types@~6.13.0: - version "6.13.0" - resolved "https://registry.npmmirror.com/undici-types/-/undici-types-6.13.0.tgz#e3e79220ab8c81ed1496b5812471afd7cf075ea5" - integrity sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg== +undici-types@~6.18.2: + version "6.18.2" + resolved "https://registry.npmmirror.com/undici-types/-/undici-types-6.18.2.tgz#8b678cf939d4fc9ec56be3c68ed69c619dee28b0" + integrity sha512-5ruQbENj95yDYJNS3TvcaxPMshV7aizdv/hWYjGIKoANWKjhWNBsr2YEuYZKodQulB1b8l7ILOuDQep3afowQQ== unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.0"