Skip to content

Commit

Permalink
[GatewayAPI] - Make gas input optional in Gateway + Gateway refactori…
Browse files Browse the repository at this point in the history
…ng (MystenLabs#1877)

* * moved coin selection to gateway
* gas is now optional, the gateway will choose one from the signer's possession (feature migrated from wallet)
* transaction creation endpoints (sui_transferCoin, sui_moveCall etc) now accepts ObjectID instead of reference, the TransactionByte response will contain the gas object ref and input objects for client to verify the object and version used are correct
* Refactoring to make naming consistent in GatewayAPI

* update schema file

* Update sui_core/src/gateway_state.rs

Co-authored-by: ade <[email protected]>

Co-authored-by: ade <[email protected]>
  • Loading branch information
patrickkuo and oxade authored May 11, 2022
1 parent f0d3ad7 commit 0a315ed
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 266 deletions.
4 changes: 2 additions & 2 deletions faucet/src/faucet/simple_faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl SimpleFaucet {
signer,
coin_id,
amounts.to_vec().clone(),
gas_object_id,
Some(gas_object_id),
budget,
)
.await?;
Expand Down Expand Up @@ -146,7 +146,7 @@ impl SimpleFaucet {

let data = context
.gateway
.transfer_coin(signer, coin_id, gas_object_id, budget, recipient)
.transfer_coin(signer, coin_id, Some(gas_object_id), budget, recipient)
.await?;
let signature = context
.keystore
Expand Down
92 changes: 82 additions & 10 deletions sui/open_rpc/spec/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@
}
},
{
"name": "gas_payment",
"name": "gas",
"summary": "",
"description": "",
"required": true,
"schema": {
"$ref": "#/components/schemas/ObjectID"
}
Expand Down Expand Up @@ -166,10 +165,9 @@
}
},
{
"name": "gas_object_id",
"name": "gas",
"summary": "",
"description": "",
"required": true,
"schema": {
"$ref": "#/components/schemas/ObjectID"
}
Expand Down Expand Up @@ -222,10 +220,9 @@
}
},
{
"name": "gas_object_id",
"name": "gas",
"summary": "",
"description": "",
"required": true,
"schema": {
"$ref": "#/components/schemas/ObjectID"
}
Expand Down Expand Up @@ -289,10 +286,9 @@
}
},
{
"name": "gas_payment",
"name": "gas",
"summary": "",
"description": "",
"required": true,
"schema": {
"$ref": "#/components/schemas/ObjectID"
}
Expand Down Expand Up @@ -351,10 +347,9 @@
}
},
{
"name": "gas_payment",
"name": "gas",
"summary": "",
"description": "",
"required": true,
"schema": {
"$ref": "#/components/schemas/ObjectID"
}
Expand Down Expand Up @@ -900,6 +895,59 @@
"Identifier": {
"type": "string"
},
"InputObjectKind": {
"oneOf": [
{
"type": "object",
"required": [
"MovePackage"
],
"properties": {
"MovePackage": {
"$ref": "#/components/schemas/ObjectID"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"ImmOrOwnedMoveObject"
],
"properties": {
"ImmOrOwnedMoveObject": {
"type": "array",
"items": [
{
"$ref": "#/components/schemas/ObjectID"
},
{
"$ref": "#/components/schemas/SequenceNumber"
},
{
"$ref": "#/components/schemas/ObjectDigest"
}
],
"maxItems": 3,
"minItems": 3
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"SharedMoveObject"
],
"properties": {
"SharedMoveObject": {
"$ref": "#/components/schemas/ObjectID"
}
},
"additionalProperties": false
}
]
},
"MergeCoinResponse": {
"type": "object",
"required": [
Expand Down Expand Up @@ -1602,9 +1650,33 @@
"TransactionBytes": {
"type": "object",
"required": [
"gas",
"input_objects",
"tx_bytes"
],
"properties": {
"gas": {
"type": "array",
"items": [
{
"$ref": "#/components/schemas/ObjectID"
},
{
"$ref": "#/components/schemas/SequenceNumber"
},
{
"$ref": "#/components/schemas/ObjectDigest"
}
],
"maxItems": 3,
"minItems": 3
},
"input_objects": {
"type": "array",
"items": {
"$ref": "#/components/schemas/InputObjectKind"
}
},
"tx_bytes": {
"$ref": "#/components/schemas/Base64"
}
Expand Down
Loading

0 comments on commit 0a315ed

Please sign in to comment.