@gorbchain-xyz/chaindecode
Version:
GorbchainSDK V1.3+ - Complete Solana development toolkit with advanced cryptography, messaging, and collaboration features. Build secure applications with blockchain, DeFi, and end-to-end encryption.
52 lines (51 loc) • 2.52 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
/**
* Send a transaction to the network
*/
export function sendTransaction(client, transaction, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
return client.request('sendTransaction', [
transaction,
{
skipPreflight: (_a = options === null || options === void 0 ? void 0 : options.skipPreflight) !== null && _a !== void 0 ? _a : false,
preflightCommitment: (_b = options === null || options === void 0 ? void 0 : options.preflightCommitment) !== null && _b !== void 0 ? _b : 'finalized',
encoding: (_c = options === null || options === void 0 ? void 0 : options.encoding) !== null && _c !== void 0 ? _c : 'base64'
}
]);
});
}
/**
* Get transaction details by signature
*/
export function getTransaction(client, signature, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b;
return client.request('getTransaction', [
signature,
{
encoding: (options === null || options === void 0 ? void 0 : options.encoding) || 'json',
commitment: (_a = options === null || options === void 0 ? void 0 : options.commitment) !== null && _a !== void 0 ? _a : 'finalized',
maxSupportedTransactionVersion: (_b = options === null || options === void 0 ? void 0 : options.maxSupportedTransactionVersion) !== null && _b !== void 0 ? _b : 0
}
]);
});
}
/**
* Get signature status
*/
export function getSignatureStatus(client, signature) {
return __awaiter(this, void 0, void 0, function* () {
const result = yield client.request('getSignatureStatuses', [[signature]]);
return result.value[0];
});
}
export * from './fetchTransactionBySignature.js';