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

Added sorobanAddressToBytes32 #14

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"disbalancing",
"disbalanced",
"USDY",
"YARO"
"YARO",
"Soroban",
"Sepolia"
],
"flagWords": [],
"ignorePaths": [
Expand Down
6 changes: 6 additions & 0 deletions scripts/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {BaseContract, ContractTransaction} from 'ethers';
import bs58 from 'bs58';

const TronWeb = require('tronweb');
const base32 = require('base32.js');

export async function handleDeployResult(contract: BaseContract) {
console.log('Contract address: ', contract.address);
Expand Down Expand Up @@ -48,6 +49,11 @@ export function solanaAddressToBytes32(address: string): string {
return bufferToHex(buffer);
}

export function sorobanAddressToBytes32(address: string): string {
const buffer = base32.decode(address);
return bufferToHex(buffer.slice(1, 33));
}

function tronAddressToEthAddress(address: string): string {
return Buffer.from(TronWeb.utils.crypto.decodeBase58Address(address))
.toString('hex')
Expand Down
Loading