Skip to content

EIP-5792: wallet abstract transaction send api #317

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 12 additions & 23 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,18 @@ import { dereferenceDocument } from "@open-rpc/schema-utils-js";
console.log("Loading files...\n");

let methods = [];
let methodsBase = "src/eth/";
let methodFiles = fs.readdirSync(methodsBase);
methodFiles.forEach(file => {
console.log(file);
let raw = fs.readFileSync(methodsBase + file);
let parsed = yaml.load(raw);
methods = [
...methods,
...parsed,
];
});

methodsBase = "src/debug/";
methodFiles = fs.readdirSync(methodsBase);
methodFiles.forEach(file => {
console.log(file);
let raw = fs.readFileSync(methodsBase + file);
let parsed = yaml.load(raw);
methods = [
...methods,
...parsed,
];
});
for (const methodsBase of ['src/eth/', 'src/wallet/', 'src/debug/']) {
let methodFiles = fs.readdirSync(methodsBase);
methodFiles.forEach(file => {
console.log(file);
let raw = fs.readFileSync(methodsBase + file);
let parsed = yaml.load(raw);
methods = [
...methods,
...parsed,
];
});
}

let schemas = {};
let schemasBase = "src/schemas/"
Expand Down
69 changes: 69 additions & 0 deletions src/wallet/getBundleStatus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
- name: wallet_getBundleStatus
summary: Sends a bundle of function calls from the user wallet
params:
- name: Bundle identifier
required: true
schema:
type: string
title: Bundle identifier
result:
name: Call status
schema:
type: object
properties:
calls:
type: array
items:
title: call status
description: Status of the call at the given index
type: object
status:
title: The current status of the call
enum:
- CONFIRMED
- PENDING
receipt:
type: object
required:
- success
- blockHash
- blockNumber
- blockTimestamp
- gasUsed
- transactionHash
properties:
logs:
type: array
items:
title: Log object
type: object
properties:
address:
$ref: '#/components/schemas/address'
data:
title: data
$ref: '#/components/schemas/bytes'
topics:
title: topics
type: array
items:
$ref: '#/components/schemas/bytes32'
success:
type: boolean
title: Whether the call succeeded
blockHash:
title: The hash of the block in which the call was included
$ref: '#/components/schemas/bytes32'
blockNumber:
title: The number of the block in which the call was included
$ref: '#/components/schemas/uint'
blockTimestamp:
title: The timestamp of the block in which the call was included
$ref: '#/components/schemas/uint'
gasUsed:
title: How much gas the call actually used
$ref: '#/components/schemas/uint'
transactionHash:
title: The hash of the transaction in which the call was made
$ref: '#/components/schemas/bytes32'

58 changes: 58 additions & 0 deletions src/wallet/sendFunctionCallBundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
- name: wallet_sendFunctionCallBundle
summary: Sends a bundle of function calls from the user wallet
params:
- name: Function calls
required: true
schema:
type: object
title: Send function call bundle request
required:
- chainId
- from
- calls
properties:
chainId:
title: chainId
description: Chain ID that these calls should be sent on
$ref: '#/components/schemas/uint'
from:
title: from address
description: The address from which the function calls should be sent
$ref: '#/components/schemas/address'
calls:
title: calls to make
description: The calls that the wallet should make from the user's address
type: array
minItems: 1
items:
title: function call
description: A single function call
type: object
required:
- gas
- data
to:
title: to address
description: The address that is being called
$ref: '#/components/schemas/address'
gas:
title: gas limit
description: The gas limit for this particular call
$ref: '#/components/schemas/uint'
value:
title: value
description: How much value to send with the call
$ref: '#/components/schemas/uint'
data:
title: data
description: The data to send with the function call
$ref: '#/components/schemas/bytes'
optional:
title: optional
description: Whether the call must succeed for subsequent calls to be made
type: boolean
result:
name: Bundle identifier
schema:
type: string
maxLength: 66
12 changes: 12 additions & 0 deletions src/wallet/showBundleStatus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- name: wallet_showBundleStatus
summary: Requests that the wallet show the status of the bundle with the given identifier
params:
- name: Bundle identifier
required: true
schema:
type: string
maxLength: 66
result:
name: Empty
schema:
type: "null"