-
Notifications
You must be signed in to change notification settings - Fork 45
Update address to follow specs #552
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
Update address to follow specs #552
Conversation
src/abi/interaction.spec.ts
Outdated
| const hexLKMEX = "4c4b4d45582d616162393130"; | ||
| const hexNFT = "4d4f532d623962346232"; | ||
| const hexContractAddress = new Address(contract.getAddress().toBech32()).hex(); | ||
| const hexContractAddress = new Address(contract.getAddress().toBech32()).toHex(); |
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.
I think this could have been:
const hexContractAddress = contract.getAddress().toHex();
src/abi/smartContract.ts
Outdated
| */ | ||
| static computeAddress(owner: Address, nonce: bigint): Address { | ||
| const deployer = Address.fromBech32(owner.toBech32()); | ||
| const deployer = Address.newFromBech32(owner.toBech32()); |
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.
owner was already of type Address.
| const dataParts = [ | ||
| "SetGuardian", | ||
| Address.fromBech32(options.guardianAddress.bech32()).toHex(), | ||
| Address.newFromBech32(options.guardianAddress.toBech32()).toHex(), |
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.
could have been:
options.guardianAddress.toHex()| newOwner: Address; | ||
| }): Transaction { | ||
| const dataParts = ["ChangeOwnerAddress", Address.fromBech32(options.newOwner.toBech32()).toHex()]; | ||
| const dataParts = ["ChangeOwnerAddress", Address.newFromBech32(options.newOwner.toBech32()).toHex()]; |
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.
could have been:
options.newOwner.toHex()
src/utils.codec.ts
Outdated
| export function addressToHex(address: Address): string { | ||
| const buffer = Address.fromBech32(address.toString()).pubkey(); | ||
| const buffer = Address.newFromBech32(address.toString()).getPublicKey(); | ||
| return buffer.toString("hex"); |
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.
I think this is not needed since an Address can be eaasily converted to hex string. If still needed perhaps simply return address.toHex()?
| const deployer = Address.newFromBech32(owner.toBech32()); | ||
| const addressComputer = new AddressComputer(); | ||
| return addressComputer.computeContractAddress(deployer, BigInt(nonce.valueOf())); | ||
| return addressComputer.computeContractAddress(owner, BigInt(nonce.valueOf())); |
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.
The nonce is already of type bigint.
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.
Can be chaged in a future PR.
No description provided.