Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Update WaaS implementation docs (#137)
Browse files Browse the repository at this point in the history
* Add additional clarification notes to WaaS implementation docs from where I had issues. Re-organize example payload JSONs such that they are in alphabetical order.

* Fix alphabetical ordering for transactions
  • Loading branch information
BellringerQuinn authored Nov 21, 2023
1 parent 8173e43 commit 86f8aad
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 44 deletions.
90 changes: 47 additions & 43 deletions docs/10-waas/03-implementation/01-payloads.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,35 @@ The payload structure is as follows:
| Name | Type | Description | Optional |
| --- | --- | --- | --- |
| version | string | The version of the SDK that generated the payload | No |
| packet | object | Contents, defined by each payload type | No |
| * packet | object | Contents, defined by each payload type | No |
| signatures | signature[] | Payload signatures by existing sessions | Yes |
| packet.code | string | Identifier of the payload type | No |
| packet.issued | number | Timestamp of when the payload was issued, in seconds | No |
| packet.expires | number | Timestamp of when the payload will expire, in seconds | No |

\* packet must be organized such that its fields (in JSON structure) appear alphabetically by name.

> The wallet is optional when openning a new session
#### signature type

| Name | Type | Description | Optional |
| --- | --- | --- | --- |
| session | string | Identifier of the signing session | No |
| signature | string | Signature of the session for the given payload | No |
| * signature | string | Signature of the session for the given payload | No |

\* signature should be an EIP-191 signature. See https://eips.ethereum.org/EIPS/eip-191

```json
{
"version": "1.0.0",
"packet": {
"code": "signMessage",
"issued": 1600000000,
"expires": 1600086400,
"wallet": "0xBc5F07A5852fdF3DBd57A76835109220D0ADd8E8",
"message": "Join game: #284892"
"issued": 1600000000,
"message": "Join game: #284892",
"network": "137",
"wallet": "0xBc5F07A5852fdF3DBd57A76835109220D0ADd8E8"
},
"signatures": [{
"session": "0xCF67BCbD9D5DFD373b03f4fc8143e1c6744B5696",
Expand Down Expand Up @@ -75,13 +79,13 @@ The `wallet` parameter is optional *ONLY* for this payload. If passed it will en
"version": "1.0.0",
"packet": {
"code": "openSession",
"issued": 1600000000,
"expires": 1600086400,
"session": "0xCF67BCbD9D5DFD373b03f4fc8143e1c6744B5696",
"issued": 1600000000,
"proof": {
"idToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwOi8vbXktZG9tYWluLmF1dGgwLmNvbSIsInN1YiI6ImF1dGgwfDEyMzQ1NiIsImF1ZCI6IjEyMzRhYmNkZWYiLCJleHAiOjEzMTEyODE5NzAsImlhdCI6MTMxMTI4MDk3MCwibmFtZSI6IkphbmUgRG9lIiwiZ2l2ZW5fbmFtZSI6IkphbmUiLCJmYW1pbHlfbmFtZSI6IkRvZSJ9.bql-jxlG9B_bielkqOnjTY9Di9FillFb6IMQINXoYsw",
"email": "[email protected]"
}
},
"session": "0xCF67BCbD9D5DFD373b03f4fc8143e1c6744B5696"
}
}
```
Expand All @@ -103,11 +107,11 @@ This payload is generated when `signMessage` is called on the SDK.
"version": "1.0.0",
"packet": {
"code": "signMessage",
"issued": 1600000000,
"expires": 1600086400,
"wallet": "0xBc5F07A5852fdF3DBd57A76835109220D0ADd8E8",
"network": "1",
"issued": 1600000000,
"message": "Join game: #284892"
"network": "1",
"wallet": "0xBc5F07A5852fdF3DBd57A76835109220D0ADd8E8",
},
"signatures": [{
"session": "0xCF67BCbD9D5DFD373b03f4fc8143e1c6744B5696",
Expand All @@ -126,7 +130,7 @@ This payload is generated when `sendTransaction` is called on the SDK.
| identifier | string | Unique identifier for the transaction | No |
| wallet | string | Address of the wallet. | No |
| network | string | Network on which to send the transactions. | No |
| transactions | (transaction \| erc20send \| erc721send \| erc1155send)[] | Array of transaction objects. | No |
| transactions | (transaction \| erc20send \| erc721send \| erc1155send \| delayedEncode)[] | Array of transaction objects. | No |

#### Raw transaction

Expand Down Expand Up @@ -194,68 +198,68 @@ Hope this helps!
"version": "1.0.0",
"packet": {
"code": "sendTransaction",
"issued": 1600000000,
"expires": 1600086400,
"identifier": "tx-id1-1600000000",
"wallet": "0xBc5F07A5852fdF3DBd57A76835109220D0ADd8E8",
"issued": 1600000000,
"network": "137",
"transactions": [
{
"type": "transaction",
"data": "0x3251ba32",
"to": "0x479F6a5b0C1728947318714963a583C56A78366A",
"value": "39381",
"data": "0x3251ba32"
"type": "transaction",
"value": "39381"
},
{
"type": "erc20send",
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"to": "0x7b1Bd3474D789e18e2E329E2c53F819B6E687b4A",
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"type": "erc20send",
"value": "1000"
},
{
"type": "erc721send",
"token": "0xF87E31492Faf9A91B02Ee0dEAAd50d51d56D5d4d",
"to": "0x17fFA2d95b58228e1ECb0C6Ac25A6EfD20BA08E4",
"data": "0x112233",
"id": "7",
"safe": true,
"data": "0x112233"
"to": "0x17fFA2d95b58228e1ECb0C6Ac25A6EfD20BA08E4",
"token": "0xF87E31492Faf9A91B02Ee0dEAAd50d51d56D5d4d",
"type": "erc721send"
},
{
"type": "erc1155send",
"token": "0x631998e91476da5b870d741192fc5cbc55f5a52e",
"data": "0x223344",
"to": "0x91E8aC543C5fEDf9F3Ef8b9dA1500dB84305681F",
"token": "0x631998e91476da5b870d741192fc5cbc55f5a52e",
"type": "erc1155send",
"vals": [{
"id": "2",
"amount": "5"
"amount": "5",
"id": "2"
}, {
"id": "500",
"amount": "1"
}],
"data": "0x223344"
"amount": "1",
"id": "500"
}]
},
{
"type": "delayedEncode",
"to": "0x140d72763D1ce39Ad4E2e73EC6e8FC53E5b73B64",
"value": "0",
"data": {
"abi": "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_orderId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_maxCost\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_fees\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"fillOrKillOrder\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"otherMethods\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
"func": "fillOrKillOrder",
"args": [
"0x6bd55a2877890bd58871eefe886770a7734077a74981910a75d7b1f044b5bf28",
"1000000000000000000",
"[\"0x095aE61E8207C7856eA273235D6BAdb69d815F5e\", \"0xC9D9B33231d24dd8cC53fDD64F7ABdd156f2a7E2\"]",
{
"abi": "notExpired(uint256,string)",
"func": "notExpired",
"args": [
"1600000000",
"Nov 1st, 2020"
]
],
"func": "notExpired"
}
]
}
],
"func": "fillOrKillOrder"
},
"to": "0x140d72763D1ce39Ad4E2e73EC6e8FC53E5b73B64",
"type": "delayedEncode",
"value": "0"
}
]
],
"wallet": "0xBc5F07A5852fdF3DBd57A76835109220D0ADd8E8"
},
"signatures": [{
"session": "0xCF67BCbD9D5DFD373b03f4fc8143e1c6744B5696",
Expand All @@ -279,10 +283,10 @@ This payload is generated when the client requests clossing a given session. Not
"version": "1.0.0",
"packet": {
"code": "closeSession",
"issued": 1600000000,
"expires": 1600086400,
"wallet": "0xBc5F07A5852fdF3DBd57A76835109220D0ADd8E8",
"session": "0xCF67BCbD9D5DFD373b03f4fc8143e1c6744B5696"
"issued": 1600000000,
"session": "0xCF67BCbD9D5DFD373b03f4fc8143e1c6744B5696",
"wallet": "0xBc5F07A5852fdF3DBd57A76835109220D0ADd8E8"
},
"signatures": [{
"session": "0xCF67BCbD9D5DFD373b03f4fc8143e1c6744B5696",
Expand Down
2 changes: 1 addition & 1 deletion docs/10-waas/03-implementation/02-responses.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The `data` field contains:
|----------------|-------------------|------------------------------------------------------|----------|
| txHash | string | Transaction hash of the Ethereum transaction | No |
| metaTxHash | string | Hash of the meta transaction | No |
| request | TransactionsPacket| The original request packet of the transaction | No |
| request | [SendTransactionPayload](https://docs.sequence.xyz/waas/implementation/payloads/#send-transaction-payload)| The original request packet of the transaction | No |
| receipt | MetaTxnReceipt | Receipt of the meta transaction | No |
| nativeReceipt | any | Native receipt of the Ethereum transaction | Yes |
| simulations | SimulateResult[] | Array of simulation results | Yes |
Expand Down

0 comments on commit 86f8aad

Please sign in to comment.