@dynamic-labs-wallet/sui 0.0.73 → 0.0.75-preview
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.js +11 -12
- package/index.esm.js +11 -12
- package/package.json +2 -2
- package/src/client/client.d.ts +3 -4
- package/src/client/client.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -82,8 +82,7 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
82
82
|
return {
|
|
83
83
|
accountAddress,
|
|
84
84
|
rawPublicKey,
|
|
85
|
-
publicKeyHex
|
|
86
|
-
clientKeyShares
|
|
85
|
+
publicKeyHex
|
|
87
86
|
};
|
|
88
87
|
} catch (error) {
|
|
89
88
|
this.logger.error(ERROR_CREATE_WALLET_ACCOUNT, error);
|
|
@@ -139,11 +138,11 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
139
138
|
throw error;
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
|
-
async verifyTransactionSignature({
|
|
141
|
+
async verifyTransactionSignature({ transaction, signature, senderAddress }) {
|
|
143
142
|
try {
|
|
144
|
-
const txBytes = Uint8Array.from(Buffer.from(
|
|
143
|
+
const txBytes = Uint8Array.from(Buffer.from(transaction, 'hex'));
|
|
145
144
|
const verifiedPublicKey = await verify.verifyTransactionSignature(txBytes, signature);
|
|
146
|
-
const isVerified = verifiedPublicKey.toSuiAddress().toLowerCase() ===
|
|
145
|
+
const isVerified = verifiedPublicKey.toSuiAddress().toLowerCase() === senderAddress.toLowerCase();
|
|
147
146
|
if (!isVerified) {
|
|
148
147
|
throw new Error(ERROR_VERIFY_TRANSACTION_SIGNATURE);
|
|
149
148
|
}
|
|
@@ -176,23 +175,23 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
176
175
|
throw error;
|
|
177
176
|
}
|
|
178
177
|
}
|
|
179
|
-
async signTransaction({
|
|
180
|
-
if (!
|
|
178
|
+
async signTransaction({ transaction, senderAddress, password = undefined }) {
|
|
179
|
+
if (!senderAddress) {
|
|
181
180
|
throw new Error('Account address is required');
|
|
182
181
|
}
|
|
183
182
|
try {
|
|
184
|
-
const formattedMessage = formatMessage(
|
|
183
|
+
const formattedMessage = formatMessage(transaction, 'TransactionData');
|
|
185
184
|
const signatureEd25519 = await this.sign({
|
|
186
185
|
message: formattedMessage,
|
|
187
|
-
accountAddress:
|
|
186
|
+
accountAddress: senderAddress,
|
|
188
187
|
chainName: this.chainName,
|
|
189
188
|
password
|
|
190
189
|
});
|
|
191
|
-
const formattedSignature = await this.formatSignature(signatureEd25519,
|
|
190
|
+
const formattedSignature = await this.formatSignature(signatureEd25519, senderAddress);
|
|
192
191
|
await this.verifyTransactionSignature({
|
|
193
|
-
|
|
192
|
+
transaction,
|
|
194
193
|
signature: formattedSignature,
|
|
195
|
-
|
|
194
|
+
senderAddress
|
|
196
195
|
});
|
|
197
196
|
return formattedSignature;
|
|
198
197
|
} catch (error) {
|
package/index.esm.js
CHANGED
|
@@ -80,8 +80,7 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
80
80
|
return {
|
|
81
81
|
accountAddress,
|
|
82
82
|
rawPublicKey,
|
|
83
|
-
publicKeyHex
|
|
84
|
-
clientKeyShares
|
|
83
|
+
publicKeyHex
|
|
85
84
|
};
|
|
86
85
|
} catch (error) {
|
|
87
86
|
this.logger.error(ERROR_CREATE_WALLET_ACCOUNT, error);
|
|
@@ -137,11 +136,11 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
137
136
|
throw error;
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
|
-
async verifyTransactionSignature({
|
|
139
|
+
async verifyTransactionSignature({ transaction, signature, senderAddress }) {
|
|
141
140
|
try {
|
|
142
|
-
const txBytes = Uint8Array.from(Buffer.from(
|
|
141
|
+
const txBytes = Uint8Array.from(Buffer.from(transaction, 'hex'));
|
|
143
142
|
const verifiedPublicKey = await verifyTransactionSignature(txBytes, signature);
|
|
144
|
-
const isVerified = verifiedPublicKey.toSuiAddress().toLowerCase() ===
|
|
143
|
+
const isVerified = verifiedPublicKey.toSuiAddress().toLowerCase() === senderAddress.toLowerCase();
|
|
145
144
|
if (!isVerified) {
|
|
146
145
|
throw new Error(ERROR_VERIFY_TRANSACTION_SIGNATURE);
|
|
147
146
|
}
|
|
@@ -174,23 +173,23 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
174
173
|
throw error;
|
|
175
174
|
}
|
|
176
175
|
}
|
|
177
|
-
async signTransaction({
|
|
178
|
-
if (!
|
|
176
|
+
async signTransaction({ transaction, senderAddress, password = undefined }) {
|
|
177
|
+
if (!senderAddress) {
|
|
179
178
|
throw new Error('Account address is required');
|
|
180
179
|
}
|
|
181
180
|
try {
|
|
182
|
-
const formattedMessage = formatMessage(
|
|
181
|
+
const formattedMessage = formatMessage(transaction, 'TransactionData');
|
|
183
182
|
const signatureEd25519 = await this.sign({
|
|
184
183
|
message: formattedMessage,
|
|
185
|
-
accountAddress:
|
|
184
|
+
accountAddress: senderAddress,
|
|
186
185
|
chainName: this.chainName,
|
|
187
186
|
password
|
|
188
187
|
});
|
|
189
|
-
const formattedSignature = await this.formatSignature(signatureEd25519,
|
|
188
|
+
const formattedSignature = await this.formatSignature(signatureEd25519, senderAddress);
|
|
190
189
|
await this.verifyTransactionSignature({
|
|
191
|
-
|
|
190
|
+
transaction,
|
|
192
191
|
signature: formattedSignature,
|
|
193
|
-
|
|
192
|
+
senderAddress
|
|
194
193
|
});
|
|
195
194
|
return formattedSignature;
|
|
196
195
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/sui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.75-preview",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dynamic-labs-wallet/browser": "0.0.
|
|
6
|
+
"@dynamic-labs-wallet/browser": "0.0.75-preview",
|
|
7
7
|
"@mysten/sui": "1.26.0",
|
|
8
8
|
"@noble/hashes": "1.7.1"
|
|
9
9
|
},
|
package/src/client/client.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export declare class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
10
10
|
accountAddress: string;
|
|
11
11
|
publicKeyHex: string;
|
|
12
12
|
rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
|
|
13
|
-
clientKeyShares: ClientKeyShare[];
|
|
14
13
|
}>;
|
|
15
14
|
getRawPublicKeyFromClientKeyShares({ chainName, clientKeyShare, }: {
|
|
16
15
|
chainName: string;
|
|
@@ -27,9 +26,9 @@ export declare class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
27
26
|
accountAddress: string;
|
|
28
27
|
password?: string;
|
|
29
28
|
}): Promise<string>;
|
|
30
|
-
signTransaction({
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
signTransaction({ transaction, senderAddress, password, }: {
|
|
30
|
+
transaction: string;
|
|
31
|
+
senderAddress: string;
|
|
33
32
|
password?: string;
|
|
34
33
|
}): Promise<string>;
|
|
35
34
|
deriveAccountAddress({ rawPublicKey }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,wBAAwB,EACxB,wBAAwB,EAGzB,MAAM,8BAA8B,CAAC;AAetC,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;gBAEf,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,UAAU,EACV,KAAK,GACN,EAAE,wBAAwB;IAWrB,mBAAmB,CAAC,EACxB,wBAAwB,EACxB,QAAoB,EACpB,OAAO,GACR,EAAE;QACD,wBAAwB,EAAE,wBAAwB,CAAC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