-
Notifications
You must be signed in to change notification settings - Fork 37
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
Update address to follow specs #552
Conversation
src/abi/interaction.spec.ts
Outdated
@@ -65,7 +65,7 @@ describe("test smart contract interactor", function () { | |||
const hexBar = "4241522d356263303866"; | |||
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
@@ -288,7 +288,7 @@ export class SmartContract implements ISmartContract { | |||
* @param nonce The owner nonce used for the deployment transaction | |||
*/ | |||
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
.
@@ -63,7 +63,7 @@ export class AccountTransactionsFactory { | |||
createTransactionForSettingGuardian(sender: Address, options: SetGuardianInput): Transaction { | |||
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()
@@ -185,7 +185,7 @@ export class SmartContractTransactionsFactory { | |||
contract: Address; | |||
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 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.