diff --git a/src/client/lcd/api/TxAPI.spec.ts b/src/client/lcd/api/TxAPI.spec.ts index d6942d9c6..6447843ed 100644 --- a/src/client/lcd/api/TxAPI.spec.ts +++ b/src/client/lcd/api/TxAPI.spec.ts @@ -15,10 +15,28 @@ const terra = new LCDClient({ URL: 'https://pisco-lcd.terra.dev', }); +const terraClassic = new LCDClient({ + chainID: 'columbus-5', + URL: 'https://lcd.terra.dev', +}); + const txAPI = new TxAPI(terra); const wallet = terra.wallet(mk); describe('TxAPI', () => { + describe('decode', () => { + it('classic', async () => { + terraClassic.tx.decode( + 'CpUHCsgFCjIvdGVycmEub3JhY2xlLnYxYmV0YTEuTXNnQWdncmVnYXRlRXhjaGFuZ2VSYXRlVm90ZRKRBQoEYTBiMRKlBDAuMDAwMDAwMDAwMDAwMDAwMDAwdXVzZCwwLjAwMDAwMDAwMDAwMDAwMDAwMHVrcncsMC4wMDAwMDAwMDAwMDAwMDAwMDB1c2RyLDAuMDAwMDAwMDAwMDAwMDAwMDAwdW1udCwwLjAwMDAwMDAwMDAwMDAwMDAwMHVldXIsMC4wMDAwMDAwMDAwMDAwMDAwMDB1Z2JwLDAuMDAwMDAwMDAwMDAwMDAwMDAwdWNueSwwLjAwMDAwMDAwMDAwMDAwMDAwMHVqcHksMC4wMDAwMDAwMDAwMDAwMDAwMDB1aW5yLDAuMDAwMDAwMDAwMDAwMDAwMDAwdWNhZCwwLjAwMDAwMDAwMDAwMDAwMDAwMHVjaGYsMC4wMDAwMDAwMDAwMDAwMDAwMDB1aGtkLDAuMDAwMDAwMDAwMDAwMDAwMDAwdWF1ZCwwLjAwMDAwMDAwMDAwMDAwMDAwMHVzZ2QsMC4wMDAwMDAwMDAwMDAwMDAwMDB1dGhiLDAuMDAwMDAwMDAwMDAwMDAwMDAwdXNlaywwLjAwMDAwMDAwMDAwMDAwMDAwMHVka2ssMC4wMDAwMDAwMDAwMDAwMDAwMDB1aWRyLDAuMDAwMDAwMDAwMDAwMDAwMDAwdXBocCwwLjA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RvLnNlY3AyNTZrMS5QdWJLZXkSIwohA+Q1ZNHkGfabYf1wRUdLcaJHlqDC62Llxam8fKgoH6mZEgQKAggBGJPWChIUCg4KBXVsdW5hEgUzNTk4MxCJ0g4aQOQgfKscECIN6Z6NtfWwEiZ2nxnnjdfZEVq4f2ypIm1QLY8Oo60Rfbe6Y10leA4bL5fPRHp8GC7d9hmrhtDVlXc=' + ); + }); + }); + describe('broadcast', () => { beforeEach(() => { // Need to respond to requests made by createAndSignTx. diff --git a/src/client/lcd/api/TxAPI.ts b/src/client/lcd/api/TxAPI.ts index 9943ed147..0b2f5b366 100644 --- a/src/client/lcd/api/TxAPI.ts +++ b/src/client/lcd/api/TxAPI.ts @@ -383,7 +383,10 @@ export class TxAPI extends BaseAPI { * @param tx transaction string to decode */ public decode(encodedTx: string): Tx { - return Tx.fromBuffer(Buffer.from(encodedTx, 'base64')); + return Tx.fromBuffer( + Buffer.from(encodedTx, 'base64'), + this.lcd.config.isClassic + ); } /**