Algorand mainnet deploy (#1434)

* algorand mainnet deploy

* Changes to sdk/js

* Update sdk changlog

Co-authored-by: Bruce Riley <briley@jumptrading.com>
This commit is contained in:
Paul Noel 2022-08-16 15:14:48 +00:00 committed by GitHub
parent b583708e53
commit eae0b51d37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 22 deletions

View File

@ -641,23 +641,23 @@ func runNode(cmd *cobra.Command, args []string) {
logger.Fatal("Please specify --terra2Contract") logger.Fatal("Please specify --terra2Contract")
} }
if *testnetMode { if *algorandIndexerRPC == "" {
if *algorandIndexerRPC == "" { logger.Fatal("Please specify --algorandIndexerRPC")
logger.Fatal("Please specify --algorandIndexerRPC") }
} if *algorandIndexerToken == "" {
if *algorandIndexerToken == "" { logger.Fatal("Please specify --algorandIndexerToken")
logger.Fatal("Please specify --algorandIndexerToken") }
} if *algorandAlgodRPC == "" {
if *algorandAlgodRPC == "" { logger.Fatal("Please specify --algorandAlgodRPC")
logger.Fatal("Please specify --algorandAlgodRPC") }
} if *algorandAlgodToken == "" {
if *algorandAlgodToken == "" { logger.Fatal("Please specify --algorandAlgodToken")
logger.Fatal("Please specify --algorandAlgodToken") }
} if *algorandAppID == 0 {
if *algorandAppID == 0 { logger.Fatal("Please specify --algorandAppID")
logger.Fatal("Please specify --algorandAppID") }
}
if *testnetMode {
if *pythnetContract == "" { if *pythnetContract == "" {
logger.Fatal("Please specify --pythnetContract") logger.Fatal("Please specify --pythnetContract")
} }
@ -816,9 +816,7 @@ func runNode(cmd *cobra.Command, args []string) {
chainObsvReqC[vaa.ChainIDPolygon] = make(chan *gossipv1.ObservationRequest) chainObsvReqC[vaa.ChainIDPolygon] = make(chan *gossipv1.ObservationRequest)
chainObsvReqC[vaa.ChainIDAvalanche] = make(chan *gossipv1.ObservationRequest) chainObsvReqC[vaa.ChainIDAvalanche] = make(chan *gossipv1.ObservationRequest)
chainObsvReqC[vaa.ChainIDOasis] = make(chan *gossipv1.ObservationRequest) chainObsvReqC[vaa.ChainIDOasis] = make(chan *gossipv1.ObservationRequest)
if *testnetMode || *unsafeDevMode { chainObsvReqC[vaa.ChainIDAlgorand] = make(chan *gossipv1.ObservationRequest)
chainObsvReqC[vaa.ChainIDAlgorand] = make(chan *gossipv1.ObservationRequest)
}
if *nearRPC != "" { if *nearRPC != "" {
chainObsvReqC[vaa.ChainIDNear] = make(chan *gossipv1.ObservationRequest) chainObsvReqC[vaa.ChainIDNear] = make(chan *gossipv1.ObservationRequest)
} }

View File

@ -106,6 +106,7 @@ var knownTokenbridgeEmitters = map[vaa.ChainID]string{
vaa.ChainIDPolygon: "0000000000000000000000005a58505a96d1dbf8df91cb21b54419fc36e93fde", vaa.ChainIDPolygon: "0000000000000000000000005a58505a96d1dbf8df91cb21b54419fc36e93fde",
vaa.ChainIDAvalanche: "0000000000000000000000000e082f06ff657d94310cb8ce8b0d9a04541d8052", vaa.ChainIDAvalanche: "0000000000000000000000000e082f06ff657d94310cb8ce8b0d9a04541d8052",
vaa.ChainIDOasis: "0000000000000000000000005848c791e09901b40a9ef749f2a6735b418d7564", vaa.ChainIDOasis: "0000000000000000000000005848c791e09901b40a9ef749f2a6735b418d7564",
vaa.ChainIDAlgorand: "25e716e0618d9f38b603a97cc42db659069c0f5185230e5e61679fa876191ec4",
vaa.ChainIDAurora: "00000000000000000000000051b5123a7b0F9b2bA265f9c4C8de7D78D52f510F", vaa.ChainIDAurora: "00000000000000000000000051b5123a7b0F9b2bA265f9c4C8de7D78D52f510F",
vaa.ChainIDFantom: "0000000000000000000000007C9Fc5741288cDFdD83CeB07f3ea7e22618D79D2", vaa.ChainIDFantom: "0000000000000000000000007C9Fc5741288cDFdD83CeB07f3ea7e22618D79D2",
vaa.ChainIDKarura: "000000000000000000000000ae9d7fe007b3327AA64A32824Aaac52C42a6E624", vaa.ChainIDKarura: "000000000000000000000000ae9d7fe007b3327AA64A32824Aaac52C42a6E624",

View File

@ -12,6 +12,7 @@ func chainList() []chainConfigEntry {
return []chainConfigEntry{ return []chainConfigEntry{
chainConfigEntry{emitterChainID: vaa.ChainIDTerra, dailyLimit: 500000}, chainConfigEntry{emitterChainID: vaa.ChainIDTerra, dailyLimit: 500000},
chainConfigEntry{emitterChainID: vaa.ChainIDOasis, dailyLimit: 500000}, chainConfigEntry{emitterChainID: vaa.ChainIDOasis, dailyLimit: 500000},
chainConfigEntry{emitterChainID: vaa.ChainIDAlgorand, dailyLimit: 500000},
chainConfigEntry{emitterChainID: vaa.ChainIDAurora, dailyLimit: 500000}, chainConfigEntry{emitterChainID: vaa.ChainIDAurora, dailyLimit: 500000},
chainConfigEntry{emitterChainID: vaa.ChainIDFantom, dailyLimit: 500000}, chainConfigEntry{emitterChainID: vaa.ChainIDFantom, dailyLimit: 500000},
chainConfigEntry{emitterChainID: vaa.ChainIDKarura, dailyLimit: 500000}, chainConfigEntry{emitterChainID: vaa.ChainIDKarura, dailyLimit: 500000},

View File

@ -1,5 +1,14 @@
# Changelog # Changelog
## 0.6.2
### Added
Algorand mainnet support
Updated consts.ts file
Exported signSendAndConfirmAlgorand()
## 0.6.1 ## 0.6.1
### Added ### Added

View File

@ -1,6 +1,6 @@
{ {
"name": "@certusone/wormhole-sdk", "name": "@certusone/wormhole-sdk",
"version": "0.6.1", "version": "0.6.2",
"description": "SDK for interacting with Wormhole", "description": "SDK for interacting with Wormhole",
"homepage": "https://wormholenetwork.com", "homepage": "https://wormholenetwork.com",
"main": "./lib/cjs/index.js", "main": "./lib/cjs/index.js",

View File

@ -1,7 +1,9 @@
// Algorand.ts // Algorand.ts
import algosdk, { import algosdk, {
Account,
Algodv2, Algodv2,
assignGroupID,
bigIntToBytes, bigIntToBytes,
decodeAddress, decodeAddress,
encodeAddress, encodeAddress,
@ -14,6 +16,7 @@ import algosdk, {
OnApplicationComplete, OnApplicationComplete,
signLogicSigTransaction, signLogicSigTransaction,
Transaction, Transaction,
waitForConfirmation,
} from "algosdk"; } from "algosdk";
import abi from "algosdk"; import abi from "algosdk";
@ -963,3 +966,26 @@ export function hexToNativeAssetBigIntAlgorand(s: string): bigint {
export function hexToNativeAssetStringAlgorand(s: string): string { export function hexToNativeAssetStringAlgorand(s: string): string {
return BigNumber.from(hexToUint8Array(s)).toString(); return BigNumber.from(hexToUint8Array(s)).toString();
} }
export async function signSendAndConfirmAlgorand(
algodClient: Algodv2,
txs: TransactionSignerPair[],
wallet: Account
) {
assignGroupID(txs.map((tx) => tx.tx));
const signedTxns: Uint8Array[] = [];
for (const tx of txs) {
if (tx.signer) {
signedTxns.push(await tx.signer.signTxn(tx.tx));
} else {
signedTxns.push(tx.tx.signTxn(wallet.sk));
}
}
await algodClient.sendRawTransaction(signedTxns).do();
const result = await waitForConfirmation(
algodClient,
txs[txs.length - 1].tx.txID(),
4
);
return result;
}

View File

@ -117,8 +117,8 @@ const MAINNET = {
nft_bridge: "0x04952D522Ff217f40B5Ef3cbF659EcA7b952a6c1", nft_bridge: "0x04952D522Ff217f40B5Ef3cbF659EcA7b952a6c1",
}, },
algorand: { algorand: {
core: undefined, core: "836919128",
token_bridge: undefined, token_bridge: "836919282",
nft_bridge: undefined, nft_bridge: undefined,
}, },
aurora: { aurora: {