-
Notifications
You must be signed in to change notification settings - Fork 75
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
feat: prepare sway scripts for mainnet #280
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
c271ef1
feat: add upgrade script
DefiCake 6c34d49
feat: add L2 bridge proxy owner transfer script
DefiCake 51ac219
chore: upgrade ts-sdk to 0.94.3
DefiCake 455c9f2
chore: align hardhat deployment names with testnet and devnet
DefiCake 112b0f3
feat: improve message relay utils
DefiCake de6303f
chore: bump ts-sdk
DefiCake aeb374e
feat: adapt new typings from fuels::provider.getMessageByNonce()
DefiCake 39b5f0e
feat: improve test-utils sway scripts
DefiCake e5bb548
Merge branch 'main' into deficake/mainnet-sway-scripts
DefiCake fd2fb7d
chore: remove gas limit override in relayCommonMessage
DefiCake c2da580
chore: add changeset
DefiCake 297abcc
chore: regenerate pnpm-lock.yaml
DefiCake 0013031
Merge branch 'main' into deficake/mainnet-sway-scripts
K1-R1 e6983bc
feat: update upgrade script and forc
DefiCake b18421c
chore: regenerate pnpm-lock.yaml
DefiCake 56c690b
fix: fix upgrade-bridge script
DefiCake 515d027
chore: remove console.log
DefiCake 2db8513
feat: improved workflow of upgrade-bridge script
DefiCake 6f720da
Merge branch 'main' into deficake/mainnet-sway-scripts
DefiCake 389303a
feat: add check-nonce script
DefiCake abc4f40
feat: add withdraw script
DefiCake f50b3ad
feat: estabilize withdraw-init
DefiCake ee6140e
feat: add check-balance script
DefiCake 42c9dbc
feat: add relay metadata script
DefiCake b41f25a
feat: add relay metadata message script
DefiCake af0d9e0
feat: add option in verify-asset-metadata to provide l1 address
DefiCake b1f353f
feat: improve verify-asset-metadata logging
DefiCake 541c43a
Merge branch 'main' into deficake/mainnet-sway-scripts
DefiCake 43804cc
feat: add upgrade script with kms
DefiCake 58761da
Merge branch 'main' into deficake/mainnet-sway-scripts
DefiCake 6fa2875
Merge branch 'main' into deficake/mainnet-sway-scripts
viraj124 5676348
Merge branch 'main' into deficake/mainnet-sway-scripts
DefiCake f85e439
docs: fix comments on a couple of scripts
DefiCake bb3f4f1
Merge branch 'main' into deficake/mainnet-sway-scripts
DefiCake File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@fuel-bridge/test-utils': minor | ||
--- | ||
|
||
Improve sway scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* This is a stand-alone script that looks an address' balances | ||
*/ | ||
|
||
import { password } from '@inquirer/prompts'; | ||
import { Provider, WalletUnlocked } from 'fuels'; | ||
|
||
let { L2_ADDRESS, L2_RPC } = process.env; | ||
|
||
const main = async () => { | ||
const provider = await Provider.create(L2_RPC, { resourceCacheTTL: -1 }); | ||
|
||
if (!L2_ADDRESS) { | ||
const privKey = await password({ message: 'Enter private key' }); | ||
const wallet = new WalletUnlocked(privKey); | ||
L2_ADDRESS = wallet.address.toB256(); | ||
} | ||
|
||
await provider.getBalances(L2_ADDRESS).then(console.log); | ||
}; | ||
|
||
main() | ||
.then(() => { | ||
console.log('\t> Finished'); | ||
process.exit(0); | ||
}) | ||
.catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* This is a stand-alone script that looks for a message nonce | ||
*/ | ||
|
||
import { BN, Message, Provider } from 'fuels'; | ||
|
||
let { L2_RPC, L2_MESSAGE_NONCE } = process.env; | ||
|
||
const main = async () => { | ||
if (!L2_MESSAGE_NONCE) { | ||
console.log('Specify L2_MESSAGE_NONCE'); | ||
return; | ||
} | ||
|
||
if (!L2_RPC) { | ||
console.log('Specify L2_RPC'); | ||
return; | ||
} | ||
|
||
const provider = await Provider.create(L2_RPC, { resourceCacheTTL: -1 }); | ||
|
||
const message: Message = await provider | ||
.getMessageByNonce(new BN(L2_MESSAGE_NONCE).toHex(32)) | ||
.catch((e) => { | ||
console.log(JSON.stringify(e, undefined, 2)); | ||
return null; | ||
}); | ||
|
||
if (!message) { | ||
console.log('Could not fetch message'); | ||
} | ||
|
||
console.log(message); | ||
}; | ||
|
||
main() | ||
.then(() => { | ||
console.log('\t> Finished'); | ||
process.exit(0); | ||
}) | ||
.catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* This is a stand-alone script that | ||
* calls the bridge 's withdraw method | ||
*/ | ||
|
||
import { Proxy } from '@fuel-bridge/fungible-token'; | ||
|
||
import { Provider } from 'fuels'; | ||
|
||
let { L2_RPC, L2_BRIDGE_ID } = process.env; | ||
const L1_LLAMA_RPC = 'https://eth.llamarpc.com'; | ||
const main = async () => { | ||
const fuel_provider = await Provider.create(L2_RPC, { resourceCacheTTL: -1 }); | ||
|
||
const proxy = new Proxy(L2_BRIDGE_ID, fuel_provider); | ||
|
||
console.log('\t> Checking asset metadata...'); | ||
|
||
console.log('Owner', (await proxy.functions._proxy_owner().get()).value); | ||
console.log('Target', (await proxy.functions.proxy_target().get()).value); | ||
}; | ||
|
||
main() | ||
.then(() => { | ||
console.log('\t> Finished'); | ||
process.exit(0); | ||
}) | ||
.catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* This is a stand-alone script that self-transfers | ||
* to convert a message coin into a coin utxo | ||
*/ | ||
|
||
import { Provider, TransactionStatus, Wallet } from 'fuels'; | ||
import { password } from '@inquirer/prompts'; | ||
|
||
let { L2_SIGNER, L2_RPC } = process.env; | ||
|
||
const main = async () => { | ||
if (!L2_RPC) { | ||
console.log('Must provide L2_RPC'); | ||
return; | ||
} | ||
|
||
const provider = await Provider.create(L2_RPC, { resourceCacheTTL: -1 }); | ||
|
||
if (!L2_SIGNER) { | ||
L2_SIGNER = await password({ message: 'Enter private key' }); | ||
} | ||
|
||
const wallet = Wallet.fromPrivateKey(L2_SIGNER, provider); | ||
const balance = await wallet.getBalance(); | ||
const tx = await wallet.transfer(wallet.address, balance.div(2)); | ||
|
||
console.log('\tTransaction ID: ', tx.id); | ||
const txResult = await tx.waitForResult(); | ||
|
||
if (txResult.status === TransactionStatus.success) { | ||
console.log('\t> Transaction succeeded'); | ||
} else { | ||
console.log('\t> Transaction errored'); | ||
} | ||
}; | ||
|
||
main() | ||
.then(() => { | ||
console.log('\t> Finished'); | ||
process.exit(0); | ||
}) | ||
.catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: why get a privatekey instead of address?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that you can get information about the loaded address from a certain private key