-
Notifications
You must be signed in to change notification settings - Fork 44
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
Implement a new api for building script payload #565
Conversation
expect(response.signature?.type).toBe("single_sender"); | ||
}); | ||
test.only("with batch withdraw payload", async () => { | ||
let _aptos = getAptosClient({ network: Network.CUSTOM ,fullnode : "http://127.0.0.1:8080/v1",faucet: "http://127.0.0.1:8081",indexer: "http://127.0.0.1:8090"}) |
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.
let _aptos = getAptosClient({ network: Network.CUSTOM ,fullnode : "http://127.0.0.1:8080/v1",faucet: "http://127.0.0.1:8081",indexer: "http://127.0.0.1:8090"}) | |
let _aptos = getAptosClient({ network: Network.LOCAL }) |
8609dc9
to
bef04fa
Compare
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.
Had a first review -
- Please update the PR description with details on what the PR is for, etc
- Throughout the SDK we use
lowerCamelCase
syntax, please use it when feasible - I'd like us to find a better name than
transaction.build.scriptComposer
, something resemble totransaction.build.simple
ortransaction.build.multiAgent
withFeePayer?: boolean; | ||
}): Promise<SimpleTransaction> { | ||
let builder = new AptosScriptComposer(this.config); | ||
builder = await args.builder(builder); |
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.
we assign on line 110 and then reassign on line 111?
wasm = initSync(await create_wasm()); | ||
})(); | ||
|
||
function convert_batch_argument( |
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.
this should live in ../transactionBuilder
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 should live here? Because it's a helper function only used in this module?
@@ -93,6 +101,23 @@ export class Build { | |||
return generateTransaction({ aptosConfig: this.config, ...args }); | |||
} | |||
|
|||
async script_composer(args: { |
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 we find a more meaningful name than scriptComposer
? imo, when developers do aptos.transaction.build.scriptComposer
it is not that meaningful like aptos.transaction.build.simple/multiAgent
async script_composer(args: { | |
async scriptComposer(args: { |
@@ -61,6 +67,67 @@ describe("transaction submission", () => { | |||
|
|||
expect(response.signature?.type).toBe("single_sender"); | |||
}); | |||
test("with batch payload", async () => { | |||
let _aptos = getAptosClient({ network: Network.CUSTOM ,fullnode : "http://127.0.0.1:8080/v1",faucet: "http://127.0.0.1:8081",indexer: "http://127.0.0.1:8090"}) | |||
const builder = new AptosScriptComposer(_aptos.config); |
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.
please use the same transaction flow as in this file (and in the other test you have here) with aptos.transaction.build.script_composer
https://github.com/aptos-labs/aptos-ts-sdk/pull/565/files#diff-f1a843f6e05220a54a794964cbcb789ee9cfd6671ef77518e3a4a75d891f30d7R52-R66
bef04fa
to
71c3bbf
Compare
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.
- Please update CHANGELOG
- This feature needs to live in a section on aptos.dev also
e3c7533
to
a4ddb15
Compare
Docs added in aptos-labs/developer-docs#696 |
await this.builder.load_type_tag(nodeUrl, typeTag.toString()); | ||
} | ||
} | ||
const typeArguments = standardizeTypeTags(input.typeArguments); |
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'd like to keep the format same as the other transaction generation logic in the SDK and move the whole function generator part to the transactionBuilder.ts
file and have it use the memoize logic - same as we do for any other payload https://github.com/aptos-labs/aptos-ts-sdk/blob/main/src/transactions/transactionBuilder/transactionBuilder.ts#L124
2425c0d
to
0632cff
Compare
0632cff
to
eb07801
Compare
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.
LGTM. need to fix lint issue and tests
c63c1a0
to
0446a3d
Compare
Description
Add a new
scriptComposer
api in thetransactionSubmission
api to allow for SDK callers to dynamically invoke multiple Move functions in one transaction and compose the call sequences arbitrarily.Test Plan
New case added.
Related Links
https://github.com/runtian-zhou/AIPs/blob/ab7301a9ccfa5447661256539bab8d9338048dee/aips/aip-102.md
Checklist
pnpm fmt
?CHANGELOG.md
?