@triton-one/yellowstone-grpc 4.0.2 → 5.0.1-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/dist/cjs/encoding/yellowstone_grpc_solana_encoding_wasm.d.ts +5 -172
- package/dist/cjs/encoding/yellowstone_grpc_solana_encoding_wasm.js +132 -980
- package/dist/cjs/encoding/yellowstone_grpc_solana_encoding_wasm.js.map +1 -1
- package/dist/cjs/encoding/yellowstone_grpc_solana_encoding_wasm_bg.wasm +0 -0
- package/dist/cjs/encoding/yellowstone_grpc_solana_encoding_wasm_bg.wasm.d.ts +36 -84
- package/dist/cjs/grpc/geyser.js +105 -2
- package/dist/cjs/grpc/geyser.js.map +1 -1
- package/dist/cjs/grpc/google/protobuf/timestamp.js.map +1 -1
- package/dist/cjs/grpc/solana-storage.js +16 -1
- package/dist/cjs/grpc/solana-storage.js.map +1 -1
- package/dist/cjs/index.js +100 -211
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/napi/index.js +649 -0
- package/dist/cjs/napi/index.js.map +1 -0
- package/dist/cjs/napi/yellowstone-grpc-napi.linux-x64-gnu.node +0 -0
- package/dist/encoding/yellowstone_grpc_solana_encoding_wasm.d.ts +616 -0
- package/dist/encoding/yellowstone_grpc_solana_encoding_wasm.js +3805 -0
- package/dist/encoding/yellowstone_grpc_solana_encoding_wasm_bg.wasm +0 -0
- package/dist/encoding/yellowstone_grpc_solana_encoding_wasm_bg.wasm.d.ts +254 -0
- package/dist/esm/encoding/yellowstone_grpc_solana_encoding_wasm.d.ts +5 -172
- package/dist/esm/encoding/yellowstone_grpc_solana_encoding_wasm.js +132 -980
- package/dist/esm/encoding/yellowstone_grpc_solana_encoding_wasm_bg.wasm +0 -0
- package/dist/esm/encoding/yellowstone_grpc_solana_encoding_wasm_bg.wasm.d.ts +36 -84
- package/dist/esm/grpc/geyser.js +97 -1
- package/dist/esm/grpc/google/protobuf/timestamp.js +1 -1
- package/dist/esm/grpc/solana-storage.js +16 -1
- package/dist/esm/index.js +64 -148
- package/dist/esm/napi/index.js +576 -0
- package/dist/esm/napi/yellowstone-grpc-napi.linux-x64-gnu.node +0 -0
- package/dist/types/encoding/yellowstone_grpc_solana_encoding_wasm.d.ts +5 -172
- package/dist/types/encoding/yellowstone_grpc_solana_encoding_wasm.js +132 -980
- package/dist/types/encoding/yellowstone_grpc_solana_encoding_wasm_bg.wasm +0 -0
- package/dist/types/encoding/yellowstone_grpc_solana_encoding_wasm_bg.wasm.d.ts +36 -84
- package/dist/types/grpc/geyser.d.ts +93 -0
- package/dist/types/grpc/google/protobuf/timestamp.d.ts +2 -10
- package/dist/types/grpc/solana-storage.d.ts +24 -0
- package/dist/types/index.d.ts +19 -34
- package/dist/types/napi/index.d.ts +70 -0
- package/package.json +24 -4
package/README.md
CHANGED
|
@@ -24,3 +24,25 @@ npm run build
|
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
Please refer to [examples/typescript](../examples/typescript/README.md) for some usage examples.
|
|
27
|
+
|
|
28
|
+
## Troubleshooting
|
|
29
|
+
|
|
30
|
+
### For macOS:
|
|
31
|
+
|
|
32
|
+
You might have to run `npm run build` with `RUSTFLAGS="-Clink-arg=-undefined -Clink-arg=dynamic_lookup"` to skip the strict linkers from failing the build step and resolve `dylib`s via runtime.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
RUSTFLAGS="-Clink-arg=-undefined -Clink-arg=dynamic_lookup" npm run build
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Working
|
|
39
|
+
|
|
40
|
+
Since the start, the `@triton-one/yellowstone-grpc` package has used the `@grpc/grpc-js` lib for gRPC types enforcement, connection and subscription management. This hit a bottleneck, described in [this blog](https://blog.triton.one/supercharging-the-javascript-sdk-with-napi/)
|
|
41
|
+
|
|
42
|
+
From `v5.0.0` the [napi-rs](https://github.com/napi-rs/napi-rs) framework is used for gRPC connection and subscription management. It's described into [this blog](https://blog.triton.one/supercharging-the-javascript-sdk-with-napi/)
|
|
43
|
+
|
|
44
|
+
These changes are internal to the SDK and do not have any breaking changes for client code. If you face any issues, please open an issue
|
|
45
|
+
|
|
46
|
+
The `@grpc/grpc-js` lib is still being used for types management. This is will be removed in the future release without any braking API changes
|
|
47
|
+
|
|
48
|
+
The [napi-rs](https://github.com/napi-rs/napi-rs) based implementation is inspired from the implemenation of the [LaserStream SDK](https://github.com/helius-labs/laserstream-sdk)
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export function encode_tx(data: Uint8Array, encoding: WasmUiTransactionEncoding, max_supported_transaction_version: number | null | undefined, show_rewards: boolean): string;
|
|
4
4
|
export function decode_tx_error(err: Uint8Array): string;
|
|
5
|
-
/**
|
|
6
|
-
* Initialize Javascript logging and panic handler
|
|
7
|
-
*/
|
|
8
|
-
export function solana_program_init(): void;
|
|
9
5
|
export enum WasmUiTransactionEncoding {
|
|
10
6
|
Binary = 0,
|
|
11
7
|
Base64 = 1,
|
|
@@ -26,7 +22,7 @@ export class AeKey {
|
|
|
26
22
|
/**
|
|
27
23
|
* Generates a random authenticated encryption key.
|
|
28
24
|
*
|
|
29
|
-
* This function is randomized. It internally samples a
|
|
25
|
+
* This function is randomized. It internally samples a 128-bit key using `OsRng`.
|
|
30
26
|
*/
|
|
31
27
|
static newRand(): AeKey;
|
|
32
28
|
/**
|
|
@@ -308,92 +304,13 @@ export class GroupedElGamalCiphertext2Handles {
|
|
|
308
304
|
private constructor();
|
|
309
305
|
free(): void;
|
|
310
306
|
static encryptU64(first_pubkey: ElGamalPubkey, second_pubkey: ElGamalPubkey, amount: bigint): GroupedElGamalCiphertext2Handles;
|
|
311
|
-
static
|
|
307
|
+
static encryptWithU64(first_pubkey: ElGamalPubkey, second_pubkey: ElGamalPubkey, amount: bigint, opening: PedersenOpening): GroupedElGamalCiphertext2Handles;
|
|
312
308
|
}
|
|
313
309
|
export class GroupedElGamalCiphertext3Handles {
|
|
314
310
|
private constructor();
|
|
315
311
|
free(): void;
|
|
316
312
|
static encryptU64(first_pubkey: ElGamalPubkey, second_pubkey: ElGamalPubkey, third_pubkey: ElGamalPubkey, amount: bigint): GroupedElGamalCiphertext3Handles;
|
|
317
|
-
static
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* A hash; the 32-byte output of a hashing algorithm.
|
|
321
|
-
*
|
|
322
|
-
* This struct is used most often in `solana-sdk` and related crates to contain
|
|
323
|
-
* a [SHA-256] hash, but may instead contain a [blake3] hash.
|
|
324
|
-
*
|
|
325
|
-
* [SHA-256]: https://en.wikipedia.org/wiki/SHA-2
|
|
326
|
-
* [blake3]: https://github.com/BLAKE3-team/BLAKE3
|
|
327
|
-
*/
|
|
328
|
-
export class Hash {
|
|
329
|
-
free(): void;
|
|
330
|
-
/**
|
|
331
|
-
* Create a new Hash object
|
|
332
|
-
*
|
|
333
|
-
* * `value` - optional hash as a base58 encoded string, `Uint8Array`, `[number]`
|
|
334
|
-
*/
|
|
335
|
-
constructor(value: any);
|
|
336
|
-
/**
|
|
337
|
-
* Return the base58 string representation of the hash
|
|
338
|
-
*/
|
|
339
|
-
toString(): string;
|
|
340
|
-
/**
|
|
341
|
-
* Checks if two `Hash`s are equal
|
|
342
|
-
*/
|
|
343
|
-
equals(other: Hash): boolean;
|
|
344
|
-
/**
|
|
345
|
-
* Return the `Uint8Array` representation of the hash
|
|
346
|
-
*/
|
|
347
|
-
toBytes(): Uint8Array;
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* wasm-bindgen version of the Instruction struct.
|
|
351
|
-
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
|
|
352
|
-
* is fixed. This must not diverge from the regular non-wasm Instruction struct.
|
|
353
|
-
*/
|
|
354
|
-
export class Instruction {
|
|
355
|
-
private constructor();
|
|
356
|
-
free(): void;
|
|
357
|
-
}
|
|
358
|
-
export class Instructions {
|
|
359
|
-
free(): void;
|
|
360
|
-
constructor();
|
|
361
|
-
push(instruction: Instruction): void;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* A vanilla Ed25519 key pair
|
|
365
|
-
*/
|
|
366
|
-
export class Keypair {
|
|
367
|
-
free(): void;
|
|
368
|
-
/**
|
|
369
|
-
* Create a new `Keypair `
|
|
370
|
-
*/
|
|
371
|
-
constructor();
|
|
372
|
-
/**
|
|
373
|
-
* Convert a `Keypair` to a `Uint8Array`
|
|
374
|
-
*/
|
|
375
|
-
toBytes(): Uint8Array;
|
|
376
|
-
/**
|
|
377
|
-
* Recover a `Keypair` from a `Uint8Array`
|
|
378
|
-
*/
|
|
379
|
-
static fromBytes(bytes: Uint8Array): Keypair;
|
|
380
|
-
/**
|
|
381
|
-
* Return the `Pubkey` for this `Keypair`
|
|
382
|
-
*/
|
|
383
|
-
pubkey(): Pubkey;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* wasm-bindgen version of the Message struct.
|
|
387
|
-
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
|
|
388
|
-
* is fixed. This must not diverge from the regular non-wasm Message struct.
|
|
389
|
-
*/
|
|
390
|
-
export class Message {
|
|
391
|
-
private constructor();
|
|
392
|
-
free(): void;
|
|
393
|
-
/**
|
|
394
|
-
* The id of a recent ledger entry.
|
|
395
|
-
*/
|
|
396
|
-
recent_blockhash: Hash;
|
|
313
|
+
static encryptWithU64(first_pubkey: ElGamalPubkey, second_pubkey: ElGamalPubkey, third_pubkey: ElGamalPubkey, amount: bigint, opening: PedersenOpening): GroupedElGamalCiphertext3Handles;
|
|
397
314
|
}
|
|
398
315
|
/**
|
|
399
316
|
* Algorithm handle for the Pedersen commitment scheme.
|
|
@@ -426,7 +343,7 @@ export class PedersenOpening {
|
|
|
426
343
|
* The proof consists of two main components: `percentage_max_proof` and
|
|
427
344
|
* `percentage_equality_proof`. If the committed amount is greater than the maximum cap value,
|
|
428
345
|
* then the `percentage_max_proof` is properly generated and `percentage_equality_proof` is
|
|
429
|
-
* simulated. If the
|
|
346
|
+
* simulated. If the committed amount is smaller than the maximum cap bound, the
|
|
430
347
|
* `percentage_equality_proof` is properly generated and `percentage_max_proof` is simulated.
|
|
431
348
|
*/
|
|
432
349
|
export class PercentageWithCapProof {
|
|
@@ -606,62 +523,6 @@ export class PodZeroCiphertextProof {
|
|
|
606
523
|
private constructor();
|
|
607
524
|
free(): void;
|
|
608
525
|
}
|
|
609
|
-
/**
|
|
610
|
-
* The address of a [Solana account][acc].
|
|
611
|
-
*
|
|
612
|
-
* Some account addresses are [ed25519] public keys, with corresponding secret
|
|
613
|
-
* keys that are managed off-chain. Often, though, account addresses do not
|
|
614
|
-
* have corresponding secret keys — as with [_program derived
|
|
615
|
-
* addresses_][pdas] — or the secret key is not relevant to the operation
|
|
616
|
-
* of a program, and may have even been disposed of. As running Solana programs
|
|
617
|
-
* can not safely create or manage secret keys, the full [`Keypair`] is not
|
|
618
|
-
* defined in `solana-program` but in `solana-sdk`.
|
|
619
|
-
*
|
|
620
|
-
* [acc]: https://solana.com/docs/core/accounts
|
|
621
|
-
* [ed25519]: https://ed25519.cr.yp.to/
|
|
622
|
-
* [pdas]: https://solana.com/docs/core/cpi#program-derived-addresses
|
|
623
|
-
* [`Keypair`]: https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/struct.Keypair.html
|
|
624
|
-
*/
|
|
625
|
-
export class Pubkey {
|
|
626
|
-
free(): void;
|
|
627
|
-
/**
|
|
628
|
-
* Create a new Pubkey object
|
|
629
|
-
*
|
|
630
|
-
* * `value` - optional public key as a base58 encoded string, `Uint8Array`, `[number]`
|
|
631
|
-
*/
|
|
632
|
-
constructor(value: any);
|
|
633
|
-
/**
|
|
634
|
-
* Return the base58 string representation of the public key
|
|
635
|
-
*/
|
|
636
|
-
toString(): string;
|
|
637
|
-
/**
|
|
638
|
-
* Check if a `Pubkey` is on the ed25519 curve.
|
|
639
|
-
*/
|
|
640
|
-
isOnCurve(): boolean;
|
|
641
|
-
/**
|
|
642
|
-
* Checks if two `Pubkey`s are equal
|
|
643
|
-
*/
|
|
644
|
-
equals(other: Pubkey): boolean;
|
|
645
|
-
/**
|
|
646
|
-
* Return the `Uint8Array` representation of the public key
|
|
647
|
-
*/
|
|
648
|
-
toBytes(): Uint8Array;
|
|
649
|
-
/**
|
|
650
|
-
* Derive a Pubkey from another Pubkey, string seed, and a program id
|
|
651
|
-
*/
|
|
652
|
-
static createWithSeed(base: Pubkey, seed: string, owner: Pubkey): Pubkey;
|
|
653
|
-
/**
|
|
654
|
-
* Derive a program address from seeds and a program id
|
|
655
|
-
*/
|
|
656
|
-
static createProgramAddress(seeds: any[], program_id: Pubkey): Pubkey;
|
|
657
|
-
/**
|
|
658
|
-
* Find a valid program address
|
|
659
|
-
*
|
|
660
|
-
* Returns:
|
|
661
|
-
* * `[PubKey, number]` - the program address and bump seed
|
|
662
|
-
*/
|
|
663
|
-
static findProgramAddress(seeds: any[], program_id: Pubkey): any;
|
|
664
|
-
}
|
|
665
526
|
/**
|
|
666
527
|
* Public-key proof.
|
|
667
528
|
*
|
|
@@ -706,34 +567,6 @@ export class PubkeyValidityProofData {
|
|
|
706
567
|
*/
|
|
707
568
|
proof: PodPubkeyValidityProof;
|
|
708
569
|
}
|
|
709
|
-
/**
|
|
710
|
-
* wasm-bindgen version of the Transaction struct.
|
|
711
|
-
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
|
|
712
|
-
* is fixed. This must not diverge from the regular non-wasm Transaction struct.
|
|
713
|
-
*/
|
|
714
|
-
export class Transaction {
|
|
715
|
-
free(): void;
|
|
716
|
-
/**
|
|
717
|
-
* Create a new `Transaction`
|
|
718
|
-
*/
|
|
719
|
-
constructor(instructions: Instructions, payer?: Pubkey | null);
|
|
720
|
-
/**
|
|
721
|
-
* Return a message containing all data that should be signed.
|
|
722
|
-
*/
|
|
723
|
-
message(): Message;
|
|
724
|
-
/**
|
|
725
|
-
* Return the serialized message data to sign.
|
|
726
|
-
*/
|
|
727
|
-
messageData(): Uint8Array;
|
|
728
|
-
/**
|
|
729
|
-
* Verify the transaction
|
|
730
|
-
*/
|
|
731
|
-
verify(): void;
|
|
732
|
-
partialSign(keypair: Keypair, recent_blockhash: Hash): void;
|
|
733
|
-
isSigned(): boolean;
|
|
734
|
-
toBytes(): Uint8Array;
|
|
735
|
-
static fromBytes(bytes: Uint8Array): Transaction;
|
|
736
|
-
}
|
|
737
570
|
/**
|
|
738
571
|
* Zero-ciphertext proof.
|
|
739
572
|
*
|
|
@@ -761,7 +594,7 @@ export class ZeroCiphertextProofContext {
|
|
|
761
594
|
ciphertext: PodElGamalCiphertext;
|
|
762
595
|
}
|
|
763
596
|
/**
|
|
764
|
-
* The instruction data that is needed for the `ProofInstruction::
|
|
597
|
+
* The instruction data that is needed for the `ProofInstruction::VerifyZeroCiphertext` instruction.
|
|
765
598
|
*
|
|
766
599
|
* It includes the cryptographic proof as well as the context data information needed to verify
|
|
767
600
|
* the proof.
|