@zebec-network/zebec-stream-sdk 1.6.0 → 1.7.0

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.
@@ -1,17 +1,17 @@
1
- import { Address, AnchorProvider } from "@coral-xyz/anchor";
2
- import { ConfirmOptions, Connection, PublicKey, Transaction, VersionedTransaction } from "@solana/web3.js";
1
+ import { Address, AnchorProvider, web3 } from "@coral-xyz/anchor";
2
+ import { ConfirmOptions, PublicKey } from "@solana/web3.js";
3
3
  export declare class ReadonlyProvider {
4
- readonly connection: Connection;
4
+ readonly connection: web3.Connection;
5
5
  readonly walletAddress?: PublicKey;
6
- constructor(connection: Connection, walletAddress?: Address);
6
+ constructor(connection: web3.Connection, walletAddress?: Address);
7
7
  }
8
- export declare function createReadonlyProvider(connection: Connection, walletAddress?: Address): ReadonlyProvider;
8
+ export declare function createReadonlyProvider(connection: web3.Connection, walletAddress?: Address): ReadonlyProvider;
9
9
  /**
10
10
  * Wallet interface used by Anchor Framework
11
11
  */
12
12
  export interface AnchorWallet {
13
- signTransaction: <T extends Transaction | VersionedTransaction>(tx: T) => Promise<T>;
14
- signAllTransactions: <T extends Transaction | VersionedTransaction>(txs: T[]) => Promise<T[]>;
13
+ signTransaction: <T extends web3.Transaction | web3.VersionedTransaction>(tx: T) => Promise<T>;
14
+ signAllTransactions: <T extends web3.Transaction | web3.VersionedTransaction>(txs: T[]) => Promise<T[]>;
15
15
  publicKey: PublicKey;
16
16
  }
17
- export declare function createAnchorProvider(connection: Connection, wallet: AnchorWallet, options?: ConfirmOptions): AnchorProvider;
17
+ export declare function createAnchorProvider(connection: web3.Connection, wallet: AnchorWallet, options?: ConfirmOptions): AnchorProvider;
@@ -1,4 +1,4 @@
1
- import { Address, BN, Program, Provider } from "@coral-xyz/anchor";
1
+ import { Address, BN, Program, Provider, web3 } from "@coral-xyz/anchor";
2
2
  import { Commitment, Keypair, PublicKey, TransactionInstruction } from "@solana/web3.js";
3
3
  import { TransactionPayload } from "@zebec-network/solana-common";
4
4
  import { ZebecStreamIdl } from "../artifacts";
@@ -10,7 +10,7 @@ export declare class ZebecStreamService {
10
10
  constructor(provider: Provider, network: "mainnet-beta" | "devnet", program: Program<ZebecStreamIdl>);
11
11
  static create(provider: Provider, network: "mainnet-beta" | "devnet"): ZebecStreamService;
12
12
  private _createPayload;
13
- get connection(): import("@solana/web3.js").Connection;
13
+ get connection(): web3.Connection;
14
14
  get programId(): PublicKey;
15
15
  getInitializeStreamConfigInstruction(admin: PublicKey, config: {
16
16
  baseFee: BN;
@@ -52,7 +52,12 @@ class ZebecStreamService {
52
52
  return provider.wallet.signTransaction(tx);
53
53
  };
54
54
  }
55
- return new solana_common_1.TransactionPayload(this.connection, errorMap, instructions, payerKey, signers, addressLookupTableAccounts, signTransaction);
55
+ return new solana_common_1.TransactionPayload(this.connection, errorMap, {
56
+ instructions,
57
+ feePayer: payerKey,
58
+ signers,
59
+ addressLookupTableAccounts,
60
+ }, signTransaction);
56
61
  }
57
62
  get connection() {
58
63
  return this.provider.connection;
@@ -73,7 +78,7 @@ class ZebecStreamService {
73
78
  })
74
79
  .instruction();
75
80
  }
