sdk/js: injective package bump (#2175)

* chore: package bump

* chore: updated to latest package versions

* refactor: migrate to MsgExecuteContractCompat for EIP712 compatibility

* chore: added dev deps

* chore: packages bump
This commit is contained in:
Bojan Angjelkoski 2023-01-24 03:33:26 +01:00 committed by GitHub
parent bef87c498d
commit 81d1f83f45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 10719 additions and 2486 deletions

View File

@ -1,8 +1,8 @@
import { getNetworkInfo, Network } from "@injectivelabs/networks";
import { DEFAULT_STD_FEE } from "@injectivelabs/utils";
import { getStdFee, DEFAULT_STD_FEE } from "@injectivelabs/utils";
import {
PrivateKey,
TxGrpcClient,
TxGrpcApi,
ChainRestAuthApi,
createTransaction,
MsgExecuteContract,
@ -137,12 +137,13 @@ export async function execute_injective(
});
console.log("transaction:", transaction);
const accountDetails = await new ChainRestAuthApi(
network.sentryHttpApi
).fetchAccount(walletInjAddr);
const accountDetails = await new ChainRestAuthApi(network.rest).fetchAccount(
walletInjAddr
);
const { signBytes, txRaw } = createTransaction({
message: transaction.toDirectSign(),
memo: "",
fee: getStdFee((parseInt(DEFAULT_STD_FEE.gas, 10) * 2.5).toString()),
pubKey: walletPublicKey,
sequence: parseInt(accountDetails.account.base_account.sequence, 10),
accountNumber: parseInt(
@ -160,7 +161,7 @@ export async function execute_injective(
/** Append Signatures */
txRaw.setSignaturesList([sig]);
const txService = new TxGrpcClient(network.sentryGrpcApi);
const txService = new TxGrpcApi(network.grpc);
console.log("simulate transaction...");
/** Simulate transaction */

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,9 @@
"@celo-tools/celo-ethers-wrapper": "^0.1.0",
"@certusone/wormhole-sdk": "^0.9.8",
"@cosmjs/encoding": "^0.26.2",
"@injectivelabs/networks": "^1.0.52",
"@injectivelabs/sdk-ts": "^1.0.289",
"@injectivelabs/utils": "^1.0.45",
"@injectivelabs/networks": "^1.0.73",
"@injectivelabs/sdk-ts": "^1.0.368",
"@injectivelabs/utils": "^1.0.63",
"@solana/web3.js": "^1.22.0",
"@terra-money/terra.js": "^3.1.3",
"@types/config": "^3.3.0",

6
package-lock.json generated Normal file
View File

@ -0,0 +1,6 @@
{
"name": "wormhole",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}

12031
sdk/js/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -51,12 +51,15 @@
"@types/node-fetch": "^2.6.2",
"@types/react": "^17.0.19",
"copy-dir": "^1.3.0",
"dotenv": "16.0.3",
"ethers": "^5.6.8",
"jest": "^27.3.1",
"prettier": "^2.3.2",
"truffle": "^5.7.2",
"ts-jest": "^27.0.7",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typechain": "^5.0.0",
"typedoc": "0.21.10",
"typescript": "^4.3.5",
"web3": "^1.6.1"
@ -64,10 +67,10 @@
"dependencies": {
"@certusone/wormhole-sdk-proto-web": "0.0.6",
"@certusone/wormhole-sdk-wasm": "^0.0.1",
"@injectivelabs/networks": "^1.0.73",
"@injectivelabs/sdk-ts": "^1.0.368",
"@injectivelabs/utils": "^1.0.63",
"@coral-xyz/borsh": "0.2.6",
"@injectivelabs/networks": "^1.0.52",
"@injectivelabs/sdk-ts": "1.0.289",
"@injectivelabs/utils": "1.0.45",
"@project-serum/anchor": "^0.25.0",
"@solana/spl-token": "^0.3.5",
"@solana/web3.js": "^1.66.2",

View File

@ -1,8 +1,8 @@
import { getNetworkInfo, Network } from "@injectivelabs/networks";
import { DEFAULT_STD_FEE } from "@injectivelabs/utils";
import { getStdFee, DEFAULT_STD_FEE } from "@injectivelabs/utils";
import {
PrivateKey,
TxGrpcClient,
TxGrpcApi,
ChainGrpcWasmApi,
ChainRestAuthApi,
createTransaction,
@ -65,7 +65,7 @@ function getEndPoint() {
test.skip("testnet - injective contract is own admin", async () => {
const network = getNetworkInfo(getEndPoint());
const client = new ChainGrpcWasmApi(network.sentryGrpcApi);
const client = new ChainGrpcWasmApi(network.grpc);
const coreQueryResult = await client.fetchContractInfo(
CONTRACTS.TESTNET.injective.core
);
@ -79,7 +79,7 @@ test.skip("testnet - injective contract is own admin", async () => {
});
test.skip("testnet - injective query guardian_set_info", async () => {
const network = getNetworkInfo(getEndPoint());
const client = new ChainGrpcWasmApi(network.sentryGrpcApi);
const client = new ChainGrpcWasmApi(network.grpc);
// https://k8s.testnet.lcd.injective.network/cosmwasm/wasm/v1/contract/inj1xx3aupmgv3ce537c0yce8zzd3sz567syuyedpg/smart/eyJndWFyZGlhbl9zZXRfaW5mbyI6e319
const queryResult = await client.fetchSmartContractState(
CONTRACTS.TESTNET.injective.core,
@ -96,7 +96,7 @@ test.skip("testnet - injective query guardian_set_info", async () => {
});
test.skip("testnet - injective query state", async () => {
const network = getNetworkInfo(getEndPoint());
const client = new ChainGrpcWasmApi(network.sentryGrpcApi);
const client = new ChainGrpcWasmApi(network.grpc);
const queryResult = await client.fetchSmartContractState(
CONTRACTS.TESTNET.injective.core,
Buffer.from('{"get_state":{}}').toString("base64")
@ -112,7 +112,7 @@ test.skip("testnet - injective query state", async () => {
});
test.skip("testnet - injective query token bridge", async () => {
const network = getNetworkInfo(getEndPoint());
const client = new ChainGrpcWasmApi(network.sentryGrpcApi);
const client = new ChainGrpcWasmApi(network.grpc);
// const wrappedAsset = await getIsWrappedAssetInjective(
// CONTRACTS.TESTNET.injective.token_bridge,
// "inj10jc4vr9vfq0ykkmfvfgz430w8z6hwdlqhdw9l8"
@ -144,16 +144,16 @@ test.skip("testnet - injective attest native asset", async () => {
// Local consts
const tba = CONTRACTS.TESTNET.injective.token_bridge;
const network = getNetworkInfo(getEndPoint());
const client = new ChainGrpcWasmApi(network.sentryGrpcApi);
const client = new ChainGrpcWasmApi(network.grpc);
// Set up Inj wallet
const walletPKHash: string = process.env.ETH_KEY || "";
const walletPK = PrivateKey.fromHex(walletPKHash);
const walletInjAddr = walletPK.toBech32();
const walletPublicKey = walletPK.toPublicKey().toBase64();
const accountDetails = await new ChainRestAuthApi(
network.sentryHttpApi
).fetchAccount(walletInjAddr);
const accountDetails = await new ChainRestAuthApi(network.rest).fetchAccount(
walletInjAddr
);
// Attest native inj
const result = await attestFromInjective(tba, walletInjAddr, "inj");
@ -164,10 +164,7 @@ test.skip("testnet - injective attest native asset", async () => {
const { signBytes, txRaw } = createTransaction({
message: result.toDirectSign(),
memo: "",
fee: {
...DEFAULT_STD_FEE,
gas: (parseInt(DEFAULT_STD_FEE.gas, 10) * 2.5).toString(),
},
fee: getStdFee((parseInt(DEFAULT_STD_FEE.gas, 10) * 2.5).toString()),
pubKey: walletPublicKey,
sequence: parseInt(accountDetails.account.base_account.sequence, 10),
accountNumber: parseInt(
@ -182,7 +179,7 @@ test.skip("testnet - injective attest native asset", async () => {
/** Append Signatures */
txRaw.setSignaturesList([signature]);
const txService = new TxGrpcClient(network.sentryGrpcApi);
const txService = new TxGrpcApi(network.grpc);
console.log("Simulating transaction...");
/** Simulate transaction */
@ -249,16 +246,13 @@ test.skip("testnet - injective attest foreign asset", async () => {
const network = getNetworkInfo(getEndPoint());
/** Account Details **/
const accountDetails = await new ChainRestAuthApi(
network.sentryHttpApi
).fetchAccount(walletInjAddr);
const accountDetails = await new ChainRestAuthApi(network.rest).fetchAccount(
walletInjAddr
);
const { signBytes, txRaw } = createTransaction({
message: result.toDirectSign(),
memo: "",
fee: {
...DEFAULT_STD_FEE,
gas: (parseInt(DEFAULT_STD_FEE.gas, 10) * 2.5).toString(),
},
fee: getStdFee((parseInt(DEFAULT_STD_FEE.gas, 10) * 2.5).toString()),
pubKey: walletPublicKey,
sequence: parseInt(accountDetails.account.base_account.sequence, 10),
accountNumber: parseInt(
@ -272,7 +266,7 @@ test.skip("testnet - injective attest foreign asset", async () => {
/** Append Signatures */
txRaw.setSignaturesList([signature]);
const txService = new TxGrpcClient(network.sentryGrpcApi);
const txService = new TxGrpcApi(network.grpc);
/** Simulate transaction */
const simulationResponse = await txService.simulate(txRaw);
@ -294,7 +288,7 @@ test.skip("testnet - injective attest foreign asset", async () => {
test.skip("testnet - injective get foreign asset", async () => {
const tba = CONTRACTS.TESTNET.injective.token_bridge;
const network = getNetworkInfo(getEndPoint());
const client = new ChainGrpcWasmApi(network.sentryGrpcApi);
const client = new ChainGrpcWasmApi(network.grpc);
// const foreignAssetAddress = "inj10jc4vr9vfq0ykkmfvfgz430w8z6hwdlqhdw9l8";
const foreignAssetAddress =
"000000000000000000000000ae13d989dac2f0debff460ac112a837c89baa7cd";
@ -397,10 +391,10 @@ test.skip("testnet - injective submit a vaa", async () => {
const walletPublicKey = walletPK.toPublicKey().toBase64();
const network = getNetworkInfo(getEndPoint());
const client = new ChainGrpcWasmApi(network.sentryGrpcApi);
const client = new ChainGrpcWasmApi(network.grpc);
console.log("Getting account details...");
const accountDetails = await new ChainRestAuthApi(
network.sentryHttpApi
network.rest
).fetchAccount(walletInjAddr);
console.log("createWrappedOnInjective...", vaaBytes);
const msg = await createWrappedOnInjective(tba, walletInjAddr, vaaBytes);
@ -433,7 +427,7 @@ test.skip("testnet - injective submit a vaa", async () => {
/** Append Signatures */
txRaw.setSignaturesList([signature]);
const txService = new TxGrpcClient(network.sentryGrpcApi);
const txService = new TxGrpcApi(network.grpc);
console.log("simulate transaction...");
/** Simulate transaction */
@ -505,7 +499,7 @@ test.skip("testnet - injective submit a vaa", async () => {
console.log("roi", roi);
{
const accountDetails = await new ChainRestAuthApi(
network.sentryHttpApi
network.rest
).fetchAccount(walletInjAddr);
const { signBytes, txRaw } = createTransaction({
message: roi.toDirectSign(),
@ -528,7 +522,7 @@ test.skip("testnet - injective submit a vaa", async () => {
/** Append Signatures */
txRaw.setSignaturesList([sig]);
const txService = new TxGrpcClient(network.sentryGrpcApi);
const txService = new TxGrpcApi(network.grpc);
console.log("simulate transaction...");
/** Simulate transaction */
@ -560,7 +554,7 @@ test.skip("testnet - injective submit a vaa", async () => {
console.log("checking vaa:", signedVaa.vaaBytes);
console.log("checking vaa:", uint8ArrayToHex(signedVaa.vaaBytes));
const network = getNetworkInfo(getEndPoint());
const client = new ChainGrpcWasmApi(network.sentryGrpcApi);
const client = new ChainGrpcWasmApi(network.grpc);
const queryResult = await client.fetchSmartContractState(
CONTRACTS.TESTNET.injective.token_bridge,
Buffer.from(
@ -637,9 +631,9 @@ test.skip("Attest and transfer token from Injective to Algorand", async () => {
Asset
);
const accountDetails = await new ChainRestAuthApi(
network.sentryHttpApi
).fetchAccount(walletInjAddr);
const accountDetails = await new ChainRestAuthApi(network.rest).fetchAccount(
walletInjAddr
);
const { signBytes, txRaw } = createTransaction({
message: attestMsg.toDirectSign(),
memo: "",
@ -661,7 +655,7 @@ test.skip("Attest and transfer token from Injective to Algorand", async () => {
/** Append Signatures */
txRaw.setSignaturesList([signedMsg]);
const txService = new TxGrpcClient(network.sentryGrpcApi);
const txService = new TxGrpcApi(network.grpc);
console.log("simulate transaction...");
/** Simulate transaction */
@ -787,7 +781,7 @@ test.skip("Attest and transfer token from Injective to Algorand", async () => {
/** Append Signatures */
txRaw.setSignaturesList([signedMsg]);
const txService = new TxGrpcClient(network.sentryGrpcApi);
const txService = new TxGrpcApi(network.grpc);
console.log("simulate transaction...");
/** Simulate transaction */

View File

@ -1,12 +1,12 @@
import { getNetworkInfo, Network } from "@injectivelabs/networks";
import { DEFAULT_STD_FEE } from "@injectivelabs/utils";
import { DEFAULT_STD_FEE, getStdFee } from "@injectivelabs/utils";
import {
TxClient,
PrivateKey,
TxGrpcClient,
TxGrpcApi,
ChainRestAuthApi,
createTransaction,
MsgExecuteContract,
MsgExecuteContractCompat,
} from "@injectivelabs/sdk-ts";
import { test } from "@jest/globals";
import { CONTRACTS } from "..";
@ -33,7 +33,7 @@ test.skip("testnet - injective attest native token", async () => {
/** Prepare the Message */
console.log("Prepare the message");
const msg = MsgExecuteContract.fromJSON({
const msg = MsgExecuteContractCompat.fromJSON({
contractAddress: CONTRACTS.TESTNET.injective.token_bridge,
sender: injectiveAddress,
exec: {
@ -58,10 +58,7 @@ test.skip("testnet - injective attest native token", async () => {
const { signBytes, txRaw } = createTransaction({
message: msg.toDirectSign(),
memo: "",
fee: {
...DEFAULT_STD_FEE,
gas: (parseInt(DEFAULT_STD_FEE.gas, 10) * 2.5).toString(),
},
fee: getStdFee((parseInt(DEFAULT_STD_FEE.gas, 10) * 2.5).toString()),
pubKey: publicKey,
sequence: parseInt(accountDetails.account.base_account.sequence, 10),
accountNumber: parseInt(
@ -83,7 +80,7 @@ test.skip("testnet - injective attest native token", async () => {
console.log("Calculate hash");
console.log(`Transaction Hash: ${await TxClient.hash(txRaw)}`);
const txService = new TxGrpcClient(network.sentryGrpcApi);
const txService = new TxGrpcApi(network.sentryGrpcApi);
/** Simulate transaction */
console.log("Simulate transaction");

View File

@ -7,7 +7,7 @@ import {
Transaction,
} from "@solana/web3.js";
import { MsgExecuteContract } from "@terra-money/terra.js";
import { MsgExecuteContract as MsgExecuteContractInjective } from "@injectivelabs/sdk-ts";
import { MsgExecuteContractCompat as MsgExecuteContractInjective } from "@injectivelabs/sdk-ts";
import {
Algodv2,
bigIntToBytes,

View File

@ -37,7 +37,7 @@ import {
callFunctionNear,
hashLookup,
} from "../utils";
import { MsgExecuteContract as MsgExecuteContractInjective } from "@injectivelabs/sdk-ts";
import { MsgExecuteContractCompat as MsgExecuteContractInjective } from "@injectivelabs/sdk-ts";
import {
createCompleteTransferNativeInstruction,
createCompleteTransferWrappedInstruction,

View File

@ -16,7 +16,7 @@ import {
Transaction as SolanaTransaction,
} from "@solana/web3.js";
import { MsgExecuteContract } from "@terra-money/terra.js";
import { MsgExecuteContract as MsgExecuteContractInjective } from "@injectivelabs/sdk-ts";
import { MsgExecuteContractCompat as MsgExecuteContractInjective } from "@injectivelabs/sdk-ts";
import {
Algodv2,
bigIntToBytes,