@kynesyslabs/demosdk 2.10.2 → 2.11.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.
@@ -0,0 +1,338 @@
1
+ /**
2
+ * DemosTokens - SDK Utility Class for Token Operations
3
+ *
4
+ * Provides methods to create, execute, and query tokens on the Demos Network.
5
+ * Works with the Demos class for signing and broadcasting transactions.
6
+ */
7
+ import { deriveTokenAddress, validateTokenCreationParams, } from "../types/token/index.js";
8
+ /**
9
+ * Utility class for token operations on Demos Network.
10
+ */
11
+ export class DemosTokens {
12
+ constructor(demos) {
13
+ this.demos = demos;
14
+ }
15
+ // SECTION: Token Creation
16
+ /**
17
+ * Creates a token creation transaction.
18
+ *
19
+ * @param params - Token creation parameters
20
+ * @returns Unsigned transaction ready for signing
21
+ */
22
+ async createToken(params) {
23
+ // Validate parameters
24
+ const validation = validateTokenCreationParams(params);
25
+ if (!validation.valid) {
26
+ throw new Error(`Invalid token parameters: ${validation.errors.join(", ")}`);
27
+ }
28
+ const payload = {
29
+ name: params.name,
30
+ ticker: params.ticker,
31
+ decimals: params.decimals,
32
+ initialSupply: params.initialSupply,
33
+ script: params.script,
34
+ initialACL: params.initialACL?.map((entry) => ({
35
+ address: entry.address,
36
+ permissions: entry.permissions,
37
+ })),
38
+ };
39
+ // Get deployer info for address derivation preview
40
+ const deployerAddress = this.demos.getAddress();
41
+ const nonce = await this.demos.getAddressNonce(deployerAddress);
42
+ // Derive the token address (preview - actual derivation happens on-chain)
43
+ const tokenAddress = deriveTokenAddress(deployerAddress, nonce, params);
44
+ const tx = {
45
+ content: {
46
+ type: "tokenCreation",
47
+ data: ["tokenCreation", payload],
48
+ from: deployerAddress,
49
+ from_ed25519_address: await this.demos.getEd25519Address(),
50
+ to: tokenAddress, // Token's own address
51
+ amount: 0,
52
+ timestamp: 0, // Will be set during signing
53
+ nonce: nonce,
54
+ transaction_fee: {
55
+ network_fee: 0,
56
+ rpc_fee: 0,
57
+ additional_fee: 0,
58
+ },
59
+ gcr_edits: [],
60
+ },
61
+ hash: "",
62
+ signature: { type: "ed25519", data: "" },
63
+ ed25519_signature: "",
64
+ status: "pending",
65
+ blockNumber: null,
66
+ };
67
+ return tx;
68
+ }
69
+ /**
70
+ * Creates and signs a token creation transaction.
71
+ *
72
+ * @param params - Token creation parameters
73
+ * @returns Signed transaction ready for confirm/broadcast
74
+ */
75
+ async createTokenSigned(params) {
76
+ const tx = await this.createToken(params);
77
+ return this.demos.sign(tx);
78
+ }
79
+ // SECTION: Token Operations
80
+ /**
81
+ * Creates a transfer transaction.
82
+ *
83
+ * @param tokenAddress - Token contract address
84
+ * @param to - Recipient address
85
+ * @param amount - Amount to transfer (as string for bigint)
86
+ * @returns Unsigned transaction
87
+ */
88
+ async transfer(tokenAddress, to, amount) {
89
+ const args = { type: "transfer", to, amount };
90
+ return this._createExecutionTx(tokenAddress, "transfer", args);
91
+ }
92
+ /**
93
+ * Creates an approve transaction.
94
+ *
95
+ * @param tokenAddress - Token contract address
96
+ * @param spender - Spender address
97
+ * @param amount - Amount to approve (as string for bigint)
98
+ * @returns Unsigned transaction
99
+ */
100
+ async approve(tokenAddress, spender, amount) {
101
+ const args = { type: "approve", spender, amount };
102
+ return this._createExecutionTx(tokenAddress, "approve", args);
103
+ }
104
+ /**
105
+ * Creates a transferFrom transaction.
106
+ *
107
+ * @param tokenAddress - Token contract address
108
+ * @param from - Owner address
109
+ * @param to - Recipient address
110
+ * @param amount - Amount to transfer (as string for bigint)
111
+ * @returns Unsigned transaction
112
+ */
113
+ async transferFrom(tokenAddress, from, to, amount) {
114
+ const args = { type: "transferFrom", from, to, amount };
115
+ return this._createExecutionTx(tokenAddress, "transferFrom", args);
116
+ }
117
+ /**
118
+ * Creates a mint transaction.
119
+ *
120
+ * @param tokenAddress - Token contract address
121
+ * @param to - Recipient address
122
+ * @param amount - Amount to mint (as string for bigint)
123
+ * @returns Unsigned transaction
124
+ */
125
+ async mint(tokenAddress, to, amount) {
126
+ const args = { type: "mint", to, amount };
127
+ return this._createExecutionTx(tokenAddress, "mint", args);
128
+ }
129
+ /**
130
+ * Creates a burn transaction.
131
+ *
132
+ * @param tokenAddress - Token contract address
133
+ * @param from - Address to burn from
134
+ * @param amount - Amount to burn (as string for bigint)
135
+ * @returns Unsigned transaction
136
+ */
137
+ async burn(tokenAddress, from, amount) {
138
+ const args = { type: "burn", from, amount };
139
+ return this._createExecutionTx(tokenAddress, "burn", args);
140
+ }
141
+ /**
142
+ * Creates a pause transaction.
143
+ *
144
+ * @param tokenAddress - Token contract address
145
+ * @returns Unsigned transaction
146
+ */
147
+ async pause(tokenAddress) {
148
+ return this._createExecutionTx(tokenAddress, "pause", { type: "pause" });
149
+ }
150
+ /**
151
+ * Creates an unpause transaction.
152
+ *
153
+ * @param tokenAddress - Token contract address
154
+ * @returns Unsigned transaction
155
+ */
156
+ async unpause(tokenAddress) {
157
+ return this._createExecutionTx(tokenAddress, "unpause", { type: "unpause" });
158
+ }
159
+ /**
160
+ * Creates a transfer ownership transaction.
161
+ *
162
+ * @param tokenAddress - Token contract address
163
+ * @param newOwner - New owner address
164
+ * @returns Unsigned transaction
165
+ */
166
+ async transferOwnership(tokenAddress, newOwner) {
167
+ return this._createExecutionTx(tokenAddress, "transferOwnership", {
168
+ type: "transferOwnership",
169
+ newOwner,
170
+ });
171
+ }
172
+ /**
173
+ * Creates a grant permissions transaction.
174
+ *
175
+ * @param tokenAddress - Token contract address
176
+ * @param address - Address to grant permissions to
177
+ * @param permissions - Permissions to grant
178
+ * @returns Unsigned transaction
179
+ */
180
+ async grantPermissions(tokenAddress, address, permissions) {
181
+ const args = {
182
+ type: "modifyACL",
183
+ action: "grant",
184
+ address,
185
+ permissions,
186
+ };
187
+ return this._createExecutionTx(tokenAddress, "modifyACL", args);
188
+ }
189
+ /**
190
+ * Creates a revoke permissions transaction.
191
+ *
192
+ * @param tokenAddress - Token contract address
193
+ * @param address - Address to revoke permissions from
194
+ * @param permissions - Permissions to revoke
195
+ * @returns Unsigned transaction
196
+ */
197
+ async revokePermissions(tokenAddress, address, permissions) {
198
+ const args = {
199
+ type: "modifyACL",
200
+ action: "revoke",
201
+ address,
202
+ permissions,
203
+ };
204
+ return this._createExecutionTx(tokenAddress, "modifyACL", args);
205
+ }
206
+ /**
207
+ * Creates a script upgrade transaction.
208
+ *
209
+ * @param tokenAddress - Token contract address
210
+ * @param newCode - New script code
211
+ * @param newMethods - New method definitions
212
+ * @param newHooks - New hooks to activate
213
+ * @returns Unsigned transaction
214
+ */
215
+ async upgradeScript(tokenAddress, newCode, newMethods, newHooks) {
216
+ const args = {
217
+ type: "upgradeScript",
218
+ newCode,
219
+ newMethods,
220
+ newHooks,
221
+ };
222
+ return this._createExecutionTx(tokenAddress, "upgradeScript", args);
223
+ }
224
+ /**
225
+ * Calls a custom script method.
226
+ *
227
+ * @param tokenAddress - Token contract address
228
+ * @param method - Method name
229
+ * @param params - Method parameters
230
+ * @returns Unsigned transaction
231
+ */
232
+ async callMethod(tokenAddress, method, params) {
233
+ const args = { type: "custom", method, params };
234
+ return this._createExecutionTx(tokenAddress, "custom", args);
235
+ }
236
+ // SECTION: Token Queries (via nodeCall)
237
+ /**
238
+ * Gets token information.
239
+ *
240
+ * @param tokenAddress - Token contract address
241
+ * @returns Token query result
242
+ */
243
+ async getToken(tokenAddress) {
244
+ return this.demos.nodeCall("token.getToken", { tokenAddress });
245
+ }
246
+ /**
247
+ * Gets token balance for an address.
248
+ *
249
+ * @param tokenAddress - Token contract address
250
+ * @param holderAddress - Holder address
251
+ * @returns Balance result
252
+ */
253
+ async getBalance(tokenAddress, holderAddress) {
254
+ return this.demos.nodeCall("token.getBalance", { tokenAddress, holderAddress });
255
+ }
256
+ /**
257
+ * Gets allowance for spender.
258
+ *
259
+ * @param tokenAddress - Token contract address
260
+ * @param ownerAddress - Owner address
261
+ * @param spenderAddress - Spender address
262
+ * @returns Allowance amount as string
263
+ */
264
+ async getAllowance(tokenAddress, ownerAddress, spenderAddress) {
265
+ return this.demos.nodeCall("token.getAllowance", {
266
+ tokenAddress,
267
+ ownerAddress,
268
+ spenderAddress,
269
+ });
270
+ }
271
+ /**
272
+ * Gets all tokens held by an address.
273
+ *
274
+ * @param holderAddress - Holder address
275
+ * @returns Array of token references
276
+ */
277
+ async getTokensOf(holderAddress) {
278
+ return this.demos.nodeCall("token.getTokensOf", { holderAddress });
279
+ }
280
+ /**
281
+ * Calls a view function on a scripted token (read-only).
282
+ *
283
+ * @param tokenAddress - Token contract address
284
+ * @param method - Method name
285
+ * @param params - Method parameters
286
+ * @returns Method return value
287
+ */
288
+ async callView(tokenAddress, method, params) {
289
+ return this.demos.nodeCall("token.callView", { tokenAddress, method, params });
290
+ }
291
+ // SECTION: Private Helpers
292
+ /**
293
+ * Creates a token execution transaction.
294
+ */
295
+ async _createExecutionTx(tokenAddress, operation, args) {
296
+ const payload = {
297
+ tokenAddress,
298
+ operation,
299
+ args,
300
+ };
301
+ const senderAddress = this.demos.getAddress();
302
+ const nonce = await this.demos.getAddressNonce(senderAddress);
303
+ const tx = {
304
+ content: {
305
+ type: "tokenExecution",
306
+ data: ["tokenExecution", payload],
307
+ from: senderAddress,
308
+ from_ed25519_address: await this.demos.getEd25519Address(),
309
+ to: tokenAddress,
310
+ amount: 0,
311
+ timestamp: 0, // Will be set during signing
312
+ nonce: nonce,
313
+ transaction_fee: {
314
+ network_fee: 0,
315
+ rpc_fee: 0,
316
+ additional_fee: 0,
317
+ },
318
+ gcr_edits: [],
319
+ },
320
+ hash: "",
321
+ signature: { type: "ed25519", data: "" },
322
+ ed25519_signature: "",
323
+ status: "pending",
324
+ blockNumber: null,
325
+ };
326
+ return tx;
327
+ }
328
+ }
329
+ /**
330
+ * Factory function to create DemosTokens instance.
331
+ *
332
+ * @param demos - Demos instance
333
+ * @returns DemosTokens instance
334
+ */
335
+ export function createTokensClient(demos) {
336
+ return new DemosTokens(demos);
337
+ }
338
+ //# sourceMappingURL=DemosTokens.js.map
@@ -0,0 +1 @@
1
+ {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YAAY;YACZ,SAAS;YACT,IAAI;SACP,CAAA;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAA;QAC7C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,aAAa,CAAC,CAAA;QAE7D,MAAM,EAAE,GAAgB;YACpB,OAAO,EAAE;gBACL,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,CAAC,gBAAgB,EAAE,OAAO,CAAC;gBACjC,IAAI,EAAE,aAAa;gBACnB,oBAAoB,EAAE,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE;gBAC1D,EAAE,EAAE,YAAY;gBAChB,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,CAAC,EAAE,6BAA6B;gBAC3C,KAAK,EAAE,KAAK;gBACZ,eAAe,EAAE;oBACb,WAAW,EAAE,CAAC;oBACd,OAAO,EAAE,CAAC;oBACV,cAAc,EAAE,CAAC;iBACpB;gBACD,SAAS,EAAE,EAAE;aAChB;YACD,IAAI,EAAE,EAAE;YACR,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE;YACxC,iBAAiB,EAAE,EAAE;YACrB,MAAM,EAAE,SAAS;YACjB,WAAW,EAAE,IAAI;SACpB,CAAA;QAED,OAAO,EAAE,CAAA;IACb,CAAC;CACJ;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAY;IAC3C,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,CAAA;AACjC,CAAC"}
@@ -12,3 +12,4 @@ export { forgeToString, stringToForge } from "./utils/forge_converter";
12
12
  export * as skeletons from "./utils/skeletons";
13
13
  export { uint8ArrayToHex, hexToUint8Array } from "../encryption/unifiedCrypto";
14
14
  export { RubicBridge } from "./bridge";
15
+ export { DemosTokens, createTokensClient } from "./DemosTokens";
@@ -16,4 +16,6 @@ export * as skeletons from "./utils/skeletons.js";
16
16
  export { uint8ArrayToHex, hexToUint8Array } from "../encryption/unifiedCrypto.js";
17
17
  // Bridge
18
18
  export { RubicBridge } from "./bridge.js";
19
+ // REVIEW: Token operations utility class
20
+ export { DemosTokens, createTokensClient } from "./DemosTokens.js";
19
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/websdk/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,eAAe,GAClB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AACvE,QAAQ;AACR,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAA;AAE9C,2CAA2C;AAC3C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE9E,SAAS;AACT,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/websdk/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,eAAe,GAClB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AACvE,QAAQ;AACR,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAA;AAE9C,2CAA2C;AAC3C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE9E,SAAS;AACT,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEtC,yCAAyC;AACzC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kynesyslabs/demosdk",
3
- "version": "2.10.2",
3
+ "version": "2.11.0",
4
4
  "type": "module",
5
5
  "description": "Demosdk is a JavaScript/TypeScript SDK that provides a unified interface for interacting with Demos network",
6
6
  "main": "build/index.js",
@@ -74,6 +74,7 @@
74
74
  "setup:hooks": "bun run setup:pre-push && bun run setup:pre-commit",
75
75
  "test:multichain": "rm -rf build && jest --testMatch '**/tests/**/evm.spec*.ts' --testPathIgnorePatterns **/tests/**/chainProvider* **/tests/utils/* **/tests/**/template* --verbose",
76
76
  "test:tx": "rm -rf build && jest --testMatch '**/tests/multichain**/fulltx*.ts' --testPathIgnorePatterns **/tests/**/chainProvider* **/tests/utils/* **/tests/**/template* --verbose",
77
+ "test:solana": "rm -rf build && jest --testMatch '**/tests/multichain**/solana.spec*.ts' --testPathIgnorePatterns **/tests/**/chainProvider* **/tests/utils/* **/tests/**/template* --verbose",
77
78
  "test:demoswork": "rm -rf build && jest --testMatch '**/tests/**/demoswork*.ts' --testPathIgnorePatterns **/tests/**/chainProvider* **/tests/utils/* **/tests/**/template* --verbose",
78
79
  "test:identities": "rm -rf build && jest --testMatch '**/tests/**/identities.spec*.ts' --testPathIgnorePatterns **/tests/**/chainProvider* **/tests/utils/* **/tests/**/template* --verbose",
79
80
  "test:identities:pqc": "rm -rf build && jest --testMatch '**/tests/**/identities.pqc.spec*.ts' --testPathIgnorePatterns **/tests/**/chainProvider* **/tests/utils/* **/tests/**/template* --verbose",
@@ -95,6 +96,7 @@
95
96
  "dependencies": {
96
97
  "@aptos-labs/ts-sdk": "^1.39.0",
97
98
  "@bitcoinerlab/secp256k1": "^1.2.0",
99
+ "@coral-xyz/anchor": "^0.32.1",
98
100
  "@cosmjs/proto-signing": "^0.32.4",
99
101
  "@cosmjs/stargate": "^0.32.4",
100
102
  "@cryptkeeperzk/snarkjs": "^0.7.2",