76
- getUpdateStreamConfigInstruction(admin, config) {
81
+ async getUpdateStreamConfigInstruction(admin, config) {
77
82
  return this.program.methods
78
83
  .updateConfig({
79
84
  baseFee: config.baseFee,
@@ -86,7 +91,7 @@ class ZebecStreamService {
86
91
  })
87
92
  .instruction();
88
93
  }
89
- getCreateStreamInstruction(feePayer, receiver, senderAta, streamToken, withdrawAccount, sender, streamMetadata, streamData) {
94
+ async getCreateStreamInstruction(feePayer, receiver, senderAta, streamToken, withdrawAccount, sender, streamMetadata, streamData) {
90
95
  (0, assert_1.default)(streamData.streamName.length === constants_1.STREAM_NAME_BUFFER_SIZE, `Stream name buffer must be of size ${constants_1.STREAM_NAME_BUFFER_SIZE}`);
91
96
  return this.program.methods
92
97
  .createStream({
@@ -117,7 +122,7 @@ class ZebecStreamService {
117
122
  })
118
123
  .instruction();
119
124
  }
120
- getPauseResumeStreamInstruction(streamMetadata, user) {
125
+ async getPauseResumeStreamInstruction(streamMetadata, user) {
121
126
  return this.program.methods
122
127
  .pauseResumeStream()
123
128
  .accounts({
@@ -126,7 +131,7 @@ class ZebecStreamService {
126
131
  })
127
132
  .instruction();
128
133
  }
129
- getCancelStreamInstruction(feePayer, otherParty, otherPartyAta, signer, signerAta, streamMetadata, streamToken, streamVault, streamVaultAta) {
134
+ async getCancelStreamInstruction(feePayer, otherParty, otherPartyAta, signer, signerAta, streamMetadata, streamToken, streamVault, streamVaultAta) {
130
135
  return this.program.methods
131
136
  .cancelStream()
132
137
  .accountsPartial({
@@ -142,7 +147,7 @@ class ZebecStreamService {
142
147
  })
143
148
  .instruction();
144
149
  }
145
- getWithdrawStreamInstruction(receiver, receiverAta, streamMetadata, streamToken, streamVault, streamVaultAta, withdrawer, feePayer) {
150
+ async getWithdrawStreamInstruction(receiver, receiverAta, streamMetadata, streamToken, streamVault, streamVaultAta, withdrawer, feePayer) {
146
151
  return this.program.methods
147
152
  .withdrawStream()
148
153
  .accountsPartial({
@@ -1,5 +1,5 @@
1
1
  import * as anchor from "@coral-xyz/anchor";
2
- import { Commitment, Connection, Keypair, PublicKey } from "@solana/web3.js";
2
+ import { Commitment, Keypair, PublicKey } from "@solana/web3.js";
3
3
  import { TransactionPayload } from "@zebec-network/solana-common";
4
4
  import { ZebecStreamIdl as ZTokenIdl } from "../artifacts";
5
5
  import { Numeric } from "../types";
@@ -9,7 +9,7 @@ export declare class ZTokenService {
9
9
  constructor(provider: anchor.Provider, program: anchor.Program<ZTokenIdl>);
10
10
  static create(provider: anchor.Provider, network: "mainnet-beta" | "devnet"): ZTokenService;
11
11
  get programId(): PublicKey;
12
- get connection(): Connection;
12
+ get connection(): anchor.web3.Connection;
13
13
  private _createPayload;
14
14
  getInitZTOkenConfigInstruction(admin: PublicKey, feeVault: PublicKey, feeBps: number, minAmount: anchor.BN): Promise<anchor.web3.TransactionInstruction>;
15
15
  getMintZTokenInstruction(admin: PublicKey, destination: PublicKey, mint: PublicKey, amount: anchor.BN, hash: number[]): Promise<anchor.web3.TransactionInstruction>;
@@ -88,7 +88,7 @@ class ZTokenService {
88
88
  return provider.wallet.signTransaction(tx);
89
89
  };
90
90
  }
91
- return new solana_common_1.TransactionPayload(this.connection, errorMap, instructions, payerKey, signers, addressLookupTableAccounts, signTransaction);
91
+ return new solana_common_1.TransactionPayload(this.connection, errorMap, { instructions, feePayer: payerKey, signers, addressLookupTableAccounts }, signTransaction);
92
92
  }
93
93
  async getInitZTOkenConfigInstruction(admin, feeVault, feeBps, minAmount) {
94
94
  return this.program.methods
@@ -160,7 +160,8 @@ class ZTokenService {
160
160
  }
161
161
  async createToken(params) {
162
162
  const { tokenInfo } = params;
163
- const lamports = await (0, spl_token_1.getMinimumBalanceForRentExemptMint)(this.connection);
163
+ const connection = new web3_js_1.Connection(this.connection.rpcEndpoint, this.connection.commitment);
164
+ const lamports = await (0, spl_token_1.getMinimumBalanceForRentExemptMint)(connection);
164
165
  const mintKeypair = tokenInfo.mintKeypair ?? web3_js_1.Keypair.generate();
165
166
  const mint = mintKeypair.publicKey;
166
167
  const admin = anchor.translateAddress(params.admin);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zebec-network/zebec-stream-sdk",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "This is an SDK for interacting with ZEBEC Stream Program in solana",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,28 +18,27 @@
18
18
  "test:single": "ts-mocha -p ./tsconfig.json -t 1000000000"
19
19
  },
20
20
  "devDependencies": {
21
- "@solana/spl-token": "^0.4.13",
21
+ "@types/bn.js": "^5.2.0",
22
22
  "@types/mocha": "^10.0.10",
23
- "@types/node": "^24.0.15",
24
- "dotenv": "^17.2.0",
25
- "mocha": "^11.7.1",
23
+ "@types/node": "^24.3.1",
24
+ "dotenv": "^17.2.2",
25
+ "mocha": "^11.7.2",
26
26
  "prettier": "^3.6.2",
27
27
  "rimraf": "^6.0.1",
28
28
  "ts-mocha": "^11.1.0",
29
29
  "ts-node": "^10.9.2",
30
- "typescript": "^5.8.3"
30
+ "typescript": "^5.9.2"
31
31
  },
32
32
  "dependencies": {
33
33
  "@coral-xyz/anchor": "^0.31.1",
34
34
  "@metaplex-foundation/mpl-token-metadata": "^3.4.0",
35
- "@metaplex-foundation/umi": "^1.2.0",
36
- "@metaplex-foundation/umi-bundle-defaults": "^1.2.0",
37
- "@metaplex-foundation/umi-web3js-adapters": "^1.2.0",
38
- "@solana/spl-token": "^0.4.13",
39
- "@solana/web3.js": "^1.98.2",
40
- "@types/bn.js": "^5.2.0",
41
- "@zebec-network/core-utils": "^1.1.0",
42
- "@zebec-network/solana-common": "^1.5.1",
35
+ "@metaplex-foundation/umi": "^1.4.1",
36
+ "@metaplex-foundation/umi-bundle-defaults": "^1.4.1",
37
+ "@metaplex-foundation/umi-web3js-adapters": "^1.4.1",
38
+ "@solana/spl-token": "^0.4.14",
39
+ "@solana/web3.js": "^1.98.4",
40
+ "@zebec-network/core-utils": "^1.1.1",
41
+ "@zebec-network/solana-common": "^2.1.1",
43
42
  "bignumber.js": "^9.3.1"
44
43
  }
45
44
  }