Skip to content

Commit 20e5c61

Browse files
authored
Merge pull request #63 from bandprotocol/v2.5.2
fix: amino type band modules, update chain proto
2 parents d9700a9 + e93e625 commit 20e5c61

File tree

619 files changed

+181525
-340195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

619 files changed

+181525
-340195
lines changed

.github/workflows/bandchainjs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
- name: Cache node_modules
2323
id: bandchainjs-node-modules-cache
24-
uses: actions/cache@v1
24+
uses: actions/cache@v4
2525
with:
2626
path: ./node_modules
2727
key: ${{ runner.OS }}-bandchainjs-test-${{ hashFiles('**/yarn.lock') }}-node-v${{ matrix.node-version }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22

33
# dependencies
4+
node_modules
45
/node_modules
56
*/node_modules/*
67
/.pnp

__tests__/client/client.test.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
QueryClient,
66
ServiceError,
77
UnaryResponse,
8-
} from '../../codegen/band/oracle/v1/query_pb_service'
8+
} from '../../codegen/oracle/v1/query_pb_service'
99

1010
import {
1111
QueryDataSourceRequest,
@@ -19,7 +19,7 @@ import {
1919
QueryRequestSearchRequest,
2020
QueryRequestSearchResponse,
2121
QueryRequestResponse,
22-
} from '../../codegen/band/oracle/v1/query_pb'
22+
} from '../../codegen/oracle/v1/query_pb'
2323
import {
2424
DataSource,
2525
OracleScript,
@@ -29,7 +29,7 @@ import {
2929
Report,
3030
RawReport,
3131
Result,
32-
} from '../../codegen/band/oracle/v1/oracle_pb'
32+
} from '../../codegen/oracle/v1/oracle_pb'
3333
import { ServiceClient } from '../../codegen/cosmos/base/tendermint/v1beta1/query_pb_service'
3434

3535
import {
@@ -71,7 +71,7 @@ import { Attribute } from '../../codegen/cosmos/base/abci/v1beta1/abci_pb'
7171
import { SignMode } from '../../codegen/cosmos/tx/signing/v1beta1/signing_pb'
7272
import { ModeInfo, Fee } from '../../codegen/cosmos/tx/v1beta1/tx_pb'
7373

74-
jest.mock('../../codegen/band/oracle/v1/query_pb_service')
74+
jest.mock('../../codegen/oracle/v1/query_pb_service')
7575
jest.mock('../../codegen/cosmos/base/tendermint/v1beta1/query_pb_service')
7676
jest.mock('../../codegen/cosmos/auth/v1beta1/query_pb_service')
7777
jest.mock('../../codegen/cosmos/tx/v1beta1/service_pb_service')
@@ -948,11 +948,8 @@ describe('get latest request', () => {
948948
'aHR0cHM6Ly91cy1ycGMuYmFuZGNoYWluLm9yZy9vcmFjbGUvcmVxdWVzdF9wcmljZXMgQlRDIEVUSA==',
949949
},
950950
],
951-
requester: '',
952951
executeGas: 1000000,
953952
ibcChannel: undefined,
954-
feeLimitList: [],
955-
tssEncoder: 0,
956953
},
957954
reportsList: [
958955
{

__tests__/client/sendTx.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ServiceClient as TxServiceClient } from '../../codegen/cosmos/tx/v1beta
55
import {
66
ServiceError,
77
UnaryResponse,
8-
} from '../../codegen/band/oracle/v1/query_pb_service'
8+
} from '../../codegen/oracle/v1/query_pb_service'
99

1010
import {
1111
BroadcastTxRequest,

__tests__/message.test.ts

+5-179
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,11 @@ import {
1515
MsgCreateOracleScript,
1616
MsgEditOracleScript,
1717
MsgDeposit,
18-
MsgVoteSignals,
19-
MsgSubmitSignalPrices,
20-
MsgUpdateReferenceSourceConfig,
21-
MsgUpdateParams,
2218
} from '../src/message'
2319
import { VoteOption } from '../codegen/cosmos/gov/v1beta1/gov_pb'
2420

2521
import fs from 'fs'
2622
import path from 'path'
27-
import {
28-
Signal,
29-
SignalPrice,
30-
ReferenceSourceConfig,
31-
} from '../codegen/band/feeds/v1beta1/feeds_pb'
32-
import { Params } from '../codegen/band/feeds/v1beta1/params_pb'
3323

3424
let coin = new Coin()
3525
coin.setDenom('uband')
@@ -54,7 +44,7 @@ describe('MsgRequest', () => {
5444
)
5545

5646
const anyMsg = new Any()
57-
const name = 'band.oracle.v1.MsgRequestData'
47+
const name = 'oracle.v1.MsgRequestData'
5848
anyMsg.pack(msgRequest.serializeBinary(), name, '/')
5949

6050
expect(msgRequest.toAny()).toEqual(anyMsg)
@@ -570,7 +560,7 @@ describe('MsgCreateDataSource', () => {
570560
)
571561

572562
const anyMsg = new Any()
573-
const name = 'band.oracle.v1.MsgCreateDataSource'
563+
const name = 'oracle.v1.MsgCreateDataSource'
574564
anyMsg.pack(msgCreateDs.serializeBinary(), name, '/')
575565

576566
expect(msgCreateDs.toAny()).toEqual(anyMsg)
@@ -691,7 +681,7 @@ describe('MsgEditDataSource', () => {
691681
)
692682

693683
const anyMsg = new Any()
694-
const name = 'band.oracle.v1.MsgEditDataSource'
684+
const name = 'oracle.v1.MsgEditDataSource'
695685
anyMsg.pack(msgCreateDs.serializeBinary(), name, '/')
696686

697687
expect(msgCreateDs.toAny()).toEqual(anyMsg)
@@ -768,7 +758,7 @@ describe('MsgCreateOracleScript', () => {
768758
)
769759

770760
const anyMsg = new Any()
771-
const name = 'band.oracle.v1.MsgCreateOracleScript'
761+
const name = 'oracle.v1.MsgCreateOracleScript'
772762
anyMsg.pack(msgCreateOs.serializeBinary(), name, '/')
773763
expect(msgCreateOs.toAny()).toEqual(anyMsg)
774764
expect(() => msgCreateOs.validate()).not.toThrow()
@@ -870,7 +860,7 @@ describe('MsgEditOracleScript', () => {
870860
)
871861

872862
const anyMsg = new Any()
873-
const name = 'band.oracle.v1.MsgEditOracleScript'
863+
const name = 'oracle.v1.MsgEditOracleScript'
874864
anyMsg.pack(msgEditOs.serializeBinary(), name, '/')
875865
expect(msgEditOs.toAny()).toEqual(anyMsg)
876866
expect(() => msgEditOs.validate()).not.toThrow()
@@ -963,167 +953,3 @@ describe('MsgDeposit', () => {
963953
})
964954
})
965955
})
966-
967-
describe('MsgVoteSignals', () => {
968-
let signal = new Signal()
969-
signal.setId('crypto_prices.btcbusd')
970-
signal.setPower(1)
971-
972-
it('create successfully', () => {
973-
const msgVoteSignals = new MsgVoteSignals(
974-
'band13eznuehmqzd3r84fkxu8wklxl22r2qfmtlth8c',
975-
[signal],
976-
)
977-
const anyMsg = new Any()
978-
const name = 'band.feeds.v1beta1.MsgVote'
979-
anyMsg.pack(msgVoteSignals.serializeBinary(), name, '/')
980-
981-
expect(msgVoteSignals.toAny()).toEqual(anyMsg)
982-
983-
expect(() => msgVoteSignals.validate()).not.toThrow()
984-
})
985-
986-
it('error MsgVoteSignals', () => {
987-
let msgs: MsgVoteSignals[] = []
988-
let errorText: string[] = []
989-
990-
msgs.push(new MsgVoteSignals('', [signal]))
991-
992-
errorText.push('Voter address should not be an empty string')
993-
994-
msgs.forEach((msg, index) => {
995-
expect(() => {
996-
msg.validate()
997-
}).toThrowError(errorText[index])
998-
})
999-
})
1000-
})
1001-
1002-
describe('MsgSubmitSignalPrice', () => {
1003-
const signalPrice = new SignalPrice()
1004-
signalPrice.setSignalId('crypto_price.btcbusd')
1005-
signalPrice.setPrice(1)
1006-
signalPrice.setStatus(0)
1007-
1008-
it('create successfully', () => {
1009-
const msgSubmitSignalPrice = new MsgSubmitSignalPrices(
1010-
'bandvaloper1dqsqfh537nzdr3ue9whc9tk7zqre4322hkru33',
1011-
1723027871382,
1012-
[signalPrice],
1013-
)
1014-
1015-
const anyMsg = new Any()
1016-
const name = 'band.feeds.v1beta1.MsgSubmitSignalPrices'
1017-
anyMsg.pack(msgSubmitSignalPrice.serializeBinary(), name, '/')
1018-
1019-
expect(msgSubmitSignalPrice.toAny()).toEqual(anyMsg)
1020-
1021-
expect(() => msgSubmitSignalPrice.validate()).not.toThrow()
1022-
})
1023-
1024-
it('error MsgSubmitSignalPrice', () => {
1025-
let msgs: MsgSubmitSignalPrices[] = []
1026-
let errorText: string[] = []
1027-
1028-
msgs.push(new MsgSubmitSignalPrices('', 1723027871382, [signalPrice]))
1029-
msgs.push(
1030-
new MsgSubmitSignalPrices(
1031-
'band13eznuehmqzd3r84fkxu8wklxl22r2qfmtlth8c',
1032-
1723027871382,
1033-
[signalPrice],
1034-
),
1035-
)
1036-
1037-
errorText.push('Validator address should not be an empty string')
1038-
errorText.push('invalid Bech32 prefix; expected bandvaloper, got band')
1039-
1040-
msgs.forEach((msg, index) => {
1041-
expect(() => {
1042-
msg.validate()
1043-
}).toThrowError(errorText[index])
1044-
})
1045-
})
1046-
})
1047-
1048-
describe('MsgUpdateReferenceSourceConfig', () => {
1049-
const referenceSource = new ReferenceSourceConfig()
1050-
referenceSource.setRegistryIpfsHash(
1051-
'QmTzQ1b4SijKVDe3XZPq3N5tHk3PvCjAosYtK6KDxDZXn6',
1052-
)
1053-
referenceSource.setRegistryVersion('1.1')
1054-
1055-
it('create successfully', () => {
1056-
const msgUpdateReferenceSourceConfig = new MsgUpdateReferenceSourceConfig(
1057-
'band13eznuehmqzd3r84fkxu8wklxl22r2qfmtlth8c',
1058-
referenceSource,
1059-
)
1060-
1061-
const anyMsg = new Any()
1062-
const name = 'band.feeds.v1beta1.MsgUpdateReferenceSourceConfig'
1063-
anyMsg.pack(msgUpdateReferenceSourceConfig.serializeBinary(), name, '/')
1064-
1065-
expect(msgUpdateReferenceSourceConfig.toAny()).toEqual(anyMsg)
1066-
1067-
expect(() => msgUpdateReferenceSourceConfig.validate()).not.toThrow()
1068-
})
1069-
1070-
it('error MsgUpdateReferenceSourceConfig', () => {
1071-
let msgs: MsgUpdateReferenceSourceConfig[] = []
1072-
let errorText: string[] = []
1073-
1074-
msgs.push(new MsgUpdateReferenceSourceConfig('', referenceSource))
1075-
1076-
errorText.push('Authority address should not be an empty string')
1077-
1078-
msgs.forEach((msg, index) => {
1079-
expect(() => {
1080-
msg.validate()
1081-
}).toThrowError(errorText[index])
1082-
})
1083-
})
1084-
})
1085-
1086-
describe('MsgUpdateParams', () => {
1087-
const param = new Params()
1088-
param.setAdmin('band13eznuehmqzd3r84fkxu8wklxl22r2qfmtlth8c')
1089-
param.setAllowableBlockTimeDiscrepancy(1)
1090-
param.setGracePeriod(1)
1091-
param.setMinInterval(1)
1092-
param.setMaxInterval(1)
1093-
param.setPowerStepThreshold(1)
1094-
param.setMaxCurrentFeeds(1)
1095-
param.setCooldownTime(1)
1096-
param.setMinDeviationBasisPoint(1)
1097-
param.setMaxDeviationBasisPoint(1)
1098-
param.setCurrentFeedsUpdateInterval(1)
1099-
1100-
it('create successfully', () => {
1101-
const msgUpdateParams = new MsgUpdateParams(
1102-
'band13eznuehmqzd3r84fkxu8wklxl22r2qfmtlth8c',
1103-
param,
1104-
)
1105-
1106-
const anyMsg = new Any()
1107-
const name = 'band.feeds.v1beta1.MsgUpdateParams'
1108-
anyMsg.pack(msgUpdateParams.serializeBinary(), name, '/')
1109-
1110-
expect(msgUpdateParams.toAny()).toEqual(anyMsg)
1111-
1112-
expect(() => msgUpdateParams.validate()).not.toThrow()
1113-
})
1114-
1115-
it('error MsgUpdateParams', () => {
1116-
let msgs: MsgUpdateParams[] = []
1117-
let errorText: string[] = []
1118-
1119-
msgs.push(new MsgUpdateParams('', param))
1120-
1121-
errorText.push('Admin address should not be an empty string')
1122-
1123-
msgs.forEach((msg, index) => {
1124-
expect(() => {
1125-
msg.validate()
1126-
}).toThrowError(errorText[index])
1127-
})
1128-
})
1129-
})

codegen/amino/amino_pb.d.ts

-2
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,3 @@ import * as google_protobuf_descriptor_pb from "google-protobuf/google/protobuf/
1414

1515
export const dontOmitempty: jspb.ExtensionFieldInfo<boolean>;
1616

17-
export const oneofName: jspb.ExtensionFieldInfo<string>;
18-

0 commit comments

Comments
 (0)