Skip to content

Commit

Permalink
fix: support for testnet3 network legacy modules (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinoosss authored Jun 27, 2024
1 parent 1a504d7 commit dca0754
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/adena-module/src/utils/messages-legacy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Any, PubKeySecp256k1, Tx, TxFee, TxSignature } from '@gnolang/tm2-js-client-legacy';
import { MsgCall, MsgAddPackage, MsgSend, MsgEndpoint } from '@gnolang/gno-js-client-legacy';
import { MemPackage, MemFile, MsgRun } from '@gnolang/gno-js-client/bin/proto/gno/vm';
import { MemPackage, MemFile, MsgRun } from '@gnolang/gno-js-client-legacy/bin/proto/gno/vm';
import { fromBase64 } from '../encoding';

export interface Document {
Expand Down
8 changes: 3 additions & 5 deletions packages/adena-module/src/wallet/keyring/keyring-util.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { Any, MsgAddPackage, MsgCall, MsgSend } from '@gnolang/gno-js-client';
import { AddressKeyring } from './address-keyring';
import { HDWalletKeyring } from './hd-wallet-keyring';
import { Keyring } from './keyring';
import { LedgerKeyring } from './ledger-keyring';
import { PrivateKeyKeyring } from './private-key-keyring';
import { Web3AuthKeyring } from './web3-auth-keyring';
import { Tx, TxSignature, Wallet as Tm2Wallet } from '@gnolang/tm2-js-client';
import { Tx, Wallet as Tm2Wallet } from '@gnolang/tm2-js-client';
import { Wallet as Tm2WalletLegacy } from '@gnolang/tm2-js-client-legacy';
import { Document, documentToTx, decodeTxMessages } from './../../utils/messages';
import {
Document as DocumentLegacy,
documentToTx as documentToTxLegacy,
decodeTxMessages as decodeTxMessagesLegacy,
} from './../../utils/messages';
} from './../../utils/messages-legacy';

const LEGACY_NETWORKS = ['test3'];

Expand Down Expand Up @@ -61,7 +59,7 @@ export function useTm2Wallet(document: Document): typeof Tm2Wallet | typeof Tm2W
export function makeSignedTx(wallet: Tm2Wallet | Tm2WalletLegacy, document: Document): Promise<Tx> {
const isLegacy = LEGACY_NETWORKS.includes(document.chain_id);
const tx = isLegacy ? documentToTxLegacy(document) : documentToTx(document);
const decodeTxMessageFunction = isLegacy ? decodeTxMessages : decodeTxMessagesLegacy;
const decodeTxMessageFunction = isLegacy ? decodeTxMessagesLegacy : decodeTxMessages;

return wallet.signTransaction(tx, decodeTxMessageFunction);
}

0 comments on commit dca0754

Please sign in to comment.