Skip to content
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

[examples] Add a multi-agent script example #58

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

gregnazario
Copy link
Collaborator

@gregnazario gregnazario commented Oct 14, 2023

Description

This shows swapping coins and an object in one transaction.

Checks balances and all

Test Plan

 pnpm multi_agent_transfer             

> [email protected] multi_agent_transfer /opt/git/typescript-sdk/examples/typescript
> ts-node multi_agent_transfer.ts

This example will create two accounts (Alice and Bob), fund them, create an object, and transfer the object between them using move scripts and a multi-agent transaction.
=== Addresses ===

Alice's address is: 0x267d0a61dbc8c95f5941c4df71b5b01be2badc33d29b19bf977455b9c45167e5
Bob's address is: 0x804744a3d9ae3382fdc91b81ba1d426ce824da0ca6f6a2f2db5848f15e5ba9e5

=== Funding accounts ===

Alice's fund transaction:  100d8fc56d0bf973df44b0c73acc8b23de3a6b87367dd6524ffa832e3915666b
Bob's fund transaction:  5e325168dbb3bc14dcc4cf4b819fa369c2691ff596da7980e018f2a8f0a8d1fb

=== Balances ===

Alice's balance is: 100000000
Bob's balance is: 100000000
Alice: 100000000
Bob: 100000000

=== Create an object owned by Alice ===

Created object 0x4464eda7a303f942e87821cf477562d56840b94b0ace4f52b8c3d1f3b8ab7eab with transaction: 0xde495ba81433ef2d60e4a1d4f11f5464fc63cb625451afd96509427f11244754

=== Transfer object ownership to Bob ===

Transferred object in txn:  0x407711b522bb20c7aa2871fb19a272ace886ac492bc9945860f31942af951b4c

=== New Balances ===

Alice's balance is: 99948810
Bob's balance is: 99999990

Related Links

@gregnazario gregnazario force-pushed the multi-agent-script-example branch 3 times, most recently from 2bf1e9a to 7220429 Compare October 17, 2023 20:56
0xmigo
0xmigo previously requested changes Oct 17, 2023
examples/typescript/move/sources/create_object.move Outdated Show resolved Hide resolved
examples/typescript/multi_agent_transfer.ts Outdated Show resolved Hide resolved
@gregnazario gregnazario force-pushed the multi-agent-script-example branch from 7220429 to 00ec5ec Compare October 18, 2023 02:07
This shows swapping coins and an object in one transaction.
@gregnazario gregnazario force-pushed the multi-agent-script-example branch from 00ec5ec to 844a00e Compare October 18, 2023 02:08
@gregnazario gregnazario enabled auto-merge (squash) October 18, 2023 02:09
@gregnazario gregnazario dismissed 0xmigo’s stale review October 18, 2023 02:10

Addressed comments

@gregnazario gregnazario merged commit 8ba94ac into main Oct 18, 2023
10 checks passed
@gregnazario gregnazario deleted the multi-agent-script-example branch October 18, 2023 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants