File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -1061,6 +1061,45 @@ export class ChainRpc {
10611061 } ) ;
10621062 }
10631063
1064+ /**
1065+ * Gets the minimum transaction fee of the given transaction type in the given block.
1066+ * @param transactionType
1067+ * @param blockNumber
1068+ * @returns The minimum transaction fee of the corresponding transactionType in the unit of CCC.
1069+ */
1070+ public getMinTransactionFee (
1071+ transactionType : string ,
1072+ blockNumber ?: number | null
1073+ ) : Promise < number | null > {
1074+ const fallbackServers = this . fallbackServers ;
1075+ if ( blockNumber !== undefined && ! isNonNegativeInterger ( blockNumber ) ) {
1076+ throw Error (
1077+ `Expected the second argument of getMinTransactionFee to be non-negative integer but found ${ blockNumber } `
1078+ ) ;
1079+ }
1080+
1081+ return new Promise ( ( resolve , reject ) => {
1082+ this . rpc
1083+ . sendRpcRequest (
1084+ "chain_getMinTransactionFee" ,
1085+ [ transactionType , blockNumber ] ,
1086+ { fallbackServers }
1087+ )
1088+ . then ( result => {
1089+ if ( result === null || typeof result === "number" ) {
1090+ resolve ( result ) ;
1091+ } else {
1092+ reject (
1093+ Error (
1094+ `Expected chain_getMinTransactionFee to return either null or a number but it returned ${ result } `
1095+ )
1096+ ) ;
1097+ }
1098+ } )
1099+ . catch ( reject ) ;
1100+ } ) ;
1101+ }
1102+
10641103 /**
10651104 * Gets the network ID of the node.
10661105 * @returns A network ID, e.g. "tc".
You can’t perform that action at this time.
0 commit comments