@saberhq/chai-solana
Advanced tools
Comparing version 1.12.26 to 1.12.27
@@ -0,1 +1,2 @@ | ||
import type { IdlErrorCode } from "@project-serum/anchor/dist/cjs/idl"; | ||
import type { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
@@ -38,2 +39,16 @@ /** | ||
}) => Chai.PromisedAssertion; | ||
/** | ||
* Assert that a transaction is successful. | ||
* @param tx | ||
* @param msg | ||
* @returns | ||
*/ | ||
export declare const assertTXSuccess: (tx: TransactionEnvelope, msg?: string | undefined) => Chai.PromisedAssertion; | ||
/** | ||
* Assert that a transaction will throw the given error. | ||
* @param tx | ||
* @param msg | ||
* @returns | ||
*/ | ||
export declare const assertTXThrows: (tx: TransactionEnvelope, err: IdlErrorCode, msg?: string | undefined) => Chai.PromisedAssertion; | ||
//# sourceMappingURL=expectTXTable.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.expectTXTable = void 0; | ||
exports.assertTXThrows = exports.assertTXSuccess = exports.expectTXTable = void 0; | ||
const anchor_contrib_1 = require("@saberhq/anchor-contrib"); | ||
const solana_contrib_1 = require("@saberhq/solana-contrib"); | ||
@@ -104,2 +105,24 @@ const printInstructionLogs_1 = require("./printInstructionLogs"); | ||
exports.expectTXTable = expectTXTable; | ||
/** | ||
* Assert that a transaction is successful. | ||
* @param tx | ||
* @param msg | ||
* @returns | ||
*/ | ||
const assertTXSuccess = (tx, msg) => { | ||
return (0, exports.expectTXTable)(tx, msg, { | ||
verbosity: "error", | ||
}).to.be.fulfilled; | ||
}; | ||
exports.assertTXSuccess = assertTXSuccess; | ||
/** | ||
* Assert that a transaction will throw the given error. | ||
* @param tx | ||
* @param msg | ||
* @returns | ||
*/ | ||
const assertTXThrows = (tx, err, msg) => { | ||
return (0, exports.expectTXTable)(tx, msg).to.be.rejectedWith((0, anchor_contrib_1.matchError)(err)); | ||
}; | ||
exports.assertTXThrows = assertTXThrows; | ||
//# sourceMappingURL=expectTXTable.js.map |
@@ -0,1 +1,2 @@ | ||
import type { IdlErrorCode } from "@project-serum/anchor/dist/cjs/idl"; | ||
import type { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
@@ -38,2 +39,16 @@ /** | ||
}) => Chai.PromisedAssertion; | ||
/** | ||
* Assert that a transaction is successful. | ||
* @param tx | ||
* @param msg | ||
* @returns | ||
*/ | ||
export declare const assertTXSuccess: (tx: TransactionEnvelope, msg?: string | undefined) => Chai.PromisedAssertion; | ||
/** | ||
* Assert that a transaction will throw the given error. | ||
* @param tx | ||
* @param msg | ||
* @returns | ||
*/ | ||
export declare const assertTXThrows: (tx: TransactionEnvelope, err: IdlErrorCode, msg?: string | undefined) => Chai.PromisedAssertion; | ||
//# sourceMappingURL=expectTXTable.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import { matchError } from "@saberhq/anchor-contrib"; | ||
import { parseTransactionLogs, printTXTable } from "@saberhq/solana-contrib"; | ||
@@ -100,2 +101,22 @@ import { formatInstructionLogsForConsole } from "./printInstructionLogs"; | ||
}; | ||
/** | ||
* Assert that a transaction is successful. | ||
* @param tx | ||
* @param msg | ||
* @returns | ||
*/ | ||
export const assertTXSuccess = (tx, msg) => { | ||
return expectTXTable(tx, msg, { | ||
verbosity: "error", | ||
}).to.be.fulfilled; | ||
}; | ||
/** | ||
* Assert that a transaction will throw the given error. | ||
* @param tx | ||
* @param msg | ||
* @returns | ||
*/ | ||
export const assertTXThrows = (tx, err, msg) => { | ||
return expectTXTable(tx, msg).to.be.rejectedWith(matchError(err)); | ||
}; | ||
//# sourceMappingURL=expectTXTable.js.map |
{ | ||
"name": "@saberhq/chai-solana", | ||
"version": "1.12.26", | ||
"version": "1.12.27", | ||
"description": "Solana Chai helpers", | ||
@@ -27,2 +27,5 @@ "author": "Ian Macalinao <ian@saber.so>", | ||
"dependencies": { | ||
"@saberhq/anchor-contrib": "^1.12.27", | ||
"@saberhq/solana-contrib": "^1.12.27", | ||
"@saberhq/token-utils": "^1.12.27", | ||
"@types/chai": "^4.3.0", | ||
@@ -37,3 +40,3 @@ "@types/chai-as-promised": "^7.1.4", | ||
}, | ||
"gitHead": "a7a655ae330e203e61926529abf6d83f128e0885", | ||
"gitHead": "21de76f1691a2b2f35bb7dec4ae049031e459fce", | ||
"publishConfig": { | ||
@@ -44,4 +47,2 @@ "access": "public" | ||
"@project-serum/anchor": "^0.17 || ^0.18 || ^0.19", | ||
"@saberhq/solana-contrib": "^1.3.17", | ||
"@saberhq/token-utils": "^1.3.17", | ||
"@solana/web3.js": "^1.29.2", | ||
@@ -53,4 +54,2 @@ "bn.js": "^5.2.0", | ||
"@project-serum/anchor": "^0.20.1", | ||
"@saberhq/solana-contrib": "^1.12.26", | ||
"@saberhq/token-utils": "^1.12.26", | ||
"@solana/web3.js": "^1.31.0", | ||
@@ -57,0 +56,0 @@ "bn.js": "^5.2.0", |
@@ -0,1 +1,3 @@ | ||
import type { IdlErrorCode } from "@project-serum/anchor/dist/cjs/idl"; | ||
import { matchError } from "@saberhq/anchor-contrib"; | ||
import type { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
@@ -138,1 +140,30 @@ import { parseTransactionLogs, printTXTable } from "@saberhq/solana-contrib"; | ||
}; | ||
/** | ||
* Assert that a transaction is successful. | ||
* @param tx | ||
* @param msg | ||
* @returns | ||
*/ | ||
export const assertTXSuccess = ( | ||
tx: TransactionEnvelope, | ||
msg?: string | ||
): Chai.PromisedAssertion => { | ||
return expectTXTable(tx, msg, { | ||
verbosity: "error", | ||
}).to.be.fulfilled; | ||
}; | ||
/** | ||
* Assert that a transaction will throw the given error. | ||
* @param tx | ||
* @param msg | ||
* @returns | ||
*/ | ||
export const assertTXThrows = ( | ||
tx: TransactionEnvelope, | ||
err: IdlErrorCode, | ||
msg?: string | ||
): Chai.PromisedAssertion => { | ||
return expectTXTable(tx, msg).to.be.rejectedWith(matchError(err)); | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
135701
4
1400
15
+ Added@project-serum/anchor@0.24.2(transitive)
+ Added@saberhq/anchor-contrib@1.15.0(transitive)
+ Addedcross-fetch@3.2.0(transitive)
+ Addedlodash.camelcase@4.3.0(transitive)
+ Addedlodash.mapvalues@4.6.0(transitive)