@saberhq/solana-contrib
Advanced tools
Comparing version 1.15.0 to 2.0.0
/// <reference types="node" /> | ||
import type { Blockhash, BlockhashWithExpiryBlockHeight, Commitment, ConfirmOptions, Connection, KeyedAccountInfo, PublicKey, RpcResponseAndContext, Signer, SimulatedTransactionResponse, Transaction } from "@solana/web3.js"; | ||
import { VersionedTransaction } from "@solana/web3.js"; | ||
import type { BroadcastOptions, PendingTransaction } from "./index.js"; | ||
export declare const isVersionedTransaction: (tx: Transaction | VersionedTransaction) => tx is VersionedTransaction; | ||
/** | ||
@@ -11,6 +13,10 @@ * Wallet interface for objects that can be used to sign provider transactions. | ||
/** | ||
* The PublicKey of the wallet. | ||
*/ | ||
publicKey: PublicKey; | ||
/** | ||
* Signs a transaction with the wallet. | ||
* @param tx | ||
*/ | ||
signTransaction(tx: Transaction): Promise<Transaction>; | ||
signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>; | ||
/** | ||
@@ -20,7 +26,3 @@ * Signs all transactions with the wallet. | ||
*/ | ||
signAllTransactions(txs: Transaction[]): Promise<Transaction[]>; | ||
/** | ||
* The PublicKey of the wallet. | ||
*/ | ||
publicKey: PublicKey; | ||
signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>; | ||
} | ||
@@ -27,0 +29,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isVersionedTransaction = void 0; | ||
const web3_js_1 = require("@solana/web3.js"); | ||
const isVersionedTransaction = (tx) => { | ||
return "version" in tx || tx instanceof web3_js_1.VersionedTransaction; | ||
}; | ||
exports.isVersionedTransaction = isVersionedTransaction; | ||
//# sourceMappingURL=interfaces.js.map |
@@ -1,3 +0,3 @@ | ||
import type { ConfirmOptions, Connection, PublicKey, Signer, Transaction } from "@solana/web3.js"; | ||
import type { Provider, Wallet } from "./interfaces.js"; | ||
import type { ConfirmOptions, Connection, PublicKey, Signer, Transaction, VersionedTransaction } from "@solana/web3.js"; | ||
import { type Provider, type Wallet } from "./interfaces.js"; | ||
/** | ||
@@ -10,4 +10,4 @@ * Wallet based on a Signer. | ||
get publicKey(): PublicKey; | ||
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>; | ||
signTransaction(transaction: Transaction): Promise<Transaction>; | ||
signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>; | ||
signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<T>; | ||
/** | ||
@@ -14,0 +14,0 @@ * Creates a Provider from this Wallet by adding a Connection. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SignerWallet = void 0; | ||
const interfaces_js_1 = require("./interfaces.js"); | ||
const provider_js_1 = require("./provider.js"); | ||
@@ -15,5 +16,10 @@ /** | ||
} | ||
signAllTransactions(transactions) { | ||
return Promise.resolve(transactions.map((tx) => { | ||
tx.partialSign(this.signer); | ||
signAllTransactions(txs) { | ||
return Promise.resolve(txs.map((tx) => { | ||
if ((0, interfaces_js_1.isVersionedTransaction)(tx)) { | ||
tx.sign([this.signer]); | ||
} | ||
else { | ||
tx.partialSign(this.signer); | ||
} | ||
return tx; | ||
@@ -23,3 +29,8 @@ })); | ||
signTransaction(transaction) { | ||
transaction.partialSign(this.signer); | ||
if ((0, interfaces_js_1.isVersionedTransaction)(transaction)) { | ||
transaction.sign([this.signer]); | ||
} | ||
else { | ||
transaction.partialSign(this.signer); | ||
} | ||
return Promise.resolve(transaction); | ||
@@ -26,0 +37,0 @@ } |
/// <reference types="node" /> | ||
import type { Blockhash, BlockhashWithExpiryBlockHeight, Commitment, ConfirmOptions, Connection, KeyedAccountInfo, PublicKey, RpcResponseAndContext, Signer, SimulatedTransactionResponse, Transaction } from "@solana/web3.js"; | ||
import { VersionedTransaction } from "@solana/web3.js"; | ||
import type { BroadcastOptions, PendingTransaction } from "./index.js"; | ||
export declare const isVersionedTransaction: (tx: Transaction | VersionedTransaction) => tx is VersionedTransaction; | ||
/** | ||
@@ -11,6 +13,10 @@ * Wallet interface for objects that can be used to sign provider transactions. | ||
/** | ||
* The PublicKey of the wallet. | ||
*/ | ||
publicKey: PublicKey; | ||
/** | ||
* Signs a transaction with the wallet. | ||
* @param tx | ||
*/ | ||
signTransaction(tx: Transaction): Promise<Transaction>; | ||
signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>; | ||
/** | ||
@@ -20,7 +26,3 @@ * Signs all transactions with the wallet. | ||
*/ | ||
signAllTransactions(txs: Transaction[]): Promise<Transaction[]>; | ||
/** | ||
* The PublicKey of the wallet. | ||
*/ | ||
publicKey: PublicKey; | ||
signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>; | ||
} | ||
@@ -27,0 +29,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isVersionedTransaction = void 0; | ||
const web3_js_1 = require("@solana/web3.js"); | ||
const isVersionedTransaction = (tx) => { | ||
return "version" in tx || tx instanceof web3_js_1.VersionedTransaction; | ||
}; | ||
exports.isVersionedTransaction = isVersionedTransaction; | ||
//# sourceMappingURL=interfaces.js.map |
@@ -1,3 +0,3 @@ | ||
import type { ConfirmOptions, Connection, PublicKey, Signer, Transaction } from "@solana/web3.js"; | ||
import type { Provider, Wallet } from "./interfaces.js"; | ||
import type { ConfirmOptions, Connection, PublicKey, Signer, Transaction, VersionedTransaction } from "@solana/web3.js"; | ||
import { type Provider, type Wallet } from "./interfaces.js"; | ||
/** | ||
@@ -10,4 +10,4 @@ * Wallet based on a Signer. | ||
get publicKey(): PublicKey; | ||
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>; | ||
signTransaction(transaction: Transaction): Promise<Transaction>; | ||
signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>; | ||
signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<T>; | ||
/** | ||
@@ -14,0 +14,0 @@ * Creates a Provider from this Wallet by adding a Connection. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SignerWallet = void 0; | ||
const interfaces_js_1 = require("./interfaces.js"); | ||
const provider_js_1 = require("./provider.js"); | ||
@@ -15,5 +16,10 @@ /** | ||
} | ||
signAllTransactions(transactions) { | ||
return Promise.resolve(transactions.map((tx) => { | ||
tx.partialSign(this.signer); | ||
signAllTransactions(txs) { | ||
return Promise.resolve(txs.map((tx) => { | ||
if ((0, interfaces_js_1.isVersionedTransaction)(tx)) { | ||
tx.sign([this.signer]); | ||
} | ||
else { | ||
tx.partialSign(this.signer); | ||
} | ||
return tx; | ||
@@ -23,3 +29,8 @@ })); | ||
signTransaction(transaction) { | ||
transaction.partialSign(this.signer); | ||
if ((0, interfaces_js_1.isVersionedTransaction)(transaction)) { | ||
transaction.sign([this.signer]); | ||
} | ||
else { | ||
transaction.partialSign(this.signer); | ||
} | ||
return Promise.resolve(transaction); | ||
@@ -26,0 +37,0 @@ } |
{ | ||
"name": "@saberhq/solana-contrib", | ||
"version": "1.15.0", | ||
"version": "2.0.0", | ||
"description": "Common types and libraries for Solana", | ||
@@ -29,3 +29,3 @@ "homepage": "https://github.com/saber-hq/saber-common/tree/master/packages/solana-contrib#readme", | ||
"dependencies": { | ||
"@saberhq/option-utils": "^1.15.0", | ||
"@saberhq/option-utils": "^2.0.0", | ||
"@solana/buffer-layout": "^4.0.0", | ||
@@ -40,4 +40,4 @@ "@types/promise-retry": "^1.1.6", | ||
"devDependencies": { | ||
"@saberhq/tsconfig": "^3.1.1", | ||
"@solana/web3.js": "^1.87.6", | ||
"@saberhq/tsconfig": "^3.2.1", | ||
"@solana/web3.js": "^1.91.1", | ||
"@types/bn.js": "^5.1.5", | ||
@@ -44,0 +44,0 @@ "@types/jest": "^29.5.10", |
@@ -14,5 +14,12 @@ import type { | ||
} from "@solana/web3.js"; | ||
import { VersionedTransaction } from "@solana/web3.js"; | ||
import type { BroadcastOptions, PendingTransaction } from "./index.js"; | ||
export const isVersionedTransaction = ( | ||
tx: Transaction | VersionedTransaction, | ||
): tx is VersionedTransaction => { | ||
return "version" in tx || tx instanceof VersionedTransaction; | ||
}; | ||
/** | ||
@@ -25,6 +32,13 @@ * Wallet interface for objects that can be used to sign provider transactions. | ||
/** | ||
* The PublicKey of the wallet. | ||
*/ | ||
publicKey: PublicKey; | ||
/** | ||
* Signs a transaction with the wallet. | ||
* @param tx | ||
*/ | ||
signTransaction(tx: Transaction): Promise<Transaction>; | ||
signTransaction<T extends Transaction | VersionedTransaction>( | ||
tx: T, | ||
): Promise<T>; | ||
@@ -35,8 +49,5 @@ /** | ||
*/ | ||
signAllTransactions(txs: Transaction[]): Promise<Transaction[]>; | ||
/** | ||
* The PublicKey of the wallet. | ||
*/ | ||
publicKey: PublicKey; | ||
signAllTransactions<T extends Transaction | VersionedTransaction>( | ||
txs: T[], | ||
): Promise<T[]>; | ||
} | ||
@@ -43,0 +54,0 @@ |
@@ -1,2 +0,2 @@ | ||
// import { Provider as AnchorProvider } from "@project-serum/anchor"; | ||
// import { Provider as AnchorProvider } from "@coral-xyz/anchor"; | ||
import type { AccountInfo, Connection } from "@solana/web3.js"; | ||
@@ -216,3 +216,3 @@ import { PublicKey } from "@solana/web3.js"; | ||
connection, | ||
base58ToLookup | ||
base58ToLookup, | ||
); | ||
@@ -222,3 +222,3 @@ | ||
const lookupIndex = base58ToLookup.findIndex( | ||
(p) => p.toBase58() === base58 | ||
(p) => p.toBase58() === base58, | ||
); | ||
@@ -225,0 +225,0 @@ if (lookupIndex >= 0) { |
@@ -7,5 +7,10 @@ import type { | ||
Transaction, | ||
VersionedTransaction, | ||
} from "@solana/web3.js"; | ||
import type { Provider, Wallet } from "./interfaces.js"; | ||
import { | ||
isVersionedTransaction, | ||
type Provider, | ||
type Wallet, | ||
} from "./interfaces.js"; | ||
import { SolanaProvider } from "./provider.js"; | ||
@@ -23,6 +28,12 @@ | ||
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]> { | ||
signAllTransactions<T extends Transaction | VersionedTransaction>( | ||
txs: T[], | ||
): Promise<T[]> { | ||
return Promise.resolve( | ||
transactions.map((tx) => { | ||
tx.partialSign(this.signer); | ||
txs.map((tx) => { | ||
if (isVersionedTransaction(tx)) { | ||
tx.sign([this.signer]); | ||
} else { | ||
tx.partialSign(this.signer); | ||
} | ||
return tx; | ||
@@ -33,4 +44,10 @@ }), | ||
signTransaction(transaction: Transaction): Promise<Transaction> { | ||
transaction.partialSign(this.signer); | ||
signTransaction<T extends Transaction | VersionedTransaction>( | ||
transaction: T, | ||
): Promise<T> { | ||
if (isVersionedTransaction(transaction)) { | ||
transaction.sign([this.signer]); | ||
} else { | ||
transaction.partialSign(this.signer); | ||
} | ||
return Promise.resolve(transaction); | ||
@@ -37,0 +54,0 @@ } |
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
881927
11398
- Removed@saberhq/option-utils@1.15.0(transitive)
Updated@saberhq/option-utils@^2.0.0