-
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
const addressComputer = new AddressComputer(); | ||
return addressComputer.computeContractAddress(deployer, BigInt(nonce.valueOf())); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. could have been: options.guardianAddress.toHex() |
||
Buffer.from(options.serviceID).toString("hex"), | ||
]; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ export class SmartContractTransactionsFactory { | |
this.abi = options.abi; | ||
this.tokenComputer = new TokenComputer(); | ||
this.dataArgsBuilder = new TokenTransfersDataBuilder(); | ||
this.contractDeployAddress = Address.fromHex(CONTRACT_DEPLOY_ADDRESS_HEX, this.config.addressHrp); | ||
this.contractDeployAddress = Address.newFromHex(CONTRACT_DEPLOY_ADDRESS_HEX, this.config.addressHrp); | ||
} | ||
|
||
createTransactionForDeploy(sender: Address, options: resources.ContractDeployInput): Transaction { | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. could have been: options.newOwner.toHex() |
||
|
||
return new TransactionBuilder({ | ||
config: this.config, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,6 @@ export function bigIntToHex(value: BigNumber.Value): string { | |
} | ||
|
||
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 commentThe 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 |
||
} |
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: