Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2 for columbus-5 and bombay-9 #114

Merged
merged 69 commits into from
Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
6176ab9
terra.js update for bombay testnet
yun-yeo May 6, 2021
435eddb
build: bump version 2.0.0-beta.0
hanjukim May 6, 2021
4aeb4e9
fix account codec
yun-yeo May 6, 2021
50b025f
update version to v2.0.0-beta.1
yun-yeo May 6, 2021
438f853
fix(client/lcd): add chain_id parameter to estimate tax
hanjukim May 18, 2021
9235c96
update staking parameters
yun-yeo May 20, 2021
c3670aa
Merge branch 'bombay' of https://github.com/terra-project/terra.js in…
yun-yeo May 20, 2021
7de3dea
v2.0.0-beta.3
yun-yeo May 20, 2021
791e312
fix: undefined account_number and sequence as 0
hanjukim May 20, 2021
560b642
revert core/BaseAccount codec to core/Account
yun-yeo May 21, 2021
ff4143f
2.0.0-beta.4
yun-yeo May 21, 2021
21555ae
Merge branch 'bombay' of https://github.com/terra-project/terra.js in…
yun-yeo May 21, 2021
37a1f68
2.0.0-beta.5
yun-yeo May 21, 2021
931ab10
Fix GovAPI params call and test for bombay
brycepratt May 27, 2021
3cbee89
Fix AuthAPI test endpoint for bombay
brycepratt May 27, 2021
e78db3a
Fix BankAPI test endpoint for bombay
brycepratt May 27, 2021
b786c8c
Fix DistributionAPI test endpoint for bombay
brycepratt May 27, 2021
635ecfa
Fix MarketAPI test endpoint for bombay
brycepratt May 27, 2021
470d197
Removed max_evidence_age from Slashing Params and migrated to Bombay …
brycepratt May 27, 2021
edf68d0
Migrate supply to new endpoint on Bombay
brycepratt May 27, 2021
a02ceb2
Naming fixes and updating endpoints
brycepratt May 27, 2021
a16c1f3
Fix WasmAPI test endpoint to bombay
brycepratt May 27, 2021
78b4988
Apply bombay changes to MsgInstantiateContract
brycepratt Jun 2, 2021
fe276db
Merge branch 'master' into bombay
yun-yeo Jun 3, 2021
ea90889
convert contract base64 messages into json string
yun-yeo Jun 3, 2021
721d6d2
fix typo
yun-yeo Jun 3, 2021
66e3b3d
Merge branch 'bombay' of https://github.com/terra-money/terra.js into…
yun-yeo Jun 3, 2021
7831ee7
2.0.0-beta.7
yun-yeo Jun 3, 2021
113bb23
change all wasm messages to object type
yun-yeo Jun 3, 2021
0f4b4ca
Fix contractInfo result parsing
jonls Jun 13, 2021
66f9ff0
build: 2.0.0-beta.9
hanjukim Jun 13, 2021
8468d0b
Merge remote-tracking branch 'origin/master' into bombay
hanjukim Jun 13, 2021
b7da400
test(core): wasm/MsgInstantiateContract init_msg is now an object
hanjukim Jun 14, 2021
57891cf
fix: change default gas to 0.015uluna
hanjukim Jun 14, 2021
9e2988e
fix(oracle): remove MsgExchangeRatePrevote and MsgExchangeRateVote
hanjukim Jun 17, 2021
8658071
Fix breaking changes in staking module (#87)
hanjukim Jun 17, 2021
9e501fd
Merge branch 'master' into bombay
hanjukim Jun 18, 2021
4c0d3ae
fix(core): apply Bombay StdTx and TxInfo data
hanjukim Jun 18, 2021
4d8dbcc
fix(gov): WIP
hanjukim Jun 18, 2021
8b2477e
Merge branch 'master' into bombay
hanjukim Jun 28, 2021
f8f0743
Merge branch 'master' into bombay
hanjukim Jun 29, 2021
05ff1ef
fix: bombay compatibility of MsgGrantAuthorization
hanjukim Jun 30, 2021
abbd2e6
build: bump version to 2.0.0-beta.12
hanjukim Jun 30, 2021
e5475a3
fix(msgauth): remove .000Z from Date.toISOString for golang compatibi…
hanjukim Jun 30, 2021
586096f
build: bump version to 2.0.0-beta.13
hanjukim Jun 30, 2021
e538eac
remove wasm event & data params with cosmwasm@v0.15.0
yun-yeo Jul 7, 2021
249f48c
fix(core/wasm): remove EventParams import
hanjukim Jul 7, 2021
b08cb61
fix(util): remove wasm/EventParams import
hanjukim Jul 7, 2021
d6c22b9
Merge branch 'master' into bombay
hanjukim Jul 7, 2021
64b531d
fix(auth): handle empty address properly
hanjukim Jul 7, 2021
7d68f73
fix(wasm): remove max_contract_data_size
hanjukim Jul 7, 2021
92537f2
change admin to optional for MsgInstantiateContract
yun-yeo Jul 7, 2021
d5b5951
Merge branch 'master' into bombay
hanjukim Jul 7, 2021
9b77909
Merge branch 'master' into bombay
hanjukim Jul 7, 2021
32e76ac
build: bump up bombay tag to 2.0.0-beta.14
hanjukim Jul 8, 2021
47224d3
test(StakingAPI): MsgRevokeAuthorization data
hanjukim Jul 14, 2021
2405eb5
fix(lcd): move total supply from SupplyAPI to BankAPI
hanjukim Jul 14, 2021
2021621
build: bump version to 2.0.0-beta.15
hanjukim Jul 15, 2021
2a0ba14
fix(core/auth): rollback Account and LazyGradedVestingAccount to have…
hanjukim Jul 15, 2021
ed61264
chore: minor test changes
hanjukim Jul 15, 2021
4168a10
rollback mint&burn pool split
yun-yeo Jul 26, 2021
b7da7b1
Merge branch 'master' into bombay
hanjukim Jul 29, 2021
d917b3e
feat: apply market pool change
hanjukim Aug 11, 2021
ca9d9eb
build: bump version 2.0.0-beta.17
hanjukim Aug 11, 2021
7526034
build: bump version to 2.0.0
hanjukim Aug 11, 2021
0b5b027
fix: Account & LazyGradedVestingAccount test
hanjukim Aug 11, 2021
0e059e3
fix: change bombay-0007 to bombay-9
hanjukim Aug 13, 2021
cbf0c08
fix: remove unused import
hanjukim Aug 13, 2021
f50d24c
fix: parseInt
hanjukim Aug 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions integration-tests/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ async function main(): Promise<void> {

const instantiate = new MsgInstantiateContract(
test1.key.accAddress,
null,
+codeId, // code ID
{
count: 0,
}, // InitMsg
{ uluna: 10000000, ukrw: 1000000 }, // init coins
false // migratable
{ count: 0, }, // InitMsg
{ uluna: 10000000, ukrw: 1000000 } // init coins
);

const instantiateTx = await test1.createAndSignTx({
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/estimateFee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ const test1 = lt.wallets.test1;
const test2 = lt.wallets.test2;

async function main() {
const { data: tequilaGasPrices } = await Axios.get(
'https://tequila-fcd.terra.dev/v1/txs/gas_prices'
const { data: gasPrices } = await Axios.get(
'https://bombay-fcd.terra.dev/v1/txs/gas_prices'
);

const tequila = new LCDClient({
chainID: 'tequila-0004',
URL: 'https://tequila-fcd.terra.dev',
gasPrices: tequilaGasPrices,
chainID: 'bombay-9',
URL: 'https://bombay-lcd.terra.dev',
gasPrices,
});

// Test raw estimate fee function with specified gas
Expand Down
44 changes: 44 additions & 0 deletions integration-tests/executeContract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { LCDClient, MnemonicKey, MsgExecuteContract, Wallet } from '../src';

const client = new LCDClient({
chainID: 'bombay-9',
URL: 'https://bombay-lcd.terra.dev',
});

// LocalTerra test1 terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v
const mk = new MnemonicKey({
mnemonic:
'notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius',
});

const wallet = client.wallet(mk);

async function main() {
const execute = new MsgExecuteContract(
wallet.key.accAddress, // sender
'terra156v8s539wtz0sjpn8y8a8lfg8fhmwa7fy22aff', // contract account address
// handle msg
{
swap: {
offer_asset: {
amount: '1000000',
info: {
native_token: {
denom: 'uluna',
},
},
},
},
},
{ uluna: 1000000 } // coins
);

const executeTx = await wallet.createAndSignTx({
msgs: [execute],
});

const executeTxResult = await client.tx.broadcastSync(executeTx);
console.log(executeTxResult);
}

main().catch(console.error);
145 changes: 145 additions & 0 deletions integration-tests/msgauth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import {
LCDClient,
MnemonicKey,
Wallet,
MsgGrantAuthorization,
SendAuthorization,
MsgSend,
Coins,
MsgExecAuthorized,
MsgRevokeAuthorization,
} from '../src';

function grant(
granter: Wallet,
grantee: Wallet,
spendLimit: Coins.Input,
expiration: Date
) {
const msgs = [
new MsgGrantAuthorization(
granter.key.accAddress,
grantee.key.accAddress,
new SendAuthorization(spendLimit),
expiration
),
];

return granter.createAndSignTx({ msgs });
}

function sendAuthorized(
granter: Wallet,
grantee: Wallet,
to: string,
amount: Coins.Input
) {
const msgs = [
new MsgExecAuthorized(grantee.key.accAddress, [
new MsgSend(
granter.key.accAddress, // From test1
to,
amount
),
]),
];

return grantee.createAndSignTx({ msgs });
}

function revoke(granter: Wallet, grantee: Wallet, msg_type_url: string) {
const msgs = [
new MsgRevokeAuthorization(
granter.key.accAddress,
grantee.key.accAddress,
msg_type_url
),
];

return granter.createAndSignTx({ msgs });
}

async function main() {
const client = new LCDClient({
URL: 'http://localhost:1317',
chainID: 'localterra',
gasPrices: '169.77ukrw',
});

// Granter (terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v)
const granter = client.wallet(
new MnemonicKey({
mnemonic:
'notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius',
})
);

// Grantee (terra17lmam6zguazs5q5u6z5mmx76uj63gldnse2pdp)
const grantee = client.wallet(
new MnemonicKey({
mnemonic:
'quality vacuum heart guard buzz spike sight swarm shove special gym robust assume sudden deposit grid alcohol choice devote leader tilt noodle tide penalty',
})
);

// MsgGrantAuthorization
await grant(
granter,
grantee,
// Set enough spend limit since it will be decreased upon every MsgSend transactions
'1000000000000000ukrw',
// expire after 100 year
new Date('2050-01-01')
)
.then(tx => client.tx.broadcast(tx))
.then(console.info)
.catch(err => {
if (err.response) {
console.error(err.response.data);
} else {
console.error(err.message);
}
});

// MsgExecAuthorized of MsgSend
await sendAuthorized(
granter,
grantee,
// Test3
'terra1757tkx08n0cqrw7p86ny9lnxsqeth0wgp0em95',
'2000000000000ukrw'
)
.then(tx => client.tx.broadcast(tx))
.then(console.info)
.catch(err => {
if (err.response) {
// unauthorized: authorization not found: failed to execute message; message index: 0: failed to simulate tx
// happenes when there's not enough amount of granted amount of token

// insufficient funds: insufficient account funds; ...
// happenes when granter does not have enough amount of token
console.error(err.response.data);
} else {
console.error(err.message);
}
});

// MsgRevokeAuthorization
await revoke(granter, grantee, '/cosmos.bank.v1beta1.MsgSend')
.then(tx => client.tx.broadcast(tx))
.then(console.info)
.catch(err => {
if (err.response) {
// unauthorized: authorization not found: failed to execute message; message index: 0: failed to simulate tx
// happenes when there's not enough amount of granted amount of token

// insufficient funds: insufficient account funds; ...
// happenes when granter does not have enough amount of token
console.error(err.response.data);
} else {
console.error(err.message);
}
});
}

main().catch(console.error);
42 changes: 21 additions & 21 deletions integration-tests/paramchangeproposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,32 @@ const proposal = new ParameterChangeProposal('testing params', 'yay!', {
SlashFractionDowntime: new Dec(213.123),
},
treasury: {
taxpolicy: new PolicyConstraints(0, 100, new Coin('unused', 0), 3),
rewardpolicy: new PolicyConstraints(
TaxPolicy: new PolicyConstraints(0, 100, new Coin('unused', 0), 3),
RewardPolicy: new PolicyConstraints(
0,
1023423340,
new Coin('unused', 0),
3
),
seigniorageburdentarget: new Dec('2342.234234'),
miningincrement: new Dec(23423423423.234234234234982),
windowshort: 50,
windowlong: 2,
windowprobation: 30,
SeigniorageBurdenTarget: new Dec('2342.234234'),
MiningIncrement: new Dec(23423423423.234234234234982),
WindowShort: 50,
WindowLong: 2,
WindowProbation: 30,
hanjukim marked this conversation as resolved.
Show resolved Hide resolved
},
oracle: {
voteperiod: 345345,
votethreshold: new Dec('2342.234333'),
rewardband: new Dec('234343'),
rewarddistributionwindow: 345345,
slashfraction: new Dec(23423.232343),
slashwindow: 343311,
minvalidperwindow: new Dec(2342.234234),
VotePeriod: 345345,
VoteThreshold: new Dec('2342.234333'),
RewardBand: new Dec('234343'),
RewardDistributionWindow: 345345,
SlashFraction: new Dec(23423.232343),
SlashWindow: 343311,
MinValidPerWindow: new Dec(2342.234234),
},
market: {
poolrecoveryperiod: 234234234,
basepool: new Dec(232323232),
minstabilityspread: new Dec(343434),
PoolRecoveryPeriod: 234234234,
BasePool: new Dec(232323232),
MinStabilitySpread: new Dec(343434),
},
gov: {
depositparams: {
Expand All @@ -76,7 +76,7 @@ const proposal = new ParameterChangeProposal('testing params', 'yay!', {
tallyparams: {
quorum: new Dec(234234.2334),
threshold: new Dec(23423.2323),
veto: new Dec(1232.234),
veto_threshold: new Dec(1232.234),
},
},
mint: {
Expand All @@ -88,9 +88,9 @@ const proposal = new ParameterChangeProposal('testing params', 'yay!', {
GoalBonded: new Dec(0.01),
},
wasm: {
maxcontractgas: 1000000,
maxcontractmsgsize: 1000000,
maxcontractsize: 1000000,
MaxContractGas: 1000000,
MaxContractMsgSize: 1000000,
MaxContractSize: 1000000,
},
});

Expand Down
35 changes: 35 additions & 0 deletions integration-tests/send.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { LCDClient, MsgSend, MnemonicKey } from '../src';

// create a key out of a mnemonic
const mk = new MnemonicKey({
mnemonic:
'notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius',
});

// To use LocalTerra
const terra = new LCDClient({
URL: 'http://localhost:1317',
chainID: 'localterra',
gasPrices: '169.77ukrw',
});

// a wallet can be created out of any key
// wallets abstract transaction building
const wallet = terra.wallet(mk);

// create a simple message that moves coin balances
const send = new MsgSend(
'terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v',
'terra17lmam6zguazs5q5u6z5mmx76uj63gldnse2pdp',
{ uluna: 1000000, ukrw: 1230201, uusd: 1312029 }
);

wallet
.createAndSignTx({
msgs: [send],
memo: 'test from terra.js!',
})
.then(tx => terra.tx.broadcast(tx))
.then(result => {
console.log(`TX hash: ${result.txhash}`);
});
39 changes: 39 additions & 0 deletions integration-tests/submitProposal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {
Dec,
LCDClient,
MnemonicKey,
MsgSubmitProposal,
TextProposal,
CommunityPoolSpendProposal,
ParameterChangeProposal,
} from '../src';

const client = new LCDClient({
chainID: 'bombay-9',
URL: 'https://bombay-lcd.terra.dev',
});

// LocalTerra test1 terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v
const mk = new MnemonicKey({
mnemonic:
'notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius',
});

const wallet = client.wallet(mk);

async function main() {
const execute = new MsgSubmitProposal(
new TaxRateUpdateProposal('tax rate test', 'tax rate test', new Dec(0.2)),
{ uluna: 10000000 },
wallet.key.accAddress
);

const executeTx = await wallet.createAndSignTx({
msgs: [execute],
});

const executeTxResult = await client.tx.broadcastSync(executeTx);
console.log(executeTxResult);
}

main().catch(console.error);
4 changes: 2 additions & 2 deletions integration-tests/validatorsWithVotingPower.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { LCDClient } from '../src';

const terra = new LCDClient({
chainID: 'columbus-4',
URL: 'https://lcd.terra.dev',
chainID: 'bombay-9',
URL: 'https://bombay-lcd.terra.dev',
});

terra.utils.validatorsWithVotingPower().then(x => console.log(x));
Loading