@dynamic-labs-wallet/sui 0.0.68 → 0.0.70
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 +25 -18
- package/index.esm.js +25 -18
- package/package.json +2 -2
- package/src/client/client.d.ts +2 -2
- package/src/client/client.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -103,22 +103,28 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
103
103
|
/**
|
|
104
104
|
* Format Ed25519 signature to string that satisfies Sui signature standard
|
|
105
105
|
*/ async formatSignature(signatureEd25519, accountAddress) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
106
|
+
try {
|
|
107
|
+
// get public key from keyshare
|
|
108
|
+
// TODO: handle this more gracefully from the client key shares if possible
|
|
109
|
+
const clientKeyShares = await this.getClientKeySharesFromLocalStorage({
|
|
110
|
+
accountAddress
|
|
111
|
+
});
|
|
112
|
+
const rawPublicKey = await this.getRawPublicKeyFromClientKeyShares({
|
|
113
|
+
chainName: this.chainName,
|
|
114
|
+
clientKeyShare: clientKeyShares[0]
|
|
115
|
+
});
|
|
116
|
+
const rawPublicKeyBytes = Uint8Array.from(Buffer.from(rawPublicKey, 'hex'));
|
|
117
|
+
const suiPublicKey = new ed25519.Ed25519PublicKey(rawPublicKeyBytes);
|
|
118
|
+
const serializedSignature = cryptography.toSerializedSignature({
|
|
119
|
+
signature: signatureEd25519,
|
|
120
|
+
signatureScheme: 'ED25519',
|
|
121
|
+
publicKey: suiPublicKey
|
|
122
|
+
});
|
|
123
|
+
return serializedSignature;
|
|
124
|
+
} catch (error) {
|
|
125
|
+
this.logger.error('Error formatting signature:', error);
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
122
128
|
}
|
|
123
129
|
async verifyMessageSignature({ message, signature, accountAddress }) {
|
|
124
130
|
try {
|
|
@@ -195,11 +201,12 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
195
201
|
}
|
|
196
202
|
}
|
|
197
203
|
deriveAccountAddress({ rawPublicKey }) {
|
|
198
|
-
const
|
|
204
|
+
const pubKeyBytes = Buffer.from(rawPublicKey, 'hex');
|
|
205
|
+
const publicKey = new ed25519.Ed25519PublicKey(pubKeyBytes);
|
|
199
206
|
const accountAddress = publicKey.toSuiAddress();
|
|
200
207
|
return {
|
|
201
208
|
accountAddress,
|
|
202
|
-
publicKeyHex:
|
|
209
|
+
publicKeyHex: rawPublicKey
|
|
203
210
|
};
|
|
204
211
|
}
|
|
205
212
|
async getSuiWallets() {
|
package/index.esm.js
CHANGED
|
@@ -101,22 +101,28 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
101
101
|
/**
|
|
102
102
|
* Format Ed25519 signature to string that satisfies Sui signature standard
|
|
103
103
|
*/ async formatSignature(signatureEd25519, accountAddress) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
104
|
+
try {
|
|
105
|
+
// get public key from keyshare
|
|
106
|
+
// TODO: handle this more gracefully from the client key shares if possible
|
|
107
|
+
const clientKeyShares = await this.getClientKeySharesFromLocalStorage({
|
|
108
|
+
accountAddress
|
|
109
|
+
});
|
|
110
|
+
const rawPublicKey = await this.getRawPublicKeyFromClientKeyShares({
|
|
111
|
+
chainName: this.chainName,
|
|
112
|
+
clientKeyShare: clientKeyShares[0]
|
|
113
|
+
});
|
|
114
|
+
const rawPublicKeyBytes = Uint8Array.from(Buffer.from(rawPublicKey, 'hex'));
|
|
115
|
+
const suiPublicKey = new Ed25519PublicKey(rawPublicKeyBytes);
|
|
116
|
+
const serializedSignature = toSerializedSignature({
|
|
117
|
+
signature: signatureEd25519,
|
|
118
|
+
signatureScheme: 'ED25519',
|
|
119
|
+
publicKey: suiPublicKey
|
|
120
|
+
});
|
|
121
|
+
return serializedSignature;
|
|
122
|
+
} catch (error) {
|
|
123
|
+
this.logger.error('Error formatting signature:', error);
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
120
126
|
}
|
|
121
127
|
async verifyMessageSignature({ message, signature, accountAddress }) {
|
|
122
128
|
try {
|
|
@@ -193,11 +199,12 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
193
199
|
}
|
|
194
200
|
}
|
|
195
201
|
deriveAccountAddress({ rawPublicKey }) {
|
|
196
|
-
const
|
|
202
|
+
const pubKeyBytes = Buffer.from(rawPublicKey, 'hex');
|
|
203
|
+
const publicKey = new Ed25519PublicKey(pubKeyBytes);
|
|
197
204
|
const accountAddress = publicKey.toSuiAddress();
|
|
198
205
|
return {
|
|
199
206
|
accountAddress,
|
|
200
|
-
publicKeyHex:
|
|
207
|
+
publicKeyHex: rawPublicKey
|
|
201
208
|
};
|
|
202
209
|
}
|
|
203
210
|
async getSuiWallets() {
|
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.70",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dynamic-labs-wallet/browser": "0.0.
|
|
6
|
+
"@dynamic-labs-wallet/browser": "0.0.70",
|
|
7
7
|
"@mysten/sui": "1.26.0",
|
|
8
8
|
"@noble/hashes": "1.7.1"
|
|
9
9
|
},
|
package/src/client/client.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
9
9
|
}): Promise<{
|
|
10
10
|
accountAddress: string;
|
|
11
11
|
publicKeyHex: string;
|
|
12
|
-
rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
|
|
12
|
+
rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
|
|
13
13
|
clientKeyShares: ClientKeyShare[];
|
|
14
14
|
}>;
|
|
15
15
|
getRawPublicKeyFromClientKeyShares({ chainName, clientKeyShare, }: {
|
|
@@ -33,7 +33,7 @@ export declare class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
33
33
|
password?: string;
|
|
34
34
|
}): Promise<string>;
|
|
35
35
|
deriveAccountAddress({ rawPublicKey }: {
|
|
36
|
-
rawPublicKey:
|
|
36
|
+
rawPublicKey: string;
|
|
37
37
|
}): {
|
|
38
38
|
accountAddress: string;
|
|
39
39
|
publicKeyHex: string;
|
|
@@ -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;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KAClC,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,cAAc,GAAG,UAAU,GAAG,SA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