diff --git a/packages/rpc/__tests__/ckb-rpc-helpers.js b/packages/rpc/__tests__/ckb-rpc-helpers.js index 85607d63..78797b8a 100644 --- a/packages/rpc/__tests__/ckb-rpc-helpers.js +++ b/packages/rpc/__tests__/ckb-rpc-helpers.js @@ -33,7 +33,7 @@ describe('ckb-rpc settings and helpers', () => { }) it('has 47 basic rpc', () => { - expect(Object.values(rpc)).toHaveLength(47) + expect(Object.values(rpc)).toHaveLength(48) }) it('set node url to http://test.localhost:8114', () => { diff --git a/packages/rpc/src/Base/index.ts b/packages/rpc/src/Base/index.ts index 4af67a2d..b5ca6bca 100644 --- a/packages/rpc/src/Base/index.ts +++ b/packages/rpc/src/Base/index.ts @@ -536,6 +536,11 @@ export interface Base { ) => Promise; getDeploymentsInfo: () => Promise; + + testTxPoolAccept: ( + tx: CKBComponents.RawTransaction, + outputsValidator?: CKBComponents.OutputsValidator + ) => Promise; } export class Base { diff --git a/packages/rpc/src/Base/pool.ts b/packages/rpc/src/Base/pool.ts index a5d9a336..caa8e2f1 100644 --- a/packages/rpc/src/Base/pool.ts +++ b/packages/rpc/src/Base/pool.ts @@ -27,4 +27,12 @@ export default { paramsFormatters: [], resultFormatters: resultFmts.toRawTxPool, }, + + testTxPoolAccept: { + method: "test_tx_pool_accept", + paramsFormatters: [ + paramsFmts.toRawTransaction, + paramsFmts.toOutputsValidator, + ], + }, }; diff --git a/packages/rpc/src/resultFormatter.ts b/packages/rpc/src/resultFormatter.ts index 5bde78d2..d89c583c 100644 --- a/packages/rpc/src/resultFormatter.ts +++ b/packages/rpc/src/resultFormatter.ts @@ -139,7 +139,10 @@ const toTip = (tip: RPC.Tip): CKBComponents.Tip => ({ function isBlockWithCycles(value: unknown): value is BlockWithCycles { return ( - !!value && typeof value === "object" && "block" in value && "cycles" in value + !!value && + typeof value === "object" && + "block" in value && + "cycles" in value ); } diff --git a/packages/rpc/src/types/api.ts b/packages/rpc/src/types/api.ts index 596cd89d..1e066e14 100644 --- a/packages/rpc/src/types/api.ts +++ b/packages/rpc/src/types/api.ts @@ -38,7 +38,7 @@ export namespace CKBComponents { Proposed = "proposed", Committed = "committed", } - + export type Cycle = string; export type ScriptHashType = api.HashType; export type DepType = "code" | "depGroup"; @@ -319,6 +319,12 @@ export namespace CKBComponents { } export type DeploymentPos = api.DeploymentPos; + + export interface EntryCompleted { + cycles: Cycle; + /// Cached tx fee + fee: Capacity; + } export type DeploymentState = api.DeploymentState; export type DeploymentInfo = api.DeploymentInfo; export type DeploymentsInfo = api.DeploymentsInfo; diff --git a/packages/rpc/src/types/rpc.ts b/packages/rpc/src/types/rpc.ts index a1913902..2074af2a 100644 --- a/packages/rpc/src/types/rpc.ts +++ b/packages/rpc/src/types/rpc.ts @@ -549,4 +549,9 @@ export namespace RPC { is_initial_block_download: boolean; alerts: Vec; } + + export interface EntryCompleted { + cycles: Cycles; + fee: Capacity; + } }