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")
}
if *testnetMode {
if *algorandIndexerRPC == "" {
logger.Fatal("Please specify --algorandIndexerRPC")
}
if *algorandIndexerToken == "" {
logger.Fatal("Please specify --algorandIndexerToken")
}
if *algorandAlgodRPC == "" {
logger.Fatal("Please specify --algorandAlgodRPC")
}
if *algorandAlgodToken == "" {
logger.Fatal("Please specify --algorandAlgodToken")
}
if *algorandAppID == 0 {
logger.Fatal("Please specify --algorandAppID")
}
if *algorandIndexerRPC == "" {
logger.Fatal("Please specify --algorandIndexerRPC")
}
if *algorandIndexerToken == "" {
logger.Fatal("Please specify --algorandIndexerToken")
}
if *algorandAlgodRPC == "" {
logger.Fatal("Please specify --algorandAlgodRPC")
}
if *algorandAlgodToken == "" {
logger.Fatal("Please specify --algorandAlgodToken")
}
if *algorandAppID == 0 {
logger.Fatal("Please specify --algorandAppID")
}
if *testnetMode {
if *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.ChainIDAvalanche] = 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 != "" {
chainObsvReqC[vaa.ChainIDNear] = make(chan *gossipv1.ObservationRequest)
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,9 @@
// Algorand.ts
import algosdk, {
Account,
Algodv2,
assignGroupID,
bigIntToBytes,
decodeAddress,
encodeAddress,
@ -14,6 +16,7 @@ import algosdk, {
OnApplicationComplete,
signLogicSigTransaction,
Transaction,
waitForConfirmation,
} from "algosdk";
import abi from "algosdk";
@ -963,3 +966,26 @@ export function hexToNativeAssetBigIntAlgorand(s: string): bigint {
export function hexToNativeAssetStringAlgorand(s: string): string {
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",
},
algorand: {
core: undefined,
token_bridge: undefined,
core: "836919128",
token_bridge: "836919282",
nft_bridge: undefined,
},
aurora: {