-
Notifications
You must be signed in to change notification settings - Fork 12
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: its example #114
feat: its example #114
Conversation
Code Coverage SummaryClick to see the summary
Click to see the extended report
|
let mut arguments = vector::empty<vector<u8>>(); | ||
|
||
// Singleton object | ||
let mut arg = vector::singleton<u8>(0); | ||
arg.append(object::id_address(singleton).to_bytes()); | ||
arguments.push_back(arg); | ||
|
||
// ITS object | ||
arg = vector::singleton<u8>(0); | ||
arg.append(object::id_address(its).to_bytes()); | ||
arguments.push_back(arg); | ||
|
||
// payload | ||
arg = vector[ 3 ]; | ||
arguments.push_back(arg); |
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.
create a helper function to construct each argument instead?
something like this
fun create_argument<T>(prefix: u8, value: T): vector<u8> {
let mut arg = vector::singleton<u8>(prefix);
arg.append(object::id_address(value).to_bytes());
arg
}
then, maybe reuse it like below
let arguments = vector[
create_argument(0, singleton),
create_argument(0, its),
vector[3],
];
and we can reuse it in the get_transaction
function as well.
let mut arguments = vector::empty<vector<u8>>(); | ||
|
||
// Singleton object | ||
let mut arg = vector::singleton<u8>(0); |
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.
perhaps we create a module somewhere to store all possible argument types?
for example,
module gmp::arg_types {
/// Prefix for object arguments, followed by exactly 32 bytes that contain the object id
public const TYPE_OBJECT u8 = 0;
/// Prefix for pure arguments, followed by the BCS encoded form of the pure
public const TYPE_PURE u8 = 1;
/// ... and so on
}
then import and use it here like below:
use gmp::arg_types;
create_argument(arg_types::TYPE_OBJECT, singleton)
…p-sui into feat/its-example
@@ -33,6 +33,6 @@ jobs: | |||
- name: Sleep for 30 seconds | |||
run: sleep 30s | |||
shell: bash | |||
|
|||
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.
extra whitespace
@@ -0,0 +1,211 @@ | |||
module example::its_example { |
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.
try adding the move formatter and run again (ping mysten team if there's an issue, maybe they have a newer version)
// ApprovedMessage | ||
let mut arg = vector::singleton<u8>(2); | ||
arguments.push_back(arg); | ||
|
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.
@@ -0,0 +1,211 @@ | |||
module example::its_example { |
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.
Add docstring explaining how the ITS example works
const trustedAddress = 'Trusted Address'; | ||
const gatewayInfo = {}; | ||
|
||
function calculateNextSigners() { |
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.
avoid code duplication
(change) => change.objectType === `${axelarPackageId}::discovery::RelayerDiscovery`, | ||
).objectId; | ||
|
||
await publishPackage(client, deployer, 'abi'); |
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.
create a deployITS helper?
const clock = '0x6'; | ||
const sui = '0x2'; |
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.
reuse constants instead of hardcoding
|
||
const clock = '0x6'; | ||
const sui = '0x2'; | ||
const MESSAGE_TYPE_SET_TRUSTED_ADDRESSES = '0x2af37a0d5d48850a855b1aaaf57f726c107eb99b40eabf4cc1ba30410cfa2f68'; |
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.
hash instead of hardcoding
AXE-4712