Skip to content

Latest commit

 

History

History
36 lines (32 loc) · 1.21 KB

README.md

File metadata and controls

36 lines (32 loc) · 1.21 KB

Sponosor Transaction Demo

Demo script to test sponsor transaction of sui.

Prerequisite

Install latest sui binary from here.

Run script

  1. Start local node
    yarn faucet-node
  2. Single sponsor transaction
    npx ts-node scripts/sponsor-transaction.ts
  3. Concurrence sponsor transactions(with different gas object)
    npx ts-node scripts/multi_gas.ts

About Sponsor Transaction

Sponsor Transaction allow one person to pay gas fee for the transaction from another person. The Sponsor Transaction has same structure as normal transaction, except that the GasOwner is the sponsor. Both the sender and sponsor need to sign the transaction.

Limitation

Transactions require specifying GAS Payments, which contains the objectid, version, and digest. If the version/digest changes before the transaction is submitted, the transaction cannot be validated by sui nodes. Therefore, sponsor cannot pay gas for multiple transactions using the same GSS Object at same time.

type GasObject = {
   objectId: string;
   version: number;
   digest: string;
}