Coinbase Smart Wallet: Ability to set ownerIndex #2851
-
When interacting with Coinbase Smart Wallet accounts, the I propose adding diff --git a/src/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts b/src/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts
index b65ff68..d81565e 100644
--- a/src/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts
+++ b/src/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts
@@ -35,6 +35,7 @@ import type {
export type ToCoinbaseSmartAccountParameters = {
address?: Address | undefined
client: Client
+ signatureOwnerIndex?: number | undefined
owners: readonly OneOf<LocalAccount | WebAuthnAccount>[]
nonce?: bigint | undefined
}
@@ -74,7 +75,7 @@ export type CoinbaseSmartAccountImplementation = Assign<
export async function toCoinbaseSmartAccount(
parameters: ToCoinbaseSmartAccountParameters,
): Promise<ToCoinbaseSmartAccountReturnType> {
- const { client, owners, nonce = 0n } = parameters
+ const { client, owners, nonce = 0n, signatureOwnerIndex = 0 } = parameters
let address = parameters.address
@@ -179,6 +180,7 @@ export async function toCoinbaseSmartAccount(
return wrapSignature({
signature,
+ ownerIndex: signatureOwnerIndex
})
},
@@ -196,6 +198,7 @@ export async function toCoinbaseSmartAccount(
return wrapSignature({
signature,
+ ownerIndex: signatureOwnerIndex,
})
},
@@ -219,6 +222,7 @@ export async function toCoinbaseSmartAccount(
return wrapSignature({
signature,
+ ownerIndex: signatureOwnerIndex,
})
},
@@ -240,6 +244,7 @@ export async function toCoinbaseSmartAccount(
return wrapSignature({
signature,
+ ownerIndex: signatureOwnerIndex,
})
},
Alternatively you could add an diff --git a/src/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts b/src/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts
index b65ff68..934ca9f 100644
--- a/src/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts
+++ b/src/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts
@@ -35,7 +35,7 @@ import type {
export type ToCoinbaseSmartAccountParameters = {
address?: Address | undefined
client: Client
- owners: readonly OneOf<LocalAccount | WebAuthnAccount>[]
+ owners: readonly (OneOf<LocalAccount | WebAuthnAccount> & { index?: number | undefined })[]
nonce?: bigint | undefined
}
@@ -179,6 +179,7 @@ export async function toCoinbaseSmartAccount(
return wrapSignature({
signature,
+ ownerIndex: owner.index
})
},
@@ -196,6 +197,7 @@ export async function toCoinbaseSmartAccount(
return wrapSignature({
signature,
+ ownerIndex: owner.index
})
},
@@ -219,6 +221,7 @@ export async function toCoinbaseSmartAccount(
return wrapSignature({
signature,
+ ownerIndex: owner.index,
})
},
@@ -240,6 +243,7 @@ export async function toCoinbaseSmartAccount(
return wrapSignature({
signature,
+ ownerIndex: owner.index,
})
},
The second method may require the introduction of a If you provide an incomplete set of owner accounts, the automatically generated Please let me know what you think. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Think the first snippet should be fine – maybe just an |
Beta Was this translation helpful? Give feedback.
Think the first snippet should be fine – maybe just an
ownerIndex
parameter ontoCoinbaseSmartAccount
. Open to a PR!