@dynamic-labs-wallet/node-svm 1.0.115 → 1.0.116

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/index.cjs CHANGED
@@ -300,13 +300,16 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
300
300
  * @param message The pre-formatted hex message to sign
301
301
  * @param walletMetadata Wallet metadata (the full object returned by createWalletAccount/importPrivateKey, with backupInfo merged from any subsequent updatePassword/refresh/reshare)
302
302
  * @param password The password for encrypted backup shares
303
- */ async signRawMessage({ message, walletMetadata, password = undefined, externalServerKeyShares, context }) {
303
+ * @param rawSign Pre-image the digest is derived from, used to build the policy context
304
+ * @param context Explicit policy context, when the caller builds one itself
305
+ */ async signRawMessage({ message, walletMetadata, password = undefined, externalServerKeyShares, context, rawSign }) {
304
306
  const { accountAddress } = walletMetadata;
305
307
  if (!accountAddress) {
306
308
  throw new Error('Account address is required');
307
309
  }
308
310
  try {
309
311
  const messageHex = node.stripHexPrefix(message);
312
+ const resolvedContext = node.resolveRawSignContext(context, rawSign);
310
313
  const signatureEd25519 = await this.sign({
311
314
  message: messageHex,
312
315
  accountAddress,
@@ -315,7 +318,7 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
315
318
  externalServerKeyShares,
316
319
  isFormatted: true,
317
320
  walletMetadata,
318
- context
321
+ context: resolvedContext
319
322
  });
320
323
  return encodeBase58(signatureEd25519);
321
324
  } catch (error) {
@@ -823,34 +826,30 @@ const delegatedSignTransaction = async (client, { walletId, shareSetId, walletAp
823
826
  * @param options.walletApiKey - The wallet API key
824
827
  * @param options.keyShare - The server key share
825
828
  * @param options.message - Hex string of the already-hashed data to sign
829
+ * @param options.rawSign - Pre-image the digest is derived from, used to build the policy context
830
+ * @param options.context - Explicit policy context, when the caller builds one itself
826
831
  *
827
832
  * @returns The base58-encoded signature
828
833
  *
829
834
  * @example
830
- * // Sign a pre-hashed message
831
- * const signature = await delegatedSignRawMessage(client, {
832
- * walletId,
833
- * walletApiKey,
834
- * keyShare,
835
- * message: preHashedHex, // hex string of already-hashed data
836
- * });
837
- *
838
- * @example
839
835
  * // Sign a SHA-256 hash derived from arbitrary application data
840
836
  * import { createHash } from 'crypto';
841
- * const hash = createHash('sha256').update('my application data').digest('hex');
837
+ * const payload = Buffer.from('my application data', 'utf8').toString('hex');
838
+ * const hash = createHash('sha256').update(Buffer.from(payload, 'hex')).digest('hex');
842
839
  * const signature = await delegatedSignRawMessage(client, {
843
840
  * walletId,
844
841
  * walletApiKey,
845
842
  * keyShare,
846
843
  * message: hash,
844
+ * rawSign: { hashFunction: SignMessageRawSignHashFunctionEnum.Sha256, payload },
847
845
  * });
848
846
  *
849
- */ const delegatedSignRawMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context })=>{
847
+ */ const delegatedSignRawMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, rawSign })=>{
850
848
  if (!keyShare || !walletId || !walletApiKey) {
851
849
  throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a raw message');
852
850
  }
853
851
  try {
852
+ const resolvedContext = node.resolveRawSignContext(context, rawSign);
854
853
  return await delegatedSignMessage(client, {
855
854
  walletId,
856
855
  shareSetId,
@@ -859,7 +858,7 @@ const delegatedSignTransaction = async (client, { walletId, shareSetId, walletAp
859
858
  message: node.stripHexPrefix(message),
860
859
  derivationPath,
861
860
  isFormatted: true,
862
- context
861
+ context: resolvedContext
863
862
  });
864
863
  } catch (error) {
865
864
  logError({
package/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { SOLANA_RPC_URL, createLogError, DynamicWalletClient, getMPCChainConfig, stripHexPrefix, WalletOperation, createDelegatedWalletClient, delegatedSignMessage as delegatedSignMessage$1, withDelegatedServerAuth, revokeDelegation as revokeDelegation$1 } from '@dynamic-labs-wallet/node';
1
+ import { SOLANA_RPC_URL, createLogError, DynamicWalletClient, getMPCChainConfig, stripHexPrefix, resolveRawSignContext, WalletOperation, createDelegatedWalletClient, delegatedSignMessage as delegatedSignMessage$1, withDelegatedServerAuth, revokeDelegation as revokeDelegation$1 } from '@dynamic-labs-wallet/node';
2
2
  import { PublicKey, Connection, Transaction, SystemProgram, VersionedTransaction, Keypair } from '@solana/web3.js';
3
3
 
4
4
  function _extends() {
@@ -298,13 +298,16 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
298
298
  * @param message The pre-formatted hex message to sign
299
299
  * @param walletMetadata Wallet metadata (the full object returned by createWalletAccount/importPrivateKey, with backupInfo merged from any subsequent updatePassword/refresh/reshare)
300
300
  * @param password The password for encrypted backup shares
301
- */ async signRawMessage({ message, walletMetadata, password = undefined, externalServerKeyShares, context }) {
301
+ * @param rawSign Pre-image the digest is derived from, used to build the policy context
302
+ * @param context Explicit policy context, when the caller builds one itself
303
+ */ async signRawMessage({ message, walletMetadata, password = undefined, externalServerKeyShares, context, rawSign }) {
302
304
  const { accountAddress } = walletMetadata;
303
305
  if (!accountAddress) {
304
306
  throw new Error('Account address is required');
305
307
  }
306
308
  try {
307
309
  const messageHex = stripHexPrefix(message);
310
+ const resolvedContext = resolveRawSignContext(context, rawSign);
308
311
  const signatureEd25519 = await this.sign({
309
312
  message: messageHex,
310
313
  accountAddress,
@@ -313,7 +316,7 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
313
316
  externalServerKeyShares,
314
317
  isFormatted: true,
315
318
  walletMetadata,
316
- context
319
+ context: resolvedContext
317
320
  });
318
321
  return encodeBase58(signatureEd25519);
319
322
  } catch (error) {
@@ -821,34 +824,30 @@ const delegatedSignTransaction = async (client, { walletId, shareSetId, walletAp
821
824
  * @param options.walletApiKey - The wallet API key
822
825
  * @param options.keyShare - The server key share
823
826
  * @param options.message - Hex string of the already-hashed data to sign
827
+ * @param options.rawSign - Pre-image the digest is derived from, used to build the policy context
828
+ * @param options.context - Explicit policy context, when the caller builds one itself
824
829
  *
825
830
  * @returns The base58-encoded signature
826
831
  *
827
832
  * @example
828
- * // Sign a pre-hashed message
829
- * const signature = await delegatedSignRawMessage(client, {
830
- * walletId,
831
- * walletApiKey,
832
- * keyShare,
833
- * message: preHashedHex, // hex string of already-hashed data
834
- * });
835
- *
836
- * @example
837
833
  * // Sign a SHA-256 hash derived from arbitrary application data
838
834
  * import { createHash } from 'crypto';
839
- * const hash = createHash('sha256').update('my application data').digest('hex');
835
+ * const payload = Buffer.from('my application data', 'utf8').toString('hex');
836
+ * const hash = createHash('sha256').update(Buffer.from(payload, 'hex')).digest('hex');
840
837
  * const signature = await delegatedSignRawMessage(client, {
841
838
  * walletId,
842
839
  * walletApiKey,
843
840
  * keyShare,
844
841
  * message: hash,
842
+ * rawSign: { hashFunction: SignMessageRawSignHashFunctionEnum.Sha256, payload },
845
843
  * });
846
844
  *
847
- */ const delegatedSignRawMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context })=>{
845
+ */ const delegatedSignRawMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, rawSign })=>{
848
846
  if (!keyShare || !walletId || !walletApiKey) {
849
847
  throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a raw message');
850
848
  }
851
849
  try {
850
+ const resolvedContext = resolveRawSignContext(context, rawSign);
852
851
  return await delegatedSignMessage(client, {
853
852
  walletId,
854
853
  shareSetId,
@@ -857,7 +856,7 @@ const delegatedSignTransaction = async (client, { walletId, shareSetId, walletAp
857
856
  message: stripHexPrefix(message),
858
857
  derivationPath,
859
858
  isFormatted: true,
860
- context
859
+ context: resolvedContext
861
860
  });
862
861
  } catch (error) {
863
862
  logError({
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/node-svm",
3
- "version": "1.0.115",
3
+ "version": "1.0.116",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@dynamic-labs-wallet/node": "1.0.115",
7
+ "@dynamic-labs-wallet/node": "1.0.116",
8
8
  "@solana/web3.js": "^1.98.2"
9
9
  },
10
10
  "publishConfig": {
@@ -1,4 +1,4 @@
1
- import { type ServerKeyShare, DynamicWalletClient, type Ed25519KeygenResult, type ThresholdSignatureScheme, type TraceContext, type DynamicWalletClientProps, type WalletMetadata } from '@dynamic-labs-wallet/node';
1
+ import { type ServerKeyShare, DynamicWalletClient, type Ed25519KeygenResult, type ThresholdSignatureScheme, type TraceContext, type DynamicWalletClientProps, type WalletMetadata, type RawSignPreImage } from '@dynamic-labs-wallet/node';
2
2
  import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
3
3
  import { type Transaction, VersionedTransaction } from '@solana/web3.js';
4
4
  type SvmSignableTransaction = VersionedTransaction | Transaction | string;
@@ -56,13 +56,16 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
56
56
  * @param message The pre-formatted hex message to sign
57
57
  * @param walletMetadata Wallet metadata (the full object returned by createWalletAccount/importPrivateKey, with backupInfo merged from any subsequent updatePassword/refresh/reshare)
58
58
  * @param password The password for encrypted backup shares
59
+ * @param rawSign Pre-image the digest is derived from, used to build the policy context
60
+ * @param context Explicit policy context, when the caller builds one itself
59
61
  */
60
- signRawMessage({ message, walletMetadata, password, externalServerKeyShares, context, }: {
62
+ signRawMessage({ message, walletMetadata, password, externalServerKeyShares, context, rawSign, }: {
61
63
  message: string;
62
64
  walletMetadata: WalletMetadata;
63
65
  password?: string;
64
66
  externalServerKeyShares?: ServerKeyShare[];
65
67
  context?: SignMessageContext;
68
+ rawSign?: RawSignPreImage;
66
69
  }): Promise<string>;
67
70
  signTransaction({ walletMetadata, transaction, password, externalServerKeyShares, sponsor, chainId, context, }: {
68
71
  walletMetadata: WalletMetadata;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAGjB,KAAK,wBAAwB,EAC7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OAcG;IACG,kBAAkB,CAAC,EACvB,WAAW,EACX,YAAY,GACb,EAAE;QACD,WAAW,EAAE,oBAAoB,GAAG,WAAW,CAAC;QAChD,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAoBjC,wEAAwE;IAClE,aAAa;;;;;;;;;CAOpB"}
@@ -1,4 +1,4 @@
1
- import type { DelegatedWalletClient, ServerKeyShare, TraceContext } from '@dynamic-labs-wallet/node';
1
+ import type { DelegatedWalletClient, RawSignPreImage, ServerKeyShare, TraceContext } from '@dynamic-labs-wallet/node';
2
2
  import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
3
3
  import type { Transaction } from '@solana/web3.js';
4
4
  import { VersionedTransaction } from '@solana/web3.js';
@@ -75,31 +75,26 @@ export declare const delegatedSignTransaction: (client: DelegatedSvmWalletClient
75
75
  * @param options.walletApiKey - The wallet API key
76
76
  * @param options.keyShare - The server key share
77
77
  * @param options.message - Hex string of the already-hashed data to sign
78
+ * @param options.rawSign - Pre-image the digest is derived from, used to build the policy context
79
+ * @param options.context - Explicit policy context, when the caller builds one itself
78
80
  *
79
81
  * @returns The base58-encoded signature
80
82
  *
81
83
  * @example
82
- * // Sign a pre-hashed message
83
- * const signature = await delegatedSignRawMessage(client, {
84
- * walletId,
85
- * walletApiKey,
86
- * keyShare,
87
- * message: preHashedHex, // hex string of already-hashed data
88
- * });
89
- *
90
- * @example
91
84
  * // Sign a SHA-256 hash derived from arbitrary application data
92
85
  * import { createHash } from 'crypto';
93
- * const hash = createHash('sha256').update('my application data').digest('hex');
86
+ * const payload = Buffer.from('my application data', 'utf8').toString('hex');
87
+ * const hash = createHash('sha256').update(Buffer.from(payload, 'hex')).digest('hex');
94
88
  * const signature = await delegatedSignRawMessage(client, {
95
89
  * walletId,
96
90
  * walletApiKey,
97
91
  * keyShare,
98
92
  * message: hash,
93
+ * rawSign: { hashFunction: SignMessageRawSignHashFunctionEnum.Sha256, payload },
99
94
  * });
100
95
  *
101
96
  */
102
- export declare const delegatedSignRawMessage: (client: DelegatedSvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, }: {
97
+ export declare const delegatedSignRawMessage: (client: DelegatedSvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, rawSign, }: {
103
98
  walletId: string;
104
99
  /**
105
100
  * Optional. The `shareSetId` from the `wallet.delegation.created`
@@ -114,6 +109,7 @@ export declare const delegatedSignRawMessage: (client: DelegatedSvmWalletClient,
114
109
  message: string;
115
110
  derivationPath?: Uint32Array;
116
111
  context?: SignMessageContext;
112
+ rawSign?: RawSignPreImage;
117
113
  }) => Promise<string>;
118
114
  /**
119
115
  * Revoke delegation - delegates to the node package
@@ -1 +1 @@
1
- {"version":3,"file":"delegatedClient.d.ts","sourceRoot":"","sources":["../../packages/src/delegatedClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AASrG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAa,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAMlE,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,qBAAqB,GAAG;IAC7D,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B,sEAMxC,wBAAwB,KAAG,wBAU7B,CAAC;AAEF;;GAEG;AACH,eAAO,M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