-
Notifications
You must be signed in to change notification settings - Fork 58
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
Feature/trcl 2812 optimization #51
Conversation
# Conflicts: # v4-client-js/__native__/__ios__/v4-native-client.js # v4-client-js/__native__/__ios__/v4-native-client.js.map # v4-client-js/package.json
@@ -159,11 +182,11 @@ export class Post { | |||
private async signTransaction( | |||
wallet: LocalWallet, | |||
messages: EncodeObject[], | |||
account: Account, |
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 wonder if we can make the account param optional.
and we can fallback to:
const account = await this.account(wallet.address, undefined);
That way we won't break existing integrations either.
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.
Changed
@@ -76,12 +79,22 @@ export class Post { | |||
async simulate( | |||
wallet: LocalWallet, | |||
messaging: () => Promise<EncodeObject[]>, | |||
account: () => Promise<Account>, |
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.
Same question here
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.
Just comment about unnecessary await
const msgsPromise = await messaging(); | ||
const accountPromise = account ? (await account()) : this.account(wallet.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.
const msgsPromise = await messaging(); | |
const accountPromise = account ? (await account()) : this.account(wallet.address!); | |
const msgsPromise = messaging(); | |
const accountPromise = account ? account() : this.account(wallet.address!); |
Since we are using promise.all later, we do not need to await here, since the await will unravel the promise.
const msgsPromise = messaging(); | ||
const accountPromise = account ? (await account()) : this.account(wallet.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.
const msgsPromise = messaging(); | |
const accountPromise = account ? (await account()) : this.account(wallet.address!); | |
const msgsPromise = messaging(); | |
const accountPromise = account ? account() : this.account(wallet.address!); |
Since we are using promise.all later, we do not need to await here, since the await will unravel the promise.
Optimized by
Tested by plugging in the v4-native-client.js into iOS app, and monitored network traffic with Charles.