-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add alchemy transport update for the mav2 account client
- Loading branch information
Showing
9 changed files
with
180 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
account-kit/smart-contracts/src/ma-v2/client/client.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { | ||
erc7677Middleware, | ||
LocalAccountSigner, | ||
type SmartAccountSigner, | ||
} from "@aa-sdk/core"; | ||
import { custom } from "viem"; | ||
import { createSMAV2AccountClient } from "@account-kit/smart-contracts/experimental"; | ||
import { local070Instance } from "~test/instances.js"; | ||
import { accounts } from "~test/constants.js"; | ||
import { alchemy } from "@account-kit/infra"; | ||
|
||
// TODO: Include a snapshot to reset to in afterEach. | ||
describe("MA v2 Tests: Types", async () => { | ||
const instance = local070Instance; | ||
|
||
const signer: SmartAccountSigner = new LocalAccountSigner( | ||
accounts.fundedAccountOwner | ||
); | ||
|
||
it("alchemy client instantiated can specify policy id but not for others ", async () => { | ||
createSMAV2AccountClient({ | ||
chain: instance.chain, | ||
signer, | ||
transport: alchemy({ apiKey: "AN_API_KEY" }), | ||
policyId: "test-policy-id", | ||
}); | ||
// @ts-expect-error // A custom should not be able to specify an policy id | ||
createSMAV2AccountClient({ | ||
chain: instance.chain, | ||
signer, | ||
transport: custom(instance.getClient()), | ||
policyId: "test-policy-id", | ||
}); | ||
}); | ||
|
||
it("alchemy client instantiated cannot specify paymaster", async () => { | ||
const { paymasterAndData } = erc7677Middleware(); | ||
createSMAV2AccountClient({ | ||
chain: instance.chain, | ||
signer, | ||
transport: alchemy({ apiKey: "AN_API_KEY" }), | ||
}); | ||
// @ts-expect-error Should not be able to pass paymasterAndData | ||
createSMAV2AccountClient({ | ||
chain: instance.chain, | ||
signer, | ||
transport: alchemy({ apiKey: "AN_API_KEY" }), | ||
paymasterAndData, | ||
}); | ||
createSMAV2AccountClient({ | ||
chain: instance.chain, | ||
signer, | ||
transport: custom(instance.getClient()), | ||
}); | ||
createSMAV2AccountClient({ | ||
chain: instance.chain, | ||
signer, | ||
transport: custom(instance.getClient()), | ||
paymasterAndData, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters