From 184cb44d4d51ce0ff75934c637750df7b9746629 Mon Sep 17 00:00:00 2001 From: Josh Scanlan Date: Thu, 12 Feb 2026 17:50:45 -0800 Subject: [PATCH 1/3] adds smart account extension --- .../@magic-ext/smart-account/package.json | 35 ++++++++++++++++ .../@magic-ext/smart-account/src/index.cdn.ts | 3 ++ .../smart-account/src/index.native.ts | 1 + .../@magic-ext/smart-account/src/index.ts | 29 ++++++++++++++ .../@magic-ext/smart-account/src/types.ts | 40 +++++++++++++++++++ .../@magic-ext/smart-account/tsconfig.json | 3 ++ 6 files changed, 111 insertions(+) create mode 100644 packages/@magic-ext/smart-account/package.json create mode 100644 packages/@magic-ext/smart-account/src/index.cdn.ts create mode 100644 packages/@magic-ext/smart-account/src/index.native.ts create mode 100644 packages/@magic-ext/smart-account/src/index.ts create mode 100644 packages/@magic-ext/smart-account/src/types.ts create mode 100644 packages/@magic-ext/smart-account/tsconfig.json diff --git a/packages/@magic-ext/smart-account/package.json b/packages/@magic-ext/smart-account/package.json new file mode 100644 index 000000000..49fb0a4b4 --- /dev/null +++ b/packages/@magic-ext/smart-account/package.json @@ -0,0 +1,35 @@ +{ + "name": "@magic-ext/smart-account", + "version": "0.1.0", + "description": "Magic smart account extension for AA support via Rhinestone", + "author": "Magic (https://magic.link/)", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/magiclabs/magic-js" + }, + "files": [ + "dist" + ], + "target": "neutral", + "cdnGlobalName": "MagicSmartAccountExtension", + "main": "./dist/cjs/index.js", + "module": "./dist/es/index.js", + "types": "./dist/types/index.d.ts", + "jsdelivr": "./dist/extension.js", + "exports": { + "import": "./dist/es/index.mjs", + "types": "./dist/types/index.d.ts", + "require": "./dist/cjs/index.js" + }, + "externals": { + "include": [ + "@magic-sdk/provider", + "@magic-sdk/types" + ] + }, + "devDependencies": { + "@magic-sdk/provider": "^33.4.0", + "@magic-sdk/types": "^27.4.0" + } +} diff --git a/packages/@magic-ext/smart-account/src/index.cdn.ts b/packages/@magic-ext/smart-account/src/index.cdn.ts new file mode 100644 index 000000000..e63555188 --- /dev/null +++ b/packages/@magic-ext/smart-account/src/index.cdn.ts @@ -0,0 +1,3 @@ +import { SmartAccountExtension } from './index'; + +export default SmartAccountExtension; diff --git a/packages/@magic-ext/smart-account/src/index.native.ts b/packages/@magic-ext/smart-account/src/index.native.ts new file mode 100644 index 000000000..ea465c2a3 --- /dev/null +++ b/packages/@magic-ext/smart-account/src/index.native.ts @@ -0,0 +1 @@ +export * from './index'; diff --git a/packages/@magic-ext/smart-account/src/index.ts b/packages/@magic-ext/smart-account/src/index.ts new file mode 100644 index 000000000..71c8676ae --- /dev/null +++ b/packages/@magic-ext/smart-account/src/index.ts @@ -0,0 +1,29 @@ +import { Extension } from '@magic-sdk/provider'; +import { + SmartAccountPayloadMethod, + SmartAccountDelegateParams, + SmartAccountDelegateResponse, + SmartAccountSendTransactionParams, + SmartAccountSendTransactionResponse, +} from './types'; + +export class SmartAccountExtension extends Extension.Internal<'smartAccount'> { + name = 'smartAccount' as const; + config = {}; + + constructor() { + super(); + } + + public delegate(params?: SmartAccountDelegateParams): Promise { + const requestPayload = this.utils.createJsonRpcRequestPayload(SmartAccountPayloadMethod.Delegate, [params]); + return this.request(requestPayload); + } + + public sendTransaction(params: SmartAccountSendTransactionParams): Promise { + const requestPayload = this.utils.createJsonRpcRequestPayload(SmartAccountPayloadMethod.SendTransaction, [params]); + return this.request(requestPayload); + } +} + +export * from './types'; diff --git a/packages/@magic-ext/smart-account/src/types.ts b/packages/@magic-ext/smart-account/src/types.ts new file mode 100644 index 000000000..fe2a0572f --- /dev/null +++ b/packages/@magic-ext/smart-account/src/types.ts @@ -0,0 +1,40 @@ +export enum SmartAccountPayloadMethod { + Delegate = 'magic_smart_account_delegate', + SendTransaction = 'magic_smart_account_send_transaction', +} + +export interface SmartAccountDelegateParams { + chainId?: number; +} + +export interface SmartAccountDelegateResponse { + smartAccountAddress: string; + isDeployed: boolean; + eoaAddress: string; +} + +export interface SmartAccountCallInput { + to: string; + data?: string; + value?: string; +} + +export interface SmartAccountTokenRequest { + address: string; + amount?: string; +} + +export interface SmartAccountSendTransactionParams { + chainId: number; + calls: SmartAccountCallInput[]; + sourceChainIds?: number[]; + tokenRequests?: SmartAccountTokenRequest[]; + sponsored?: boolean; +} + +export interface SmartAccountSendTransactionResponse { + intentId: string; + fillHash: string | undefined; + claimHashes: string[]; + targetChainId: number; +} diff --git a/packages/@magic-ext/smart-account/tsconfig.json b/packages/@magic-ext/smart-account/tsconfig.json new file mode 100644 index 000000000..5981f3c2e --- /dev/null +++ b/packages/@magic-ext/smart-account/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.settings.json" +} From 793e8f47e9df8948c50a5ce25823b69dce556587 Mon Sep 17 00:00:00 2001 From: Josh Scanlan Date: Fri, 13 Feb 2026 10:10:39 -0800 Subject: [PATCH 2/3] runs yarn --- yarn.lock | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/yarn.lock b/yarn.lock index 7ad20b526..9b8240157 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3505,6 +3505,15 @@ __metadata: languageName: unknown linkType: soft +"@magic-ext/smart-account@workspace:packages/@magic-ext/smart-account": + version: 0.0.0-use.local + resolution: "@magic-ext/smart-account@workspace:packages/@magic-ext/smart-account" + dependencies: + "@magic-sdk/provider": ^33.4.0 + "@magic-sdk/types": ^27.4.0 + languageName: unknown + linkType: soft + "@magic-ext/solana@workspace:packages/@magic-ext/solana": version: 0.0.0-use.local resolution: "@magic-ext/solana@workspace:packages/@magic-ext/solana" From 093f12e07e9046804d3e6bd06cc1fe3aa6b5c744 Mon Sep 17 00:00:00 2001 From: Josh Scanlan Date: Fri, 20 Feb 2026 10:16:50 -0800 Subject: [PATCH 3/3] adds sponsor param --- packages/@magic-ext/smart-account/src/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/@magic-ext/smart-account/src/types.ts b/packages/@magic-ext/smart-account/src/types.ts index fe2a0572f..d6a36708a 100644 --- a/packages/@magic-ext/smart-account/src/types.ts +++ b/packages/@magic-ext/smart-account/src/types.ts @@ -5,6 +5,7 @@ export enum SmartAccountPayloadMethod { export interface SmartAccountDelegateParams { chainId?: number; + sponsored?: boolean; } export interface SmartAccountDelegateResponse {