@dfns/lib-viem 0.4.0 → 0.4.2
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.d.ts +5 -6
- package/index.js +2 -2
- package/package.json +6 -6
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DfnsApiClient } from '@dfns/sdk';
|
|
2
2
|
import { Address, GetTransactionType, Hash, SerializeTransactionFn, SignableMessage, TransactionSerializable, TransactionSerialized, TypedData, TypedDataDefinition } from 'viem';
|
|
3
|
+
import { IsNarrowable } from 'viem/_types/types/utils';
|
|
3
4
|
export type DfnsWalletOptions = {
|
|
4
5
|
walletId: string;
|
|
5
6
|
dfnsClient: DfnsApiClient;
|
|
@@ -18,10 +19,8 @@ export declare class DfnsWallet {
|
|
|
18
19
|
signMessage({ message }: {
|
|
19
20
|
message: SignableMessage;
|
|
20
21
|
}): Promise<Hash>;
|
|
21
|
-
signTransaction<
|
|
22
|
-
serializer?:
|
|
23
|
-
}): Promise<TransactionSerialized<GetTransactionType<
|
|
24
|
-
signTypedData<const
|
|
25
|
-
[key: string]: unknown;
|
|
26
|
-
}, TPrimaryType extends string = string>(typedData: TypedDataDefinition<TTypedData, TPrimaryType>): Promise<Hash>;
|
|
22
|
+
signTransaction<serializer extends SerializeTransactionFn<TransactionSerializable> = SerializeTransactionFn<TransactionSerializable>, transaction extends Parameters<serializer>[0] = Parameters<serializer>[0]>(transaction: transaction, args?: {
|
|
23
|
+
serializer?: serializer | undefined;
|
|
24
|
+
} | undefined): Promise<IsNarrowable<TransactionSerialized<GetTransactionType<transaction>>, Hash> extends true ? TransactionSerialized<GetTransactionType<transaction>> : Hash>;
|
|
25
|
+
signTypedData<const typedData extends TypedData | Record<string, unknown>, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData>(typedDataDefinition: TypedDataDefinition<typedData, primaryType>): Promise<Hash>;
|
|
27
26
|
}
|
package/index.js
CHANGED
|
@@ -101,8 +101,8 @@ class DfnsWallet {
|
|
|
101
101
|
return serializer(transaction, signature);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
async signTypedData(
|
|
105
|
-
const hash = (0, viem_1.hashTypedData)(
|
|
104
|
+
async signTypedData(typedDataDefinition) {
|
|
105
|
+
const hash = (0, viem_1.hashTypedData)(typedDataDefinition);
|
|
106
106
|
const signature = await this.signHash(hash);
|
|
107
107
|
return (0, viem_1.signatureToHex)(signature);
|
|
108
108
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dfns/lib-viem",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"viem": "^2.0.0",
|
|
6
|
+
"@dfns/sdk": "0.4.2"
|
|
7
|
+
},
|
|
4
8
|
"dependencies": {
|
|
5
9
|
"buffer": "6.0.3",
|
|
6
10
|
"cross-fetch": "3.1.6",
|
|
7
|
-
"uuid": "9.0.0"
|
|
8
|
-
"viem": "1.21.4"
|
|
9
|
-
},
|
|
10
|
-
"peerDependencies": {
|
|
11
|
-
"@dfns/sdk": "0.4.0"
|
|
11
|
+
"uuid": "9.0.0"
|
|
12
12
|
},
|
|
13
13
|
"main": "./index.js",
|
|
14
14
|
"type": "commonjs"
|