Skip to content
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

feat: add pendingTransactions support #3055

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
23 changes: 17 additions & 6 deletions test/suites/smoke/test-historic-compatibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describeSuite({
if (skipTest.skip) {
log(
"No test data available for " +
`${skipTest.networkName} #${skipTest.chainId} , skipping test.`
`${skipTest.networkName} #${skipTest.chainId} , skipping test.`
);
return; // TODO: replace this with this.skip() when added to vitest
}
Expand All @@ -77,7 +77,7 @@ describeSuite({
if (a.error === true) {
log(
`Failure tracing in runtime ${a.runtime}, blocknumber ${a.blockNumber} ` +
`: ${a.result}`
`: ${a.result}`
);
return true;
}
Expand All @@ -94,8 +94,8 @@ describeSuite({
if (skipTest.skip) {
log(
"No test data available for " +
`${skipTest.networkName} #${skipTest.chainId}` +
" , skipping test."
`${skipTest.networkName} #${skipTest.chainId}` +
" , skipping test."
);
return; // TODO: replace this with this.skip() when added to vitest
}
Expand All @@ -121,7 +121,7 @@ describeSuite({
if (a.error === true) {
log(
`Failure fetching txn receipt on runtime ${a.runtime}, blocknumber ${a.blockNumber}` +
` and result: ${JSON.stringify(a.result)}`
` and result: ${JSON.stringify(a.result)}`
);
return true;
}
Expand All @@ -142,6 +142,17 @@ describeSuite({
},
});

it({
id: "C350",
title: "can call eth_pendingTransactions",
test: async function () {
const result = await (context.ethers().provider as ethers.JsonRpcProvider).send(
"eth_pendingTransactions",
[]
);
},
});

it({
id: "C400",
title: "can call eth_syncing",
Expand Down Expand Up @@ -261,7 +272,7 @@ describeSuite({
if (skipTest.skip) {
log(
"No test data available for" +
`${skipTest.networkName} #${skipTest.chainId} , skipping test.`
`${skipTest.networkName} #${skipTest.chainId} , skipping test.`
);
return; // TODO: replace this with this.skip() when added to vitest
}
Expand Down
20 changes: 12 additions & 8 deletions tools/generate-rpc-types.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
export declare type DefinitionTypeType = string;
export declare type DefinitionTypeEnum =
| {
_enum: DefinitionTypeType[];
}
_enum: DefinitionTypeType[];
}
| {
_enum: Record<string, DefinitionTypeType | null>;
};
_enum: Record<string, DefinitionTypeType | null>;
};
export declare type DefinitionTypeSet = {
_set: Record<string, number>;
};
export declare type DefinitionTypeStruct =
| Record<string, DefinitionTypeType>
| ({
_alias?: Record<string, DefinitionTypeType>;
} & Record<string, unknown>);
_alias?: Record<string, DefinitionTypeType>;
} & Record<string, unknown>);
export declare type DefinitionType =
| string
| DefinitionTypeEnum
Expand Down Expand Up @@ -64,7 +64,7 @@ export default function rpcTypes(): Record<string, Record<string, DefinitionRpc>
]),
chainId: generateDescription(
"Returns the chain ID used for transaction signing at " +
"the current best block. None is returned if not available.",
"the current best block. None is returned if not available.",
"U64"
),
coinbase: generateDescription("Returns block author.", "H160"),
Expand Down Expand Up @@ -154,7 +154,7 @@ export default function rpcTypes(): Record<string, Record<string, DefinitionRpc>
),
getWork: generateDescription(
"Returns the hash of the current block, the seedHash," +
" and the boundary condition to be met.",
" and the boundary condition to be met.",
"Work"
),
hashrate: generateDescription(
Expand All @@ -166,6 +166,10 @@ export default function rpcTypes(): Record<string, Record<string, DefinitionRpc>
"Returns protocol version encoded as a string (quotes are necessary).",
"u64"
),
pendingTransactions: generateDescription(
"Returns a list of pending transactions.",
"Vec<Transaction>"
),
sendRawTransaction: generateDescription(
"Sends signed transaction, returning its hash.",
"BoxFuture<H256>",
Expand Down
64 changes: 33 additions & 31 deletions typescript-api/src/moonbase/interfaces/augment-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ declare module "@polkadot/rpc-core/types/jsonrpc" {
callRequest:
| ContractCallRequest
| {
origin?: any;
dest?: any;
value?: any;
gasLimit?: any;
storageDepositLimit?: any;
inputData?: any;
}
origin?: any;
dest?: any;
value?: any;
gasLimit?: any;
storageDepositLimit?: any;
inputData?: any;
}
| string
| Uint8Array,
at?: BlockHash | string | Uint8Array
Expand Down Expand Up @@ -323,14 +323,14 @@ declare module "@polkadot/rpc-core/types/jsonrpc" {
request:
| EthCallRequest
| {
from?: any;
to?: any;
gasPrice?: any;
gas?: any;
value?: any;
data?: any;
nonce?: any;
}
from?: any;
to?: any;
gasPrice?: any;
gas?: any;
value?: any;
data?: any;
nonce?: any;
}
| string
| Uint8Array,
number?: BlockNumber | AnyNumber | Uint8Array
Expand All @@ -349,14 +349,14 @@ declare module "@polkadot/rpc-core/types/jsonrpc" {
request:
| EthCallRequest
| {
from?: any;
to?: any;
gasPrice?: any;
gas?: any;
value?: any;
data?: any;
nonce?: any;
}
from?: any;
to?: any;
gasPrice?: any;
gas?: any;
value?: any;
data?: any;
nonce?: any;
}
| string
| Uint8Array,
number?: BlockNumber | AnyNumber | Uint8Array
Expand Down Expand Up @@ -517,6 +517,8 @@ declare module "@polkadot/rpc-core/types/jsonrpc" {
newPendingTransactionFilter: AugmentedRpc<() => Observable<U256>>;
/** Returns protocol version encoded as a string (quotes are necessary). */
protocolVersion: AugmentedRpc<() => Observable<u64>>;
/** Returns a list of pending transactions. */
pendingTransactions: AugmentedRpc<() => Observable<Vec<EthTransaction>>>;
/** Sends signed transaction, returning its hash. */
sendRawTransaction: AugmentedRpc<(bytes: Bytes | string | Uint8Array) => Observable<H256>>;
/** Sends transaction; will block waiting for signer to return the transaction hash */
Expand All @@ -525,14 +527,14 @@ declare module "@polkadot/rpc-core/types/jsonrpc" {
tx:
| EthTransactionRequest
| {
from?: any;
to?: any;
gasPrice?: any;
gas?: any;
value?: any;
data?: any;
nonce?: any;
}
from?: any;
to?: any;
gasPrice?: any;
gas?: any;
value?: any;
data?: any;
nonce?: any;
}
| string
| Uint8Array
) => Observable<H256>
Expand Down
64 changes: 33 additions & 31 deletions typescript-api/src/moonbeam/interfaces/augment-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ declare module "@polkadot/rpc-core/types/jsonrpc" {
callRequest:
| ContractCallRequest
| {
origin?: any;
dest?: any;
value?: any;
gasLimit?: any;
storageDepositLimit?: any;
inputData?: any;
}
origin?: any;
dest?: any;
value?: any;
gasLimit?: any;
storageDepositLimit?: any;
inputData?: any;
}
| string
| Uint8Array,
at?: BlockHash | string | Uint8Array
Expand Down Expand Up @@ -323,14 +323,14 @@ declare module "@polkadot/rpc-core/types/jsonrpc" {
request:
| EthCallRequest
| {
from?: any;
to?: any;
gasPrice?: any;
gas?: any;
value?: any;
data?: any;
nonce?: any;
}
from?: any;
to?: any;
gasPrice?: any;
gas?: any;
value?: any;
data?: any;
nonce?: any;
}
| string
| Uint8Array,
number?: BlockNumber | AnyNumber | Uint8Array
Expand All @@ -349,14 +349,14 @@ declare module "@polkadot/rpc-core/types/jsonrpc" {
request:
| EthCallRequest
| {
from?: any;
to?: any;
gasPrice?: any;
gas?: any;
value?: any;
data?: any;
nonce?: any;
}
from?: any;
to?: any;
gasPrice?: any;
gas?: any;
value?: any;
data?: any;
nonce?: any;
}
| string
| Uint8Array,
number?: BlockNumber | AnyNumber | Uint8Array
Expand Down Expand Up @@ -518,21 +518,23 @@ declare module "@polkadot/rpc-core/types/jsonrpc" {
/** Returns protocol version encoded as a string (quotes are necessary). */
protocolVersion: AugmentedRpc<() => Observable<u64>>;
/** Sends signed transaction, returning its hash. */
/** Returns a list of pending transactions. */
pendingTransactions: AugmentedRpc<() => Observable<Vec<EthTransaction>>>;
sendRawTransaction: AugmentedRpc<(bytes: Bytes | string | Uint8Array) => Observable<H256>>;
/** Sends transaction; will block waiting for signer to return the transaction hash */
sendTransaction: AugmentedRpc<
(
tx:
| EthTransactionRequest
| {
from?: any;
to?: any;
gasPrice?: any;
gas?: any;
value?: any;
data?: any;
nonce?: any;
}
from?: any;
to?: any;
gasPrice?: any;
gas?: any;
value?: any;
data?: any;
nonce?: any;
}
| string
| Uint8Array
) => Observable<H256>
Expand Down
Loading