repo_name string | dataset string | owner string | lang string | func_name string | code string | docstring string | url string | sha string |
|---|---|---|---|---|---|---|---|---|
js-wallet-sdk | github_2023 | okx | typescript | BitField.decode | decode(b?: Uint8Array, offset?: number): unknown {
const word = this.container._packedGetValue();
const wordValue = fixBitwiseResult(word & this.wordMask);
const value = wordValue >>> this.start;
return value;
} | /** Store a value into the corresponding subsequence of the containing
* bit field. */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2162-L2167 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | BitField.encode | encode(value: unknown): void {
if ('number' !== typeof value
|| !Number.isInteger(value)
|| (value !== fixBitwiseResult(value & this.valueMask))) {
throw new TypeError(nameWithProperty('BitField.encode', this)
+ ' value must be integer not exceeding ' + this.v... | /** Store a value into the corresponding subsequence of the containing
* bit field.
*
* **NOTE** This is not a specialization of {@link
* Layout#encode|Layout.encode} and there is no return value. */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2174-L2185 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Boolean.decode | decode(b?: Uint8Array, offset?: number): boolean {
return !!super.decode(b, offset);
} | /** Override {@link BitField#decode|decode} for {@link Boolean|Boolean}.
*
* @returns {boolean} */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2213-L2215 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Boolean.encode | encode(value: number | boolean): void {
if ('boolean' === typeof value) {
// BitField requires integer values
value = +value;
}
super.encode(value);
} | /** @override */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2218-L2224 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Blob.getSpan | getSpan(b: Uint8Array, offset?: number): number {
let span = this.span;
if (0 > span) {
span = (this.length as ExternalLayout).decode(b, offset);
}
return span;
} | /** @override */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2266-L2272 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Blob.decode | decode(b: Uint8Array, offset = 0): Uint8Array {
let span = this.span;
if (0 > span) {
span = (this.length as ExternalLayout).decode(b, offset);
}
return uint8ArrayToBuffer(b).slice(offset, offset + span);
} | /** @override */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2275-L2281 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Blob.encode | encode(src: Uint8Array, b: Uint8Array, offset: number): number {
let span = this.length;
if (this.length instanceof ExternalLayout) {
span = src.length;
}
if (!(src instanceof Uint8Array && span === src.length)) {
throw new TypeError(nameWithProperty('Blob.encode'... | /** Implement {@link Layout#encode|encode} for {@link Blob}.
*
* **NOTE** If {@link Layout#count|count} is an instance of {@link
* ExternalLayout} then the length of `src` will be encoded as the
* count after `src` is encoded. */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2288-L2306 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | CString.getSpan | getSpan(b: Uint8Array, offset = 0): number {
checkUint8Array(b);
let idx = offset;
while ((idx < b.length) && (0 !== b[idx])) {
idx += 1;
}
return 1 + idx - offset;
} | /** @override */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2328-L2335 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | CString.decode | decode(b: Uint8Array, offset = 0): string {
const span = this.getSpan(b, offset);
return uint8ArrayToBuffer(b).slice(offset, offset + span - 1).toString('utf-8');
} | /** @override */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2338-L2341 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | CString.encode | encode(src: string, b: Uint8Array, offset = 0): number {
/* Must force this to a string, lest it be a number and the
* "utf8-encoding" below actually allocate a buffer of length
* src */
if ('string' !== typeof src) {
src = String(src);
}
const srcb = Buffer... | /** @override */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2344-L2360 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | UTF8.getSpan | getSpan(b: Uint8Array, offset = 0): number {
checkUint8Array(b);
return b.length - offset;
} | /** @override */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2409-L2412 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | UTF8.decode | decode(b: Uint8Array, offset = 0): string {
const span = this.getSpan(b, offset);
if ((0 <= this.maxSpan)
&& (this.maxSpan < span)) {
throw new RangeError('text length exceeds maxSpan');
}
return uint8ArrayToBuffer(b).slice(offset, offset + span).toString('utf-8')... | /** @override */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2415-L2422 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | UTF8.encode | encode(src: string | LayoutObject, b: Uint8Array, offset = 0): number {
/* Must force this to a string, lest it be a number and the
* "utf8-encoding" below actually allocate a buffer of length
* src */
if ('string' !== typeof src) {
src = String(src);
}
cons... | /** @override */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2425-L2443 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Constant.decode | decode(b?: Uint8Array, offset?: number): T {
return this.value;
} | /** @override */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2483-L2485 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Constant.encode | encode(src: T, b?: Uint8Array, offset?: number): number {
/* Constants take no space */
return 0;
} | /** @override */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/buffer-layout/layout.ts#L2488-L2491 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Keypair.constructor | constructor(keypair: Ed25519Keypair) {
this._keypair = keypair;
} | /**
* Create a new keypair instance.
* Generate random keypair if no {@link Ed25519Keypair} is provided.
*
* @param keypair ed25519 keypair
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/keypair.ts#L39-L41 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Keypair.fromSecretKey | static fromSecretKey(
secretKey: Uint8Array,
options?: {skipValidation?: boolean},
): Keypair {
if (!options || !options.skipValidation) {
const encoder = new TextEncoder();
const signData = encoder.encode('@solana/web3.js-validation-v1');
const signature = signUtil.ed25519.sign(signData... | /**
* Create a keypair from a raw secret key byte array.
*
* This method should only be used to recreate a keypair from a previously
* generated secret key. Generating keypairs from a random seed should be done
* with the {@link Keypair.fromSeed} method.
*
* @throws error if the provided secret key... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/keypair.ts#L55-L70 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Keypair.publicKey | get publicKey(): PublicKey {
return new PublicKey(this._keypair.publicKey);
} | /**
* The public key for this keypair
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/keypair.ts#L75-L77 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Keypair.secretKey | get secretKey(): Uint8Array {
return this._keypair.secretKey;
} | /**
* The raw secret key for this keypair
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/keypair.ts#L82-L84 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | NonceAccount.constructor | constructor(args: NonceAccountArgs) {
this.authorizedPubkey = args.authorizedPubkey;
this.nonce = args.nonce;
this.feeCalculator = args.feeCalculator;
} | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/nonce-account.ts#L65-L69 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | NonceAccount.fromAccountData | static fromAccountData(
buffer: Buffer | Uint8Array | Array<number>,
): NonceAccount {
const nonceAccount = NonceAccountLayout.decode(toBuffer(buffer), 0);
return new NonceAccount({
authorizedPubkey: new PublicKey(nonceAccount.authorizedPubkey),
nonce: new PublicKey(nonceAccount.nonce).toStrin... | /**
* Deserialize NonceAccount from the account data.
*
* @param buffer account data
* @return NonceAccount
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/nonce-account.ts#L77-L86 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.constructor | constructor(value: PublicKeyInitData) {
super({});
if (isPublicKeyData(value)) {
this._bn = value._bn;
} else {
if (typeof value === 'string') {
// assume base 58 encoding by default
const decoded = base.fromBase58(value);
if (decoded.length != PUBLIC_KEY_LENGTH) {
... | /**
* Create a new PublicKey object
* @param value ed25519 public key as buffer or base-58 encoded string
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L59-L79 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.unique | static unique(): PublicKey {
const key = new PublicKey(uniquePublicKeyCounter);
uniquePublicKeyCounter += 1;
return new PublicKey(key.toBuffer());
} | /**
* Returns a unique PublicKey for tests and benchmarks using a counter
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L84-L88 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.equals | equals(publicKey: PublicKey): boolean {
return this._bn.eq(publicKey._bn);
} | /**
* Checks if two publicKeys are equal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L99-L101 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.toBase58 | toBase58(): string {
return base.toBase58(this.toBytes());
} | /**
* Return the base-58 representation of the public key
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L106-L108 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.toBytes | toBytes(): Uint8Array {
const buf = this.toBuffer();
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
} | /**
* Return the byte array representation of the public key in big endian
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L117-L120 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.toBuffer | toBuffer(): Buffer {
const b = this._bn.toArrayLike(Buffer);
if (b.length === PUBLIC_KEY_LENGTH) {
return b;
}
const zeroPad = Buffer.alloc(32);
b.copy(zeroPad, 32 - b.length);
return zeroPad;
} | /**
* Return the Buffer representation of the public key in big endian
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L125-L134 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.toString | toString(): string {
return this.toBase58();
} | /**
* Return the base-58 representation of the public key
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L143-L145 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.createWithSeed | static async createWithSeed(
fromPublicKey: PublicKey,
seed: string,
programId: PublicKey,
): Promise<PublicKey> {
const buffer = Buffer.concat([
fromPublicKey.toBuffer(),
Buffer.from(seed),
programId.toBuffer(),
]);
const publicKeyBytes = base.sha256(buffer);
return new ... | /* eslint-disable require-await */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L153-L165 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.createProgramAddressSync | static createProgramAddressSync(
seeds: Array<Buffer | Uint8Array>,
programId: PublicKey,
): PublicKey {
let buffer = Buffer.alloc(0);
seeds.forEach(function (seed) {
if (seed.length > MAX_SEED_LENGTH) {
throw new TypeError(`Max seed length exceeded`);
}
buffer = Buffer.conca... | /* eslint-disable require-await */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L171-L192 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.createProgramAddress | static async createProgramAddress(
seeds: Array<Buffer | Uint8Array>,
programId: PublicKey,
): Promise<PublicKey> {
return this.createProgramAddressSync(seeds, programId);
} | /* eslint-disable require-await */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L201-L206 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.findProgramAddressSync | static findProgramAddressSync(
seeds: Array<Buffer | Uint8Array>,
programId: PublicKey,
): [PublicKey, number] {
let nonce = 255;
let address;
while (nonce != 0) {
try {
const seedsWithNonce = seeds.concat(Buffer.from([nonce]));
address = this.createProgramAddressSync(seedsWi... | /**
* Find a valid program address
*
* Valid program addresses must fall off the ed25519 curve. This function
* iterates a nonce until it finds one that when combined with the seeds
* results in a valid program address.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L215-L235 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.findProgramAddress | static async findProgramAddress(
seeds: Array<Buffer | Uint8Array>,
programId: PublicKey,
): Promise<[PublicKey, number]> {
return this.findProgramAddressSync(seeds, programId);
} | /**
* Async version of findProgramAddressSync
* For backwards compatibility
*
* @deprecated Use {@link findProgramAddressSync} instead
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L243-L248 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | PublicKey.isOnCurve | static isOnCurve(pubkeyData: PublicKeyInitData): boolean {
const pubkey = new PublicKey(pubkeyData);
return is_on_curve(pubkey.toBytes()) == 1;
} | /**
* Check that a pubkey is on the ed25519 curve.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L253-L256 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | is_on_curve | function is_on_curve(p: Uint8Array) {
try {
return signUtil.ed25519.publicKeyVerify(p) ? 1: 0;
} catch (e) {
return 0;
}
} | // Check that a pubkey is on the curve. | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/publickey.ts#L267-L273 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | CompiledKeys.drainKeysFoundInLookupTable | private drainKeysFoundInLookupTable(
lookupTableEntries: Array<PublicKey>,
keyMetaFilter: (keyMeta: CompiledKeyMeta) => boolean,
): [Array<number>, Array<PublicKey>] {
const lookupTableIndexes = new Array();
const drainedKeys = new Array();
for (const [address, keyMeta] of this.keyMetaMap.entries... | /** @internal */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/message/compiled-keys.ts#L146-L169 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Message.from | static from(buffer: Buffer | Uint8Array | Array<number>): Message {
// Slice up wire data
let byteArray = [...buffer];
const numRequiredSignatures = byteArray.shift()!;
if (
numRequiredSignatures !==
(numRequiredSignatures & VERSION_PREFIX_MASK)
) {
throw new Error(
'Versi... | /**
* Decode a compiled message into a Message object.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/message/legacy.ts#L272-L330 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | ComputeBudgetInstruction.constructor | constructor() {} | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/compute-budget.ts#L20-L20 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | ComputeBudgetInstruction.decodeInstructionType | static decodeInstructionType(
instruction: TransactionInstruction,
): ComputeBudgetInstructionType {
this.checkProgramId(instruction.programId);
const instructionTypeLayout = BufferLayout.u8('instruction');
const typeIndex = instructionTypeLayout.decode(instruction.data);
let type: ComputeBudget... | /**
* Decode a compute budget instruction and retrieve the instruction type.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/compute-budget.ts#L25-L50 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | ComputeBudgetInstruction.decodeRequestUnits | static decodeRequestUnits(
instruction: TransactionInstruction,
): RequestUnitsParams {
this.checkProgramId(instruction.programId);
const {units, additionalFee} = decodeData(
COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits,
instruction.data,
);
return {units, additionalFee};
} | /**
* Decode request units compute budget instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/compute-budget.ts#L55-L64 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | ComputeBudgetInstruction.decodeRequestHeapFrame | static decodeRequestHeapFrame(
instruction: TransactionInstruction,
): RequestHeapFrameParams {
this.checkProgramId(instruction.programId);
const {bytes} = decodeData(
COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame,
instruction.data,
);
return {bytes};
} | /**
* Decode request heap frame compute budget instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/compute-budget.ts#L69-L78 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | ComputeBudgetInstruction.decodeSetComputeUnitLimit | static decodeSetComputeUnitLimit(
instruction: TransactionInstruction,
): SetComputeUnitLimitParams {
this.checkProgramId(instruction.programId);
const {units} = decodeData(
COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit,
instruction.data,
);
return {units};
} | /**
* Decode set compute unit limit compute budget instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/compute-budget.ts#L83-L92 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | ComputeBudgetInstruction.decodeSetComputeUnitPrice | static decodeSetComputeUnitPrice(
instruction: TransactionInstruction,
): SetComputeUnitPriceParams {
this.checkProgramId(instruction.programId);
const {microLamports} = decodeData(
COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice,
instruction.data,
);
return {microLamports};
} | /**
* Decode set compute unit price compute budget instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/compute-budget.ts#L97-L106 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | ComputeBudgetInstruction.checkProgramId | static checkProgramId(programId: PublicKey) {
if (!programId.equals(ComputeBudgetProgram.programId)) {
throw new Error(
'invalid instruction; programId is not ComputeBudgetProgram',
);
}
} | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/compute-budget.ts#L111-L117 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | ComputeBudgetProgram.requestUnits | static requestUnits(params: RequestUnitsParams): TransactionInstruction {
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits;
const data = encodeData(type, params);
return new TransactionInstruction({
keys: [],
programId: this.programId,
data,
});
} | /**
* @deprecated Instead, call {@link setComputeUnitLimit} and/or {@link setComputeUnitPrice}
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/compute-budget.ts#L234-L242 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.constructor | constructor() {} | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L249-L249 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeInstructionType | static decodeInstructionType(
instruction: TransactionInstruction,
): SystemInstructionType {
this.checkProgramId(instruction.programId);
const instructionTypeLayout = BufferLayout.u32('instruction');
const typeIndex = instructionTypeLayout.decode(instruction.data);
let type: SystemInstructionTy... | /**
* Decode a system instruction and retrieve the instruction type.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L254-L275 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeCreateAccount | static decodeCreateAccount(
instruction: TransactionInstruction,
): CreateAccountParams {
this.checkProgramId(instruction.programId);
this.checkKeyLength(instruction.keys, 2);
const {lamports, space, programId} = decodeData(
SYSTEM_INSTRUCTION_LAYOUTS.Create,
instruction.data,
);
... | /**
* Decode a create account system instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L280-L298 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeTransfer | static decodeTransfer(
instruction: TransactionInstruction,
): DecodedTransferInstruction {
this.checkProgramId(instruction.programId);
this.checkKeyLength(instruction.keys, 2);
const {lamports} = decodeData(
SYSTEM_INSTRUCTION_LAYOUTS.Transfer,
instruction.data,
);
return {
... | /**
* Decode a transfer system instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L303-L319 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeTransferWithSeed | static decodeTransferWithSeed(
instruction: TransactionInstruction,
): DecodedTransferWithSeedInstruction {
this.checkProgramId(instruction.programId);
this.checkKeyLength(instruction.keys, 3);
const {lamports, seed, programId} = decodeData(
SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed,
in... | /**
* Decode a transfer with seed system instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L324-L343 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeAllocate | static decodeAllocate(instruction: TransactionInstruction): AllocateParams {
this.checkProgramId(instruction.programId);
this.checkKeyLength(instruction.keys, 1);
const {space} = decodeData(
SYSTEM_INSTRUCTION_LAYOUTS.Allocate,
instruction.data,
);
return {
accountPubkey: instruc... | /**
* Decode an allocate system instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L348-L361 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeAllocateWithSeed | static decodeAllocateWithSeed(
instruction: TransactionInstruction,
): AllocateWithSeedParams {
this.checkProgramId(instruction.programId);
this.checkKeyLength(instruction.keys, 1);
const {base, seed, space, programId} = decodeData(
SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed,
instruction... | /**
* Decode an allocate with seed system instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L366-L384 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeAssign | static decodeAssign(instruction: TransactionInstruction): AssignParams {
this.checkProgramId(instruction.programId);
this.checkKeyLength(instruction.keys, 1);
const {programId} = decodeData(
SYSTEM_INSTRUCTION_LAYOUTS.Assign,
instruction.data,
);
return {
accountPubkey: instructi... | /**
* Decode an assign system instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L389-L402 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeAssignWithSeed | static decodeAssignWithSeed(
instruction: TransactionInstruction,
): AssignWithSeedParams {
this.checkProgramId(instruction.programId);
this.checkKeyLength(instruction.keys, 1);
const {base, seed, programId} = decodeData(
SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed,
instruction.data,
);... | /**
* Decode an assign with seed system instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L407-L424 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeCreateWithSeed | static decodeCreateWithSeed(
instruction: TransactionInstruction,
): CreateAccountWithSeedParams {
this.checkProgramId(instruction.programId);
this.checkKeyLength(instruction.keys, 2);
const {base, seed, lamports, space, programId} = decodeData(
SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed,
... | /**
* Decode a create account with seed system instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L429-L449 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeNonceInitialize | static decodeNonceInitialize(
instruction: TransactionInstruction,
): InitializeNonceParams {
this.checkProgramId(instruction.programId);
this.checkKeyLength(instruction.keys, 3);
const {authorized} = decodeData(
SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount,
instruction.data,
);
... | /**
* Decode a nonce initialize system instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L454-L469 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeNonceAdvance | static decodeNonceAdvance(
instruction: TransactionInstruction,
): AdvanceNonceParams {
this.checkProgramId(instruction.programId);
this.checkKeyLength(instruction.keys, 3);
decodeData(
SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount,
instruction.data,
);
return {
noncePubke... | /**
* Decode a nonce advance system instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L474-L489 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeNonceWithdraw | static decodeNonceWithdraw(
instruction: TransactionInstruction,
): WithdrawNonceParams {
this.checkProgramId(instruction.programId);
this.checkKeyLength(instruction.keys, 5);
const {lamports} = decodeData(
SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount,
instruction.data,
);
ret... | /**
* Decode a nonce withdraw system instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L494-L511 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.decodeNonceAuthorize | static decodeNonceAuthorize(
instruction: TransactionInstruction,
): AuthorizeNonceParams {
this.checkProgramId(instruction.programId);
this.checkKeyLength(instruction.keys, 2);
const {authorized} = decodeData(
SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount,
instruction.data,
);
... | /**
* Decode a nonce authorize system instruction and retrieve the instruction params.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L516-L532 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.checkProgramId | static checkProgramId(programId: PublicKey) {
if (!programId.equals(SystemProgram.programId)) {
throw new Error('invalid instruction; programId is not SystemProgram');
}
} | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L537-L541 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemInstruction.checkKeyLength | static checkKeyLength(keys: Array<any>, expectedLength: number) {
if (keys.length < expectedLength) {
throw new Error(
`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`,
);
}
} | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L546-L552 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemProgram.createAccount | static createAccount(params: CreateAccountParams): TransactionInstruction {
const type = SYSTEM_INSTRUCTION_LAYOUTS.Create;
const data = encodeData(type, {
lamports: params.lamports,
space: params.space,
programId: toBuffer(params.programId.toBuffer()),
});
return new TransactionInstr... | /**
* Generate a transaction instruction that creates a new account
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L761-L777 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemProgram.transfer | static transfer(
params: TransferParams | TransferWithSeedParams,
): TransactionInstruction {
let data;
let keys;
if ('basePubkey' in params) {
const type = SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed;
data = encodeData(type, {
lamports: BigInt(params.lamports),
seed: param... | /**
* Generate a transaction instruction that transfers lamports from one account to another
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L782-L813 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemProgram.assign | static assign(
params: AssignParams | AssignWithSeedParams,
): TransactionInstruction {
let data;
let keys;
if ('basePubkey' in params) {
const type = SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed;
data = encodeData(type, {
base: toBuffer(params.basePubkey.toBuffer()),
seed: pa... | /**
* Generate a transaction instruction that assigns an account to a program
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L818-L847 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemProgram.createAccountWithSeed | static createAccountWithSeed(
params: CreateAccountWithSeedParams,
): TransactionInstruction {
const type = SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed;
const data = encodeData(type, {
base: toBuffer(params.basePubkey.toBuffer()),
seed: params.seed,
lamports: params.lamports,
space: ... | /**
* Generate a transaction instruction that creates a new account at
* an address generated with `from`, a seed, and programId
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L853-L881 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemProgram.createNonceAccount | static createNonceAccount(
params: CreateNonceAccountParams | CreateNonceAccountWithSeedParams,
): Transaction {
const transaction = new Transaction();
if ('basePubkey' in params && 'seed' in params) {
transaction.add(
SystemProgram.createAccountWithSeed({
fromPubkey: params.fromPu... | /**
* Generate a transaction that creates a new Nonce account
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L886-L921 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemProgram.nonceInitialize | static nonceInitialize(
params: InitializeNonceParams,
): TransactionInstruction {
const type = SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount;
const data = encodeData(type, {
authorized: toBuffer(params.authorizedPubkey.toBuffer()),
});
const instructionData = {
keys: [
{pu... | /**
* Generate an instruction to initialize a Nonce account
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L926-L947 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemProgram.nonceAdvance | static nonceAdvance(params: AdvanceNonceParams): TransactionInstruction {
const type = SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount;
const data = encodeData(type);
const instructionData = {
keys: [
{pubkey: params.noncePubkey, isSigner: false, isWritable: true},
{
pubkey: S... | /**
* Generate an instruction to advance the nonce in a Nonce account
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L952-L969 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemProgram.nonceWithdraw | static nonceWithdraw(params: WithdrawNonceParams): TransactionInstruction {
const type = SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount;
const data = encodeData(type, {lamports: params.lamports});
return new TransactionInstruction({
keys: [
{pubkey: params.noncePubkey, isSigner: false, isWri... | /**
* Generate a transaction instruction that withdraws lamports from a Nonce account
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L974-L997 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemProgram.nonceAuthorize | static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction {
const type = SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount;
const data = encodeData(type, {
authorized: toBuffer(params.newAuthorizedPubkey.toBuffer()),
});
return new TransactionInstruction({
keys: [
{... | /**
* Generate a transaction instruction that authorizes a new PublicKey as the authority
* on a Nonce account.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L1003-L1017 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SystemProgram.allocate | static allocate(
params: AllocateParams | AllocateWithSeedParams,
): TransactionInstruction {
let data;
let keys;
if ('basePubkey' in params) {
const type = SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed;
data = encodeData(type, {
base: toBuffer(params.basePubkey.toBuffer()),
... | /**
* Generate a transaction instruction that allocates space in an account without funding
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/system.ts#L1022-L1052 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | AddressLookupTableInstruction.constructor | constructor() {} | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/address-lookup-table/index.ts#L141-L141 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | AddressLookupTableInstruction.checkProgramId | static checkProgramId(programId: PublicKey) {
if (!programId.equals(AddressLookupTableProgram.programId)) {
throw new Error(
'invalid instruction; programId is not AddressLookupTable Program',
);
}
} | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/address-lookup-table/index.ts#L249-L255 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | AddressLookupTableInstruction.checkKeysLength | static checkKeysLength(keys: Array<any>, expectedLength: number) {
if (keys.length < expectedLength) {
throw new Error(
`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`,
);
}
} | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/programs/address-lookup-table/index.ts#L259-L265 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | TransactionInstruction.toJSON | toJSON(): TransactionInstructionJSON {
return {
keys: this.keys.map(({pubkey, isSigner, isWritable}) => ({
pubkey: pubkey.toJSON(),
isSigner,
isWritable,
})),
programId: this.programId.toJSON(),
data: [...this.data],
};
} | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L111-L121 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.signature | get signature(): Buffer | null {
if (this.signatures.length > 0) {
return this.signatures[0].signature;
}
return null;
} | /**
* The first (payer) Transaction signature
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L216-L221 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.constructor | constructor(
opts?:
| TransactionBlockhashCtor
| TransactionNonceCtor
| TransactionCtorFields_DEPRECATED,
) {
if (!opts) {
return;
}
if (opts.feePayer) {
this.feePayer = opts.feePayer;
}
if (opts.signatures) {
this.signatures = opts.signatures;
}
if ... | /**
* Construct an empty Transaction
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L283-L317 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.toJSON | toJSON(): TransactionJSON {
return {
recentBlockhash: this.recentBlockhash || null,
feePayer: this.feePayer ? this.feePayer.toJSON() : null,
nonceInfo: this.nonceInfo
? {
nonce: this.nonceInfo.nonce,
nonceInstruction: this.nonceInfo.nonceInstruction.toJSON(),
... | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L322-L337 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.add | add(
...items: Array<
Transaction | TransactionInstruction | TransactionInstructionCtorFields
>
): Transaction {
if (items.length === 0) {
throw new Error('No instructions');
}
items.forEach((item: any) => {
if ('instructions' in item) {
this.instructions = this.instruct... | /**
* Add one or more instructions to this Transaction
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L342-L361 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.compileMessage | compileMessage(): Message {
if (
this._message &&
JSON.stringify(this.toJSON()) === JSON.stringify(this._json)
) {
return this._message;
}
let recentBlockhash;
let instructions: TransactionInstruction[];
if (this.nonceInfo) {
recentBlockhash = this.nonceInfo.nonce;
... | /**
* Compile transaction data
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L366-L553 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction._compile | _compile(): Message {
const message = this.compileMessage();
const signedKeys = message.accountKeys.slice(
0,
message.header.numRequiredSignatures,
);
if (this.signatures.length === signedKeys.length) {
const valid = this.signatures.every((pair, index) => {
return signedKeys[i... | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L558-L579 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.serializeMessage | serializeMessage(): Buffer {
return this._compile().serialize();
} | /**
* Get a buffer of the Transaction data that need to be covered by signatures
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L584-L586 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.setSigners | setSigners(...signers: Array<PublicKey>) {
if (signers.length === 0) {
throw new Error('No signers');
}
const seen = new Set();
this.signatures = signers
.filter(publicKey => {
const key = publicKey.toString();
if (seen.has(key)) {
return false;
} else {
... | /**
* Specify the public keys which will be used to sign the Transaction.
* The first signer will be used as the transaction fee payer account.
*
* Signatures can be added with either `partialSign` or `addSignature`
*
* @deprecated Deprecated since v0.84.0. Only the fee payer needs to be
* specifie... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L598-L615 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.sign | sign(...signers: Array<Signer>) {
if (signers.length === 0) {
throw new Error('No signers');
}
// Dedupe signers
const seen = new Set();
const uniqueSigners = [];
for (const signer of signers) {
const key = signer.publicKey.toString();
if (seen.has(key)) {
continue;
... | /**
* Sign the Transaction with the specified signers. Multiple signatures may
* be applied to a Transaction. The first signature is considered "primary"
* and is used identify and confirm transactions.
*
* If the Transaction `feePayer` is not set, the first signer will be used
* as the transaction fe... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L631-L656 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.partialSign | partialSign(...signers: Array<Signer>) {
if (signers.length === 0) {
throw new Error('No signers');
}
// Dedupe signers
const seen = new Set();
const uniqueSigners = [];
for (const signer of signers) {
const key = signer.publicKey.toString();
if (seen.has(key)) {
conti... | /**
* Partially sign a transaction with the specified accounts. All accounts must
* correspond to either the fee payer or a signer account in the transaction
* instructions.
*
* All the caveats from the `sign` method apply to `partialSign`
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L665-L685 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction._partialSign | _partialSign(message: Message, ...signers: Array<Signer>) {
const signData = message.serialize();
signers.forEach(signer => {
const signature = signUtil.ed25519.sign(signData, signer.secretKey);
this._addSignature(signer.publicKey, toBuffer(signature));
});
} | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L690-L696 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.addSignature | addSignature(pubkey: PublicKey, signature: Buffer) {
this._compile(); // Ensure signatures array is populated
this._addSignature(pubkey, signature);
} | /**
* Add an externally created signature to a transaction. The public key
* must correspond to either the fee payer or a signer account in the transaction
* instructions.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L703-L706 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction._addSignature | _addSignature(pubkey: PublicKey, signature: Buffer) {
invariant(signature.length === 64);
const index = this.signatures.findIndex(sigpair =>
pubkey.equals(sigpair.publicKey),
);
if (index < 0) {
throw new Error(`unknown signer: ${pubkey.toString()}`);
}
this.signatures[index].signa... | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L711-L722 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.verifySignatures | verifySignatures(requireAllSignatures?: boolean): boolean {
return this._verifySignatures(
this.serializeMessage(),
requireAllSignatures === undefined ? true : requireAllSignatures,
);
} | /**
* Verify signatures of a Transaction
* Optional parameter specifies if we're expecting a fully signed Transaction or a partially signed one.
* If no boolean is provided, we expect a fully signed Transaction by default.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L729-L734 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction._verifySignatures | _verifySignatures(
signData: Uint8Array,
requireAllSignatures: boolean,
): boolean {
for (const {signature, publicKey} of this.signatures) {
if (signature === null) {
if (requireAllSignatures) {
return false;
}
} else {
if (!signUtil.ed25519.verify(signData, s... | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L739-L755 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.serialize | serialize(config?: SerializeConfig): Buffer {
const {requireAllSignatures, verifySignatures} = Object.assign(
{requireAllSignatures: true, verifySignatures: true},
config,
);
const signData = this.serializeMessage();
if (
verifySignatures &&
!this._verifySignatures(signData, req... | /**
* Serialize the Transaction in the wire format.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L760-L775 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction._serialize | _serialize(signData: Buffer): Buffer {
const {signatures} = this;
const signatureCount: number[] = [];
shortvec.encodeLength(signatureCount, signatures.length);
const transactionLength =
signatureCount.length + signatures.length * 64 + signData.length;
const wireTransaction = Buffer.alloc(tran... | /**
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L780-L807 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.keys | get keys(): Array<PublicKey> {
invariant(this.instructions.length === 1);
return this.instructions[0].keys.map(keyObj => keyObj.pubkey);
} | /**
* Deprecated method
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L813-L816 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.programId | get programId(): PublicKey {
invariant(this.instructions.length === 1);
return this.instructions[0].programId;
} | /**
* Deprecated method
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L822-L825 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.data | get data(): Buffer {
invariant(this.instructions.length === 1);
return this.instructions[0].data;
} | /**
* Deprecated method
* @internal
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L831-L834 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.from | static from(buffer: Buffer | Uint8Array | Array<number>): Transaction {
// Slice up wire data
let byteArray = [...buffer];
const signatureCount = shortvec.decodeLength(byteArray);
let signatures = [];
for (let i = 0; i < signatureCount; i++) {
const signature = byteArray.slice(0, SIGNATURE_LE... | /**
* Parse a wire transaction into a Transaction object.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L839-L852 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.populate | static populate(
message: Message,
signatures: Array<string> = [],
): Transaction {
const transaction = new Transaction();
transaction.recentBlockhash = message.recentBlockhash;
if (message.header.numRequiredSignatures > 0) {
transaction.feePayer = message.accountKeys[0];
}
signature... | /**
* Populate Transaction object from message and signatures
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-solana/src/sdk/web3/transaction/legacy.ts#L857-L903 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | c32checksum | function c32checksum(dataHex: string): string {
const dataHash = base.sha256(base.sha256(hexToBytes(dataHex)));
const checksum = bytesToHex(dataHash.slice(0, 4));
return checksum;
} | /**
* Get the c32check checksum of a hex-encoded string
* @param {string} dataHex - the hex string
* @returns {string} the c32 checksum, as a bin-encoded string
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-stacks/src/c32check/checksum.ts#L17-L21 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | nthBit | function nthBit(value: bigint, n: bigint) {
return value & (BigInt(1) << n);
} | /**
* Returns nth bit (right-to-left, zero-indexed)
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-stacks/src/common/utils.ts#L142-L144 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | equalsConstTime | function equalsConstTime(a: Uint8Array, b: Uint8Array) {
if (a.length !== b.length) {
return false;
}
let res = 0;
for (let i = 0; i < a.length; i++) {
res |= a[i] ^ b[i];
}
return res === 0;
} | /**
* @ignore
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-stacks/src/encryption/ec.ts#L93-L102 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.