permissionless 0.2.14 → 0.2.15
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/CHANGELOG.md +6 -0
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_cjs/accounts/nexus/toNexusSmartAccount.js.map +1 -1
- package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_cjs/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
- package/_cjs/accounts/trust/toTrustSmartAccount.js.map +1 -1
- package/_cjs/utils/toOwner.js.map +1 -1
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_esm/accounts/nexus/toNexusSmartAccount.js.map +1 -1
- package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_esm/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
- package/_esm/accounts/trust/toTrustSmartAccount.js.map +1 -1
- package/_esm/utils/toOwner.js.map +1 -1
- package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts +3 -2
- package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts +3 -2
- package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/light/toLightSmartAccount.d.ts +3 -2
- package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
- package/_types/accounts/nexus/toNexusSmartAccount.d.ts +3 -2
- package/_types/accounts/nexus/toNexusSmartAccount.d.ts.map +1 -1
- package/_types/accounts/safe/toSafeSmartAccount.d.ts +3 -2
- package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
- package/_types/accounts/simple/toSimpleSmartAccount.d.ts +3 -2
- package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
- package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts +3 -2
- package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts.map +1 -1
- package/_types/accounts/trust/toTrustSmartAccount.d.ts +3 -2
- package/_types/accounts/trust/toTrustSmartAccount.d.ts.map +1 -1
- package/_types/utils/toOwner.d.ts +6 -3
- package/_types/utils/toOwner.d.ts.map +1 -1
- package/accounts/biconomy/toBiconomySmartAccount.ts +2 -3
- package/accounts/kernel/toEcdsaKernelSmartAccount.ts +2 -3
- package/accounts/light/toLightSmartAccount.ts +2 -3
- package/accounts/nexus/toNexusSmartAccount.ts +2 -3
- package/accounts/safe/toSafeSmartAccount.ts +2 -2
- package/accounts/simple/toSimpleSmartAccount.ts +2 -3
- package/accounts/thirdweb/toThirdwebSmartAccount.ts +2 -3
- package/accounts/trust/toTrustSmartAccount.ts +2 -3
- package/package.json +1 -1
- package/utils/toOwner.ts +7 -12
|
@@ -4,7 +4,6 @@ import type {
|
|
|
4
4
|
Assign,
|
|
5
5
|
Chain,
|
|
6
6
|
Client,
|
|
7
|
-
EIP1193Provider,
|
|
8
7
|
LocalAccount,
|
|
9
8
|
OneOf,
|
|
10
9
|
Transport,
|
|
@@ -25,7 +24,7 @@ import {
|
|
|
25
24
|
toSmartAccount
|
|
26
25
|
} from "viem/account-abstraction"
|
|
27
26
|
import { getAction, toHex } from "viem/utils"
|
|
28
|
-
import { toOwner } from "../../utils/toOwner"
|
|
27
|
+
import { type EthereumProvider, toOwner } from "../../utils/toOwner"
|
|
29
28
|
import { encodeCallData } from "./utils/encodeCallData"
|
|
30
29
|
import { getAccountAddress } from "./utils/getAccountAddress"
|
|
31
30
|
import { getFactoryData } from "./utils/getFactoryData"
|
|
@@ -49,7 +48,7 @@ export type ToThirdwebSmartAccountParameters<
|
|
|
49
48
|
> = {
|
|
50
49
|
client: Client
|
|
51
50
|
owner: OneOf<
|
|
52
|
-
|
|
|
51
|
+
| EthereumProvider
|
|
53
52
|
| WalletClient<Transport, Chain | undefined, Account>
|
|
54
53
|
| LocalAccount
|
|
55
54
|
>
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
type Assign,
|
|
5
5
|
type Chain,
|
|
6
6
|
type Client,
|
|
7
|
-
type EIP1193Provider,
|
|
8
7
|
type Hex,
|
|
9
8
|
type LocalAccount,
|
|
10
9
|
type OneOf,
|
|
@@ -27,7 +26,7 @@ import {
|
|
|
27
26
|
} from "viem/account-abstraction"
|
|
28
27
|
import { getAction } from "viem/utils"
|
|
29
28
|
import { getSenderAddress } from "../../actions/public/getSenderAddress"
|
|
30
|
-
import { toOwner } from "../../utils/toOwner"
|
|
29
|
+
import { type EthereumProvider, toOwner } from "../../utils/toOwner"
|
|
31
30
|
import { encodeCallData } from "./utils/encodeCallData"
|
|
32
31
|
import { getFactoryData } from "./utils/getFactoryData"
|
|
33
32
|
|
|
@@ -69,7 +68,7 @@ export const TRUST_ADDRESSES: {
|
|
|
69
68
|
export type ToTrustSmartAccountParameters = {
|
|
70
69
|
client: Client
|
|
71
70
|
owner: OneOf<
|
|
72
|
-
|
|
|
71
|
+
| EthereumProvider
|
|
73
72
|
| WalletClient<Transport, Chain | undefined, Account>
|
|
74
73
|
| LocalAccount
|
|
75
74
|
>
|
package/package.json
CHANGED
package/utils/toOwner.ts
CHANGED
|
@@ -2,9 +2,6 @@ import {
|
|
|
2
2
|
type Account,
|
|
3
3
|
type Address,
|
|
4
4
|
type Chain,
|
|
5
|
-
type EIP1193Provider,
|
|
6
|
-
type EIP1193RequestFn,
|
|
7
|
-
type EIP1474Methods,
|
|
8
5
|
type LocalAccount,
|
|
9
6
|
type OneOf,
|
|
10
7
|
type Transport,
|
|
@@ -17,12 +14,14 @@ import { toAccount } from "viem/accounts"
|
|
|
17
14
|
import { signTypedData } from "viem/actions"
|
|
18
15
|
import { getAction } from "viem/utils"
|
|
19
16
|
|
|
20
|
-
export
|
|
17
|
+
export type EthereumProvider = { request(...args: any): Promise<any> }
|
|
18
|
+
|
|
19
|
+
export async function toOwner<provider extends EthereumProvider>({
|
|
21
20
|
owner,
|
|
22
21
|
address
|
|
23
22
|
}: {
|
|
24
23
|
owner: OneOf<
|
|
25
|
-
|
|
|
24
|
+
| provider
|
|
26
25
|
| WalletClient<Transport, Chain | undefined, Account>
|
|
27
26
|
| LocalAccount
|
|
28
27
|
>
|
|
@@ -39,15 +38,11 @@ export async function toOwner({
|
|
|
39
38
|
if ("request" in owner) {
|
|
40
39
|
if (!address) {
|
|
41
40
|
try {
|
|
42
|
-
;[address] = await (
|
|
43
|
-
owner.request as EIP1193RequestFn<EIP1474Methods>
|
|
44
|
-
)({
|
|
41
|
+
;[address] = await (owner as EthereumProvider).request({
|
|
45
42
|
method: "eth_requestAccounts"
|
|
46
43
|
})
|
|
47
44
|
} catch {
|
|
48
|
-
;[address] = await (
|
|
49
|
-
owner.request as EIP1193RequestFn<EIP1474Methods>
|
|
50
|
-
)({
|
|
45
|
+
;[address] = await (owner as EthereumProvider).request({
|
|
51
46
|
method: "eth_accounts"
|
|
52
47
|
})
|
|
53
48
|
}
|
|
@@ -58,7 +53,7 @@ export async function toOwner({
|
|
|
58
53
|
}
|
|
59
54
|
walletClient = createWalletClient({
|
|
60
55
|
account: address,
|
|
61
|
-
transport: custom(owner as
|
|
56
|
+
transport: custom(owner as EthereumProvider)
|
|
62
57
|
})
|
|
63
58
|
}
|
|
64
59
|
|