Skip to content

Commit

Permalink
sdk/js: Version 0.7.2, added Xpla support
Browse files Browse the repository at this point in the history
  • Loading branch information
kev1n-peters authored and evan-gray committed Oct 12, 2022
1 parent 346f2f4 commit 88bdf0d
Show file tree
Hide file tree
Showing 15 changed files with 467 additions and 21 deletions.
3 changes: 1 addition & 2 deletions sdk/js/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Changelog

## 0.7.2

### Added

XPLA mainnet support
XPLA mainnet support and functions

## 0.7.1

Expand Down
215 changes: 203 additions & 12 deletions sdk/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sdk/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@solana/spl-token": "^0.1.8",
"@solana/web3.js": "^1.24.0",
"@terra-money/terra.js": "^3.1.3",
"@xpla/xpla.js": "^0.2.1",
"algosdk": "^1.15.0",
"axios": "^0.24.0",
"bech32": "^2.0.0",
Expand Down
2 changes: 2 additions & 0 deletions sdk/js/src/bridge/getEmitterAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export async function getEmitterAddressTerra(programAddress: string) {

export const getEmitterAddressInjective = getEmitterAddressTerra;

export const getEmitterAddressXpla = getEmitterAddressTerra;

export function getEmitterAddressAlgorand(appId: bigint): string {
const appAddr: string = getApplicationAddress(appId);
const decAppAddr: Uint8Array = decodeAddress(appAddr).publicKey;
Expand Down
18 changes: 18 additions & 0 deletions sdk/js/src/bridge/parseSequenceFromLog.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TransactionResponse } from "@solana/web3.js";
import { TxInfo } from "@terra-money/terra.js";
import { TxInfo as XplaTxInfo } from "@xpla/xpla.js";
import { BigNumber, ContractReceipt } from "ethers";
import { FinalExecutionOutcome } from "near-api-js/lib/providers";
import { Implementation__factory } from "../ethers-contracts";
Expand Down Expand Up @@ -51,6 +52,23 @@ export function parseSequenceFromLogTerra(info: TxInfo): string {
return sequence.toString();
}

export function parseSequenceFromLogXpla(info: XplaTxInfo): string {
// Scan for the Sequence attribute in all the outputs of the transaction.
// TODO: Make this not horrible.
let sequence = "";
const jsonLog = JSON.parse(info.raw_log);
jsonLog.map((row: any) => {
row.events.map((event: any) => {
event.attributes.map((attribute: any) => {
if (attribute.key === "message.sequence") {
sequence = attribute.value;
}
});
});
});
return sequence.toString();
}

export function parseSequencesFromLogTerra(info: TxInfo): string[] {
// Scan for the Sequence attribute in all the outputs of the transaction.
// TODO: Make this not horrible.
Expand Down
Loading

0 comments on commit 88bdf0d

Please sign in to comment.