Demo script to test sponsor transaction of sui.
Install latest sui binary from here.
- Start local node
yarn faucet-node
- Single sponsor transaction
npx ts-node scripts/sponsor-transaction.ts
- Concurrence sponsor transactions(with different gas object)
npx ts-node scripts/multi_gas.ts
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.
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;
}