@tuwaio/satellite-evm 0.0.4 → 0.1.0
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/dist/index.d.mts +21 -37
- package/dist/index.d.ts +21 -37
- package/dist/index.js +1 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -18
- package/dist/_esm-4WQYADT7.mjs +0 -10
- package/dist/_esm-4WQYADT7.mjs.map +0 -1
- package/dist/ccip-NIHGPDTQ.mjs +0 -2
- package/dist/ccip-NIHGPDTQ.mjs.map +0 -1
- package/dist/chunk-6R4Y2ZVK.mjs +0 -2
- package/dist/chunk-6R4Y2ZVK.mjs.map +0 -1
- package/dist/chunk-J3JCN55Z.mjs +0 -36
- package/dist/chunk-J3JCN55Z.mjs.map +0 -1
- package/dist/chunk-LHUJBWEN.mjs +0 -9
- package/dist/chunk-LHUJBWEN.mjs.map +0 -1
- package/dist/secp256k1-P3GTARIT.mjs +0 -10
- package/dist/secp256k1-P3GTARIT.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import { SatelliteAdapter, ConnectorsInitProps } from '@tuwaio/satellite-core';
|
|
2
|
-
import
|
|
3
|
-
import { Config, CreateConnectorFn, CreateConfigParameters } from '@wagmi/core';
|
|
1
|
+
import { BaseWallet, SatelliteAdapter, ConnectorsInitProps } from '@tuwaio/satellite-core';
|
|
2
|
+
import { Connector, CreateConnectorFn, Config, CreateConfigParameters } from '@wagmi/core';
|
|
4
3
|
import { Chain } from 'viem/chains';
|
|
5
|
-
import
|
|
4
|
+
import { Transport } from 'viem';
|
|
5
|
+
|
|
6
|
+
/** EVM-specific connector type */
|
|
7
|
+
type ConnectorEVM = Connector<CreateConnectorFn>;
|
|
8
|
+
/**
|
|
9
|
+
* Extended wallet interface for EVM-specific properties
|
|
10
|
+
*/
|
|
11
|
+
interface EVMWallet extends BaseWallet {
|
|
12
|
+
/** Connected Wallet Standard account */
|
|
13
|
+
connector?: ConnectorEVM;
|
|
14
|
+
}
|
|
6
15
|
|
|
7
16
|
/**
|
|
8
17
|
* Creates an EVM-compatible adapter for Satellite
|
|
@@ -12,6 +21,7 @@ import * as viem from 'viem';
|
|
|
12
21
|
* It uses wagmi as the underlying library for wallet connections and chain interactions.
|
|
13
22
|
*
|
|
14
23
|
* @param config - Wagmi configuration object containing chain and connector settings
|
|
24
|
+
* @param signInWithSiwe - Optional function for signing in with SIWE
|
|
15
25
|
* @returns A configured SatelliteAdapter instance for EVM chains
|
|
16
26
|
* @throws Error if config is not provided
|
|
17
27
|
*
|
|
@@ -28,7 +38,7 @@ import * as viem from 'viem';
|
|
|
28
38
|
* const evmAdapter = satelliteEVMAdapter(config);
|
|
29
39
|
* ```
|
|
30
40
|
*/
|
|
31
|
-
declare function satelliteEVMAdapter(config: Config): SatelliteAdapter
|
|
41
|
+
declare function satelliteEVMAdapter(config: Config, signInWithSiwe?: () => Promise<void>): SatelliteAdapter<ConnectorEVM>;
|
|
32
42
|
|
|
33
43
|
/**
|
|
34
44
|
* Configuration options for Gnosis Safe SDK
|
|
@@ -46,8 +56,6 @@ declare const safeSdkOptions: {
|
|
|
46
56
|
*
|
|
47
57
|
* @remarks
|
|
48
58
|
* Creates instances of various wallet connectors including:
|
|
49
|
-
* - Injected provider (e.g. browser wallets)
|
|
50
|
-
* - MetaMask
|
|
51
59
|
* - Coinbase Wallet
|
|
52
60
|
* - Gnosis Safe
|
|
53
61
|
* - WalletConnect (if projectId provided)
|
|
@@ -111,37 +119,13 @@ declare function checkIsWalletAddressContract({ config, address, chainId, chains
|
|
|
111
119
|
}): Promise<boolean>;
|
|
112
120
|
|
|
113
121
|
/**
|
|
114
|
-
* Creates
|
|
122
|
+
* Creates default HTTP transports for each chain in the configuration
|
|
115
123
|
*
|
|
116
|
-
* @
|
|
117
|
-
*
|
|
118
|
-
* It automatically sets up HTTP transports for each chain if custom transports are not provided.
|
|
124
|
+
* @param chains - Array of chain configurations from wagmi
|
|
125
|
+
* @returns Object mapping chain IDs to their corresponding HTTP transport instances
|
|
119
126
|
*
|
|
120
|
-
* @
|
|
121
|
-
* @param config.chains - Array of supported blockchain networks
|
|
122
|
-
* @param config.transports - Optional custom transport configurations for each chain
|
|
123
|
-
* @param config.projectId - WalletConnect project ID
|
|
124
|
-
* @param config.appName - Application name for wallet connection UI
|
|
125
|
-
* @param config.appUrl - Application URL for metadata
|
|
126
|
-
* @param config.appLogoUrl - URL to application logo
|
|
127
|
-
* @param config.appLogo - Optional inline logo data
|
|
128
|
-
* @param config.appIcons - Array of application icon URLs
|
|
129
|
-
* @param config.description - Application description for wallet connection UI
|
|
130
|
-
* @param config.getImpersonatedAccount - Optional function for development wallet impersonation
|
|
131
|
-
*
|
|
132
|
-
* @returns Configured Wagmi instance
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
* ```typescript
|
|
136
|
-
* const config = createWagmiConfig({
|
|
137
|
-
* chains: [mainnet, polygon],
|
|
138
|
-
* projectId: "your_project_id",
|
|
139
|
-
* appName: "My dApp",
|
|
140
|
-
* appUrl: "https://mydapp.com",
|
|
141
|
-
* appLogoUrl: "https://mydapp.com/logo.png"
|
|
142
|
-
* });
|
|
143
|
-
* ```
|
|
127
|
+
* @public
|
|
144
128
|
*/
|
|
145
|
-
declare const
|
|
129
|
+
declare const createDefaultTransports: (chains: CreateConfigParameters["chains"]) => Record<number, Transport>;
|
|
146
130
|
|
|
147
|
-
export { checkIsWalletAddressContract,
|
|
131
|
+
export { type ConnectorEVM, type EVMWallet, checkIsWalletAddressContract, createDefaultTransports, initAllConnectors, safeSdkOptions, satelliteEVMAdapter };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import { SatelliteAdapter, ConnectorsInitProps } from '@tuwaio/satellite-core';
|
|
2
|
-
import
|
|
3
|
-
import { Config, CreateConnectorFn, CreateConfigParameters } from '@wagmi/core';
|
|
1
|
+
import { BaseWallet, SatelliteAdapter, ConnectorsInitProps } from '@tuwaio/satellite-core';
|
|
2
|
+
import { Connector, CreateConnectorFn, Config, CreateConfigParameters } from '@wagmi/core';
|
|
4
3
|
import { Chain } from 'viem/chains';
|
|
5
|
-
import
|
|
4
|
+
import { Transport } from 'viem';
|
|
5
|
+
|
|
6
|
+
/** EVM-specific connector type */
|
|
7
|
+
type ConnectorEVM = Connector<CreateConnectorFn>;
|
|
8
|
+
/**
|
|
9
|
+
* Extended wallet interface for EVM-specific properties
|
|
10
|
+
*/
|
|
11
|
+
interface EVMWallet extends BaseWallet {
|
|
12
|
+
/** Connected Wallet Standard account */
|
|
13
|
+
connector?: ConnectorEVM;
|
|
14
|
+
}
|
|
6
15
|
|
|
7
16
|
/**
|
|
8
17
|
* Creates an EVM-compatible adapter for Satellite
|
|
@@ -12,6 +21,7 @@ import * as viem from 'viem';
|
|
|
12
21
|
* It uses wagmi as the underlying library for wallet connections and chain interactions.
|
|
13
22
|
*
|
|
14
23
|
* @param config - Wagmi configuration object containing chain and connector settings
|
|
24
|
+
* @param signInWithSiwe - Optional function for signing in with SIWE
|
|
15
25
|
* @returns A configured SatelliteAdapter instance for EVM chains
|
|
16
26
|
* @throws Error if config is not provided
|
|
17
27
|
*
|
|
@@ -28,7 +38,7 @@ import * as viem from 'viem';
|
|
|
28
38
|
* const evmAdapter = satelliteEVMAdapter(config);
|
|
29
39
|
* ```
|
|
30
40
|
*/
|
|
31
|
-
declare function satelliteEVMAdapter(config: Config): SatelliteAdapter
|
|
41
|
+
declare function satelliteEVMAdapter(config: Config, signInWithSiwe?: () => Promise<void>): SatelliteAdapter<ConnectorEVM>;
|
|
32
42
|
|
|
33
43
|
/**
|
|
34
44
|
* Configuration options for Gnosis Safe SDK
|
|
@@ -46,8 +56,6 @@ declare const safeSdkOptions: {
|
|
|
46
56
|
*
|
|
47
57
|
* @remarks
|
|
48
58
|
* Creates instances of various wallet connectors including:
|
|
49
|
-
* - Injected provider (e.g. browser wallets)
|
|
50
|
-
* - MetaMask
|
|
51
59
|
* - Coinbase Wallet
|
|
52
60
|
* - Gnosis Safe
|
|
53
61
|
* - WalletConnect (if projectId provided)
|
|
@@ -111,37 +119,13 @@ declare function checkIsWalletAddressContract({ config, address, chainId, chains
|
|
|
111
119
|
}): Promise<boolean>;
|
|
112
120
|
|
|
113
121
|
/**
|
|
114
|
-
* Creates
|
|
122
|
+
* Creates default HTTP transports for each chain in the configuration
|
|
115
123
|
*
|
|
116
|
-
* @
|
|
117
|
-
*
|
|
118
|
-
* It automatically sets up HTTP transports for each chain if custom transports are not provided.
|
|
124
|
+
* @param chains - Array of chain configurations from wagmi
|
|
125
|
+
* @returns Object mapping chain IDs to their corresponding HTTP transport instances
|
|
119
126
|
*
|
|
120
|
-
* @
|
|
121
|
-
* @param config.chains - Array of supported blockchain networks
|
|
122
|
-
* @param config.transports - Optional custom transport configurations for each chain
|
|
123
|
-
* @param config.projectId - WalletConnect project ID
|
|
124
|
-
* @param config.appName - Application name for wallet connection UI
|
|
125
|
-
* @param config.appUrl - Application URL for metadata
|
|
126
|
-
* @param config.appLogoUrl - URL to application logo
|
|
127
|
-
* @param config.appLogo - Optional inline logo data
|
|
128
|
-
* @param config.appIcons - Array of application icon URLs
|
|
129
|
-
* @param config.description - Application description for wallet connection UI
|
|
130
|
-
* @param config.getImpersonatedAccount - Optional function for development wallet impersonation
|
|
131
|
-
*
|
|
132
|
-
* @returns Configured Wagmi instance
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
* ```typescript
|
|
136
|
-
* const config = createWagmiConfig({
|
|
137
|
-
* chains: [mainnet, polygon],
|
|
138
|
-
* projectId: "your_project_id",
|
|
139
|
-
* appName: "My dApp",
|
|
140
|
-
* appUrl: "https://mydapp.com",
|
|
141
|
-
* appLogoUrl: "https://mydapp.com/logo.png"
|
|
142
|
-
* });
|
|
143
|
-
* ```
|
|
127
|
+
* @public
|
|
144
128
|
*/
|
|
145
|
-
declare const
|
|
129
|
+
declare const createDefaultTransports: (chains: CreateConfigParameters["chains"]) => Record<number, Transport>;
|
|
146
130
|
|
|
147
|
-
export { checkIsWalletAddressContract,
|
|
131
|
+
export { type ConnectorEVM, type EVMWallet, checkIsWalletAddressContract, createDefaultTransports, initAllConnectors, safeSdkOptions, satelliteEVMAdapter };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
'use strict';var orbitCore=require('@tuwaio/orbit-core'),orbitEvm=require('@tuwaio/orbit-evm'),
|
|
2
|
-
`);super(i,t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"version",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"name",{enumerable:true,configurable:true,writable:true,value:"BaseError"}),this.details=o,this.docsPath=n,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=r,this.version=De;}walk(r){return yr(this,r)}};});var se,Tr=l(()=>{C();se=class extends d{constructor({size:r,targetSize:t,type:o}){super(`${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()} size (${r}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"});}};});function P(e,{dir:r,size:t=32}={}){return typeof e=="string"?gt(e,{dir:r,size:t}):yt(e,{dir:r,size:t})}function gt(e,{dir:r,size:t=32}={}){if(t===null)return e;let o=e.replace("0x","");if(o.length>t*2)throw new se({size:Math.ceil(o.length/2),targetSize:t,type:"hex"});return `0x${o[r==="right"?"padEnd":"padStart"](t*2,"0")}`}function yt(e,{dir:r,size:t=32}={}){if(t===null)return e;if(e.length>t)throw new se({size:e.length,targetSize:t,type:"bytes"});let o=new Uint8Array(t);for(let n=0;n<t;n++){let s=r==="right";o[s?n:t-n-1]=e[s?n:e.length-n-1];}return o}var Ve=l(()=>{Tr();});var he,be,ge,We=l(()=>{C();he=class extends d{constructor({max:r,min:t,signed:o,size:n,value:s}){super(`Number "${s}" is not in safe ${n?`${n*8}-bit ${o?"signed":"unsigned"} `:""}integer range ${r?`(${t} to ${r})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"});}},be=class extends d{constructor(r){super(`Hex value "${r}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"});}},ge=class extends d{constructor({givenSize:r,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${r} bytes.`,{name:"SizeOverflowError"});}};});function ie(e,{dir:r="left"}={}){let t=typeof e=="string"?e.replace("0x",""):e,o=0;for(let n=0;n<t.length-1&&t[r==="left"?n:t.length-n-1].toString()==="0";n++)o++;return t=r==="left"?t.slice(o):t.slice(0,t.length-o),typeof e=="string"?(t.length===1&&r==="right"&&(t=`${t}0`),`0x${t.length%2===1?`0${t}`:t}`):t}var wr=l(()=>{});function T(e,{size:r}){if(qe(e)>r)throw new ge({givenSize:qe(e),maxSize:r})}function ye(e,r){let t={to:r},o=t.to;return o==="number"?Cr(e,t):o==="bigint"?Ge(e,t):o==="string"?Sr(e,t):o==="boolean"?Er(e,t):ae(e,t)}function Ge(e,r={}){let{signed:t}=r;r.size&&T(e,{size:r.size});let o=BigInt(e);if(!t)return o;let n=(e.length-2)/2,s=(1n<<BigInt(n)*8n-1n)-1n;return o<=s?o:o-BigInt(`0x${"f".padStart(n*2,"f")}`)-1n}function Er(e,r={}){let t=e;if(r.size&&(T(t,{size:r.size}),t=ie(t)),ie(t)==="0x00")return false;if(ie(t)==="0x01")return true;throw new be(t)}function Cr(e,r={}){return Number(Ge(e,r))}function Sr(e,r={}){let t=ae(e);return r.size&&(T(t,{size:r.size}),t=ie(t,{dir:"right"})),new TextDecoder().decode(t)}var Te=l(()=>{We();br();wr();we();});function _e(e,r={}){return typeof e=="number"||typeof e=="bigint"?U(e,r):typeof e=="string"?Ee(e,r):typeof e=="boolean"?Ar(e,r):Ke(e,r)}function Ar(e,r={}){let t=`0x${Number(e)}`;return typeof r.size=="number"?(T(t,{size:r.size}),P(t,{size:r.size})):t}function Ke(e,r={}){let t="";for(let n=0;n<e.length;n++)t+=Tt[e[n]];let o=`0x${t}`;return typeof r.size=="number"?(T(o,{size:r.size}),P(o,{dir:"right",size:r.size})):o}function U(e,r={}){let{signed:t,size:o}=r,n=BigInt(e),s;o?t?s=(1n<<BigInt(o)*8n-1n)-1n:s=2n**(BigInt(o)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));let i=typeof s=="bigint"&&t?-s-1n:0;if(s&&n>s||n<i){let m=typeof e=="bigint"?"n":"";throw new he({max:s?`${s}${m}`:void 0,min:`${i}${m}`,signed:t,size:o,value:`${e}${m}`})}let a=`0x${(t&&n<0?(1n<<BigInt(o*8))+BigInt(n):n).toString(16)}`;return o?P(a,{size:o}):a}function Ee(e,r={}){let t=wt.encode(e);return Ke(t,r)}var Tt,wt,pe=l(()=>{We();Ve();Te();Tt=Array.from({length:256},(e,r)=>r.toString(16).padStart(2,"0"));wt=new TextEncoder;});function kr(e,r={}){return typeof e=="number"||typeof e=="bigint"?St(e,r):typeof e=="boolean"?Ct(e,r):te(e)?ae(e,r):Ze(e,r)}function Ct(e,r={}){let t=new Uint8Array(1);return t[0]=Number(e),typeof r.size=="number"?(T(t,{size:r.size}),P(t,{size:r.size})):t}function vr(e){if(e>=S.zero&&e<=S.nine)return e-S.zero;if(e>=S.A&&e<=S.F)return e-(S.A-10);if(e>=S.a&&e<=S.f)return e-(S.a-10)}function ae(e,r={}){let t=e;r.size&&(T(t,{size:r.size}),t=P(t,{dir:"right",size:r.size}));let o=t.slice(2);o.length%2&&(o=`0${o}`);let n=o.length/2,s=new Uint8Array(n);for(let i=0,a=0;i<n;i++){let m=vr(o.charCodeAt(a++)),f=vr(o.charCodeAt(a++));if(m===void 0||f===void 0)throw new d(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);s[i]=m*16+f;}return s}function St(e,r){let t=U(e,r);return ae(t)}function Ze(e,r={}){let t=Et.encode(e);return typeof r.size=="number"?(T(t,{size:r.size}),P(t,{dir:"right",size:r.size})):t}var Et,S,we=l(()=>{C();de();Ve();Te();pe();Et=new TextEncoder;S={zero:48,nine:57,A:65,F:70,a:97,f:102};});function At(e,r=false){return r?{h:Number(e&Ce),l:Number(e>>Ir&Ce)}:{h:Number(e>>Ir&Ce)|0,l:Number(e&Ce)|0}}function Rr(e,r=false){let t=e.length,o=new Uint32Array(t),n=new Uint32Array(t);for(let s=0;s<t;s++){let{h:i,l:a}=At(e[s],r);[o[s],n[s]]=[i,a];}return [o,n]}var Ce,Ir,Pr,zr,Br,Mr,Ur=l(()=>{Ce=BigInt(4294967295),Ir=BigInt(32);Pr=(e,r,t)=>e<<t|r>>>32-t,zr=(e,r,t)=>r<<t|e>>>32-t,Br=(e,r,t)=>r<<t-32|e>>>64-t,Mr=(e,r,t)=>e<<t-32|r>>>64-t;});function vt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Je(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function ce(e,...r){if(!vt(e))throw new Error("Uint8Array expected");if(r.length>0&&!r.includes(e.length))throw new Error("Uint8Array expected of length "+r+", got length="+e.length)}function Xe(e,r=true){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(r&&e.finished)throw new Error("Hash#digest() has already been called")}function Hr(e,r){ce(e);let t=r.outputLen;if(e.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function Fr(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Qe(...e){for(let r=0;r<e.length;r++)e[r].fill(0);}function It(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Rt(e){for(let r=0;r<e.length;r++)e[r]=It(e[r]);return e}function Pt(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function er(e){return typeof e=="string"&&(e=Pt(e)),ce(e),e}function Lr(e){let r=o=>e().update(er(o)).digest(),t=e();return r.outputLen=t.outputLen,r.blockLen=t.blockLen,r.create=()=>e(),r}var kt,Ye,Se,Nr=l(()=>{kt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;Ye=kt?e=>e:Rt;Se=class{};});function Nt(e,r=24){let t=new Uint32Array(10);for(let o=24-r;o<24;o++){for(let i=0;i<10;i++)t[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){let a=(i+8)%10,m=(i+2)%10,f=t[m],c=t[m+1],x=Or(f,c,1)^t[a],p=jr(f,c,1)^t[a+1];for(let u=0;u<50;u+=10)e[i+u]^=x,e[i+u+1]^=p;}let n=e[2],s=e[3];for(let i=0;i<24;i++){let a=Dr[i],m=Or(n,s,a),f=jr(n,s,a),c=qr[i];n=e[c],s=e[c+1],e[c]=m,e[c+1]=f;}for(let i=0;i<50;i+=10){for(let a=0;a<10;a++)t[a]=e[i+a];for(let a=0;a<10;a++)e[i+a]^=~t[(a+2)%10]&t[(a+4)%10];}e[0]^=Ft[o],e[1]^=Lt[o];}Qe(t);}var zt,me,Bt,Mt,Ut,Ht,qr,Dr,$r,Vr,Ft,Lt,Or,jr,rr,Ot,Wr,Gr=l(()=>{Ur();Nr();zt=BigInt(0),me=BigInt(1),Bt=BigInt(2),Mt=BigInt(7),Ut=BigInt(256),Ht=BigInt(113),qr=[],Dr=[],$r=[];for(let e=0,r=me,t=1,o=0;e<24;e++){[t,o]=[o,(2*t+3*o)%5],qr.push(2*(5*o+t)),Dr.push((e+1)*(e+2)/2%64);let n=zt;for(let s=0;s<7;s++)r=(r<<me^(r>>Mt)*Ht)%Ut,r&Bt&&(n^=me<<(me<<BigInt(s))-me);$r.push(n);}Vr=Rr($r,true),Ft=Vr[0],Lt=Vr[1],Or=(e,r,t)=>t>32?Br(e,r,t):Pr(e,r,t),jr=(e,r,t)=>t>32?Mr(e,r,t):zr(e,r,t);rr=class e extends Se{constructor(r,t,o,n=false,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=false,this.destroyed=false,this.enableXOF=false,this.blockLen=r,this.suffix=t,this.outputLen=o,this.enableXOF=n,this.rounds=s,Je(o),!(0<r&&r<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Fr(this.state);}clone(){return this._cloneInto()}keccak(){Ye(this.state32),Nt(this.state32,this.rounds),Ye(this.state32),this.posOut=0,this.pos=0;}update(r){Xe(this),r=er(r),ce(r);let{blockLen:t,state:o}=this,n=r.length;for(let s=0;s<n;){let i=Math.min(t-this.pos,n-s);for(let a=0;a<i;a++)o[this.pos++]^=r[s++];this.pos===t&&this.keccak();}return this}finish(){if(this.finished)return;this.finished=true;let{state:r,suffix:t,pos:o,blockLen:n}=this;r[o]^=t,(t&128)!==0&&o===n-1&&this.keccak(),r[n-1]^=128,this.keccak();}writeInto(r){Xe(this,false),ce(r),this.finish();let t=this.state,{blockLen:o}=this;for(let n=0,s=r.length;n<s;){this.posOut>=o&&this.keccak();let i=Math.min(o-this.posOut,s-n);r.set(t.subarray(this.posOut,this.posOut+i),n),this.posOut+=i,n+=i;}return r}xofInto(r){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(r)}xof(r){return Je(r),this.xofInto(new Uint8Array(r))}digestInto(r){if(Hr(r,this),this.finished)throw new Error("digest() was already called");return this.writeInto(r),this.destroy(),r}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=true,Qe(this.state);}_cloneInto(r){let{blockLen:t,suffix:o,outputLen:n,rounds:s,enableXOF:i}=this;return r||(r=new e(t,o,n,i,s)),r.state32.set(this.state32),r.pos=this.pos,r.posOut=this.posOut,r.finished=this.finished,r.rounds=s,r.suffix=o,r.outputLen=n,r.enableXOF=i,r.destroyed=this.destroyed,r}},Ot=(e,r,t)=>Lr(()=>new rr(r,e,t)),Wr=Ot(1,136,256/8);});function _r(e,r){let t=r,o=Wr(te(e,{strict:false})?kr(e):e);return t==="bytes"?o:_e(o)}var Kr=l(()=>{Gr();de();we();pe();});var Ae,Zr=l(()=>{C();Ae=class extends d{constructor({address:r}){super(`Address "${r}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"});}};});var z,ve=l(()=>{z=class extends Map{constructor(r){super(),Object.defineProperty(this,"maxSize",{enumerable:true,configurable:true,writable:true,value:void 0}),this.maxSize=r;}get(r){let t=super.get(r);return super.has(r)&&t!==void 0&&(this.delete(r),super.set(r,t)),t}set(r,t){if(super.set(r,t),this.maxSize&&this.size>this.maxSize){let o=this.keys().next().value;o&&this.delete(o);}return this}};});function ke(e,r){if(tr.has(`${e}.${r}`))return tr.get(`${e}.${r}`);let t=r?`${r}${e.toLowerCase()}`:e.substring(2).toLowerCase(),o=_r(Ze(t),"bytes"),n=(r?t.substring(`${r}0x`.length):t).split("");for(let i=0;i<40;i+=2)o[i>>1]>>4>=8&&n[i]&&(n[i]=n[i].toUpperCase()),(o[i>>1]&15)>=8&&n[i+1]&&(n[i+1]=n[i+1].toUpperCase());let s=`0x${n.join("")}`;return tr.set(`${e}.${r}`,s),s}function Ie(e,r){if(!Jr(e,{strict:false}))throw new Ae({address:e});return ke(e,r)}var tr,or=l(()=>{Zr();we();Kr();ve();Xr();tr=new z(8192);});function Jr(e,r){let{strict:t=true}=r??{},o=`${e}.${t}`;if(nr.has(o))return nr.get(o);let n=jt.test(e)?e.toLowerCase()===e?true:t?ke(e)===e:true:false;return nr.set(o,n),n}var jt,nr,Xr=l(()=>{ve();or();jt=/^0x[a-fA-F0-9]{40}$/,nr=new z(8192);});var w,Re=l(()=>{w=(e,r,t)=>JSON.stringify(e,(o,n)=>{let s=typeof n=="bigint"?n.toString():n;return typeof r=="function"?r(o,s):s},t);});var Pe,Qr=l(()=>{Pe=e=>e;});var E,A,oe,ne=l(()=>{Re();C();Qr();E=class extends d{constructor({body:r,cause:t,details:o,headers:n,status:s,url:i}){super("HTTP request failed.",{cause:t,details:o,metaMessages:[s&&`Status: ${s}`,`URL: ${Pe(i)}`,r&&`Request body: ${w(r)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"headers",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"status",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"url",{enumerable:true,configurable:true,writable:true,value:void 0}),this.body=r,this.headers=n,this.status=s,this.url=i;}},A=class extends d{constructor({body:r,error:t,url:o}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${Pe(o)}`,`Request body: ${w(r)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"data",{enumerable:true,configurable:true,writable:true,value:void 0}),this.code=t.code,this.data=t.data;}},oe=class extends d{constructor({body:r,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Pe(t)}`,`Request body: ${w(r)}`],name:"TimeoutError"});}};});var qt,h,b,H,F,L,N,B,O,j,q,D,v,M,$,g,V,W,G,_,k,K,Z,J,X,Q,Y,ee,fe,sr=l(()=>{C();ne();qt=-1,h=class extends d{constructor(r,{code:t,docsPath:o,metaMessages:n,name:s,shortMessage:i}){super(i,{cause:r,docsPath:o,metaMessages:n||r?.metaMessages,name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:true,configurable:true,writable:true,value:void 0}),this.name=s||r.name,this.code=r instanceof A?r.code:t??qt;}},b=class extends h{constructor(r,t){super(r,t),Object.defineProperty(this,"data",{enumerable:true,configurable:true,writable:true,value:void 0}),this.data=t.data;}},H=class e extends h{constructor(r){super(r,{code:e.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."});}};Object.defineProperty(H,"code",{enumerable:true,configurable:true,writable:true,value:-32700});F=class e extends h{constructor(r){super(r,{code:e.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."});}};Object.defineProperty(F,"code",{enumerable:true,configurable:true,writable:true,value:-32600});L=class e extends h{constructor(r,{method:t}={}){super(r,{code:e.code,name:"MethodNotFoundRpcError",shortMessage:`The method${t?` "${t}"`:""} does not exist / is not available.`});}};Object.defineProperty(L,"code",{enumerable:true,configurable:true,writable:true,value:-32601});N=class e extends h{constructor(r){super(r,{code:e.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
|
|
3
|
-
`)});}};Object.defineProperty(N,"code",{enumerable:true,configurable:true,writable:true,value:-32602});B=class e extends h{constructor(r){super(r,{code:e.code,name:"InternalRpcError",shortMessage:"An internal error was received."});}};Object.defineProperty(B,"code",{enumerable:true,configurable:true,writable:true,value:-32603});O=class e extends h{constructor(r){super(r,{code:e.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
4
|
-
`)});}};Object.defineProperty(O,"code",{enumerable:true,configurable:true,writable:true,value:-32e3});j=class e extends h{constructor(r){super(r,{code:e.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:true,configurable:true,writable:true,value:"ResourceNotFoundRpcError"});}};Object.defineProperty(j,"code",{enumerable:true,configurable:true,writable:true,value:-32001});q=class e extends h{constructor(r){super(r,{code:e.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."});}};Object.defineProperty(q,"code",{enumerable:true,configurable:true,writable:true,value:-32002});D=class e extends h{constructor(r){super(r,{code:e.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."});}};Object.defineProperty(D,"code",{enumerable:true,configurable:true,writable:true,value:-32003});v=class e extends h{constructor(r,{method:t}={}){super(r,{code:e.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${t?` "${t}"`:""} is not supported.`});}};Object.defineProperty(v,"code",{enumerable:true,configurable:true,writable:true,value:-32004});M=class e extends h{constructor(r){super(r,{code:e.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."});}};Object.defineProperty(M,"code",{enumerable:true,configurable:true,writable:true,value:-32005});$=class e extends h{constructor(r){super(r,{code:e.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."});}};Object.defineProperty($,"code",{enumerable:true,configurable:true,writable:true,value:-32006});g=class e extends b{constructor(r){super(r,{code:e.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."});}};Object.defineProperty(g,"code",{enumerable:true,configurable:true,writable:true,value:4001});V=class e extends b{constructor(r){super(r,{code:e.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."});}};Object.defineProperty(V,"code",{enumerable:true,configurable:true,writable:true,value:4100});W=class e extends b{constructor(r,{method:t}={}){super(r,{code:e.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${t?` " ${t}"`:""}.`});}};Object.defineProperty(W,"code",{enumerable:true,configurable:true,writable:true,value:4200});G=class e extends b{constructor(r){super(r,{code:e.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."});}};Object.defineProperty(G,"code",{enumerable:true,configurable:true,writable:true,value:4900});_=class e extends b{constructor(r){super(r,{code:e.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."});}};Object.defineProperty(_,"code",{enumerable:true,configurable:true,writable:true,value:4901});k=class e extends b{constructor(r){super(r,{code:e.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."});}};Object.defineProperty(k,"code",{enumerable:true,configurable:true,writable:true,value:4902});K=class e extends b{constructor(r){super(r,{code:e.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."});}};Object.defineProperty(K,"code",{enumerable:true,configurable:true,writable:true,value:5700});Z=class e extends b{constructor(r){super(r,{code:e.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."});}};Object.defineProperty(Z,"code",{enumerable:true,configurable:true,writable:true,value:5710});J=class e extends b{constructor(r){super(r,{code:e.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."});}};Object.defineProperty(J,"code",{enumerable:true,configurable:true,writable:true,value:5720});X=class e extends b{constructor(r){super(r,{code:e.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"});}};Object.defineProperty(X,"code",{enumerable:true,configurable:true,writable:true,value:5730});Q=class e extends b{constructor(r){super(r,{code:e.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."});}};Object.defineProperty(Q,"code",{enumerable:true,configurable:true,writable:true,value:5740});Y=class e extends b{constructor(r){super(r,{code:e.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."});}};Object.defineProperty(Y,"code",{enumerable:true,configurable:true,writable:true,value:5750});ee=class e extends b{constructor(r){super(r,{code:e.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."});}};Object.defineProperty(ee,"code",{enumerable:true,configurable:true,writable:true,value:5760});fe=class extends h{constructor(r){super(r,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."});}};});function Yr(){let e=()=>{},r=()=>{};return {promise:new Promise((o,n)=>{e=o,r=n;}),resolve:e,reject:r}}var et=l(()=>{});function rt({fn:e,id:r,shouldSplitBatch:t,wait:o=0,sort:n}){let s=async()=>{let c=m();i();let x=c.map(({args:p})=>p);x.length!==0&&e(x).then(p=>{n&&Array.isArray(p)&&p.sort(n);for(let u=0;u<c.length;u++){let{resolve:y}=c[u];y?.([p[u],p]);}}).catch(p=>{for(let u=0;u<c.length;u++){let{reject:y}=c[u];y?.(p);}});},i=()=>ir.delete(r),a=()=>m().map(({args:c})=>c),m=()=>ir.get(r)||[],f=c=>ir.set(r,[...m(),c]);return {flush:i,async schedule(c){let{promise:x,resolve:p,reject:u}=Yr();return t?.([...a(),c])&&s(),m().length>0?(f({args:c,resolve:p,reject:u}),x):(f({args:c,resolve:p,reject:u}),setTimeout(s,o),x)}}}var ir,tt=l(()=>{et();ir=new Map;});async function ot(e){return new Promise(r=>setTimeout(r,e))}function nt(e,{delay:r=100,retryCount:t=2,shouldRetry:o=()=>true}={}){return new Promise((n,s)=>{let i=async({count:a=0}={})=>{let m=async({error:f})=>{let c=typeof r=="function"?r({count:a,error:f}):r;c&&await ot(c),i({count:a+1});};try{let f=await e();n(f);}catch(f){if(a<t&&await o({count:a,error:f}))return m({error:f});s(f);}};i();})}var ze=256,Be;function st(e=11){if(!Be||ze+e>256*2){Be="",ze=0;for(let r=0;r<256;r++)Be+=(256+Math.random()*256|0).toString(16).substring(1);}return Be.substring(ze,ze+++e)}C();ne();sr();pe();ve();var Me=new z(8192);function it(e,{enabled:r=true,id:t}){if(!r||!t)return e();if(Me.get(t))return Me.get(t);let o=e().finally(()=>Me.delete(t));return Me.set(t,o),o}Re();function at(e,r={}){return async(t,o={})=>{let{dedupe:n=false,methods:s,retryDelay:i=150,retryCount:a=3,uid:m}={...r,...o},{method:f}=t;if(s?.exclude?.includes(f))throw new v(new Error("method not supported"),{method:f});if(s?.include&&!s.include.includes(f))throw new v(new Error("method not supported"),{method:f});let c=n?Ee(`${m}.${w(t)}`):void 0;return it(()=>nt(async()=>{try{return await e(t)}catch(x){let p=x;switch(p.code){case H.code:throw new H(p);case F.code:throw new F(p);case L.code:throw new L(p,{method:t.method});case N.code:throw new N(p);case B.code:throw new B(p);case O.code:throw new O(p);case j.code:throw new j(p);case q.code:throw new q(p);case D.code:throw new D(p);case v.code:throw new v(p,{method:t.method});case M.code:throw new M(p);case $.code:throw new $(p);case g.code:throw new g(p);case V.code:throw new V(p);case W.code:throw new W(p);case G.code:throw new G(p);case _.code:throw new _(p);case k.code:throw new k(p);case K.code:throw new K(p);case Z.code:throw new Z(p);case J.code:throw new J(p);case X.code:throw new X(p);case Q.code:throw new Q(p);case Y.code:throw new Y(p);case ee.code:throw new ee(p);case 5e3:throw new g(p);default:throw x instanceof d?x:new fe(p)}}},{delay:({count:x,error:p})=>{if(p&&p instanceof E){let u=p?.headers?.get("Retry-After");if(u?.match(/\d/))return Number.parseInt(u,10)*1e3}return ~~(1<<x)*i},retryCount:a,shouldRetry:({error:x})=>Dt(x)}),{enabled:n,id:c})}}function Dt(e){return "code"in e&&typeof e.code=="number"?e.code===-1||e.code===M.code||e.code===B.code:e instanceof E&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:true}function pt(e){return {formatters:void 0,fees:void 0,serializers:void 0,...e}}ne();function ct(e,{errorInstance:r=new Error("timed out"),timeout:t,signal:o}){return new Promise((n,s)=>{(async()=>{let i;try{let a=new AbortController;t>0&&(i=setTimeout(()=>{o?a.abort():s(r);},t)),n(await e({signal:a?.signal||null}));}catch(a){a?.name==="AbortError"&&s(r),s(a);}finally{clearTimeout(i);}})();})}Re();function $t(){return {current:0,take(){return this.current++},reset(){this.current=0;}}}var ar=$t();function Ue(e,r={}){return {async request(t){let{body:o,fetchFn:n=r.fetchFn??fetch,onRequest:s=r.onRequest,onResponse:i=r.onResponse,timeout:a=r.timeout??1e4}=t,m={...r.fetchOptions??{},...t.fetchOptions??{}},{headers:f,method:c,signal:x}=m;try{let p=await ct(async({signal:y})=>{let re={...m,body:Array.isArray(o)?w(o.map(I=>({jsonrpc:"2.0",id:I.id??ar.take(),...I}))):w({jsonrpc:"2.0",id:o.id??ar.take(),...o}),headers:{"Content-Type":"application/json",...f},method:c||"POST",signal:x||(a>0?y:null)},Ne=new Request(e,re),le=await s?.(Ne,re)??{...re,url:e};return await n(le.url??e,le)},{errorInstance:new oe({body:o,url:e}),timeout:a,signal:!0});i&&await i(p);let u;if(p.headers.get("Content-Type")?.startsWith("application/json"))u=await p.json();else {u=await p.text();try{u=JSON.parse(u||"{}");}catch(y){if(p.ok)throw y;u={error:u};}}if(!p.ok)throw new E({body:o,details:w(u.error)||p.statusText,headers:p.headers,status:p.status,url:e});return u}catch(p){throw p instanceof E||p instanceof oe?p:new E({body:o,cause:p,url:e})}}}}function Vt(e,{body:r,onError:t,onResponse:o}){return e.request({body:r,onError:t,onResponse:o}),e}async function Wt(e,{body:r,timeout:t=1e4}){return e.requestAsync({body:r,timeout:t})}var pr={http(e,r){return Ue(e).request(r)},webSocket:Vt,webSocketAsync:Wt};var ue="0x0000000000000000000000000000000000000000";function He({key:e,methods:r,name:t,request:o,retryCount:n=3,retryDelay:s=150,timeout:i,type:a},m){let f=st();return {config:{key:e,methods:r,name:t,request:o,retryCount:n,retryDelay:s,timeout:i,type:a},request:at(o,{methods:r,retryCount:n,retryDelay:s,uid:f}),value:m}}function cr(e,r={}){let{key:t="custom",methods:o,name:n="Custom Provider",retryDelay:s}=r;return ({retryCount:i})=>He({key:t,methods:o,name:n,request:e.request.bind(e),retryCount:r.retryCount??i,retryDelay:s,type:"custom"})}ne();C();var Fe=class extends d{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"});}};tt();function mr(e,r={}){let{batch:t,fetchFn:o,fetchOptions:n,key:s="http",methods:i,name:a="HTTP JSON-RPC",onFetchRequest:m,onFetchResponse:f,retryDelay:c,raw:x}=r;return ({chain:p,retryCount:u,timeout:y})=>{let{batchSize:re=1e3,wait:Ne=0}=typeof t=="object"?t:{},le=r.retryCount??u,Oe=y??r.timeout??1e4,I=p?.rpcUrls.default.http[0];if(!I)throw new Fe;let lr=Ue(I,{fetchFn:o,fetchOptions:n,onRequest:m,onResponse:f,timeout:Oe});return He({key:s,methods:i,name:a,async request({method:xt,params:lt}){let dr={method:xt,params:lt},{schedule:dt}=rt({id:I,wait:Ne,shouldSplitBatch(R){return R.length>re},fn:R=>lr.request({body:R}),sort:(R,bt)=>R.id-bt.id}),ht=async R=>t?dt(R):[await lr.request({body:R})],[{error:je,result:hr}]=await ht(dr);if(x)return {error:je,result:hr};if(je)throw new A({body:dr,error:je,url:I});return hr},retryCount:le,retryDelay:c,timeout:Oe,type:"http"},{fetchOptions:n,url:I})}}ne();sr();or();Te();pe();var Le=pt({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});var fr=new Map;async function mt({config:e,address:r,chainId:t,chains:o}){if(fr.has(r))return fr.get(r);if(orbitEvm.createViemClient(t,o)){let i=!!await core.getBytecode(e,{address:r});return fr.set(r,i),i}else return false}function Ds(e){if(!e)throw new Error("Satellite EVM adapter requires a wagmi config object.");return {key:orbitCore.OrbitAdapter.EVM,connect:async({walletType:r,chainId:t,connectors:o})=>{let n=o.find(s=>satelliteCore.getWalletTypeFromConnectorName(orbitCore.OrbitAdapter.EVM,s.name)===r);if(!n)throw new Error("Cannot find connector with this wallet type");try{await core.connect(e,{connector:n,chainId:t});let s=core.getAccount(e);return {walletType:r,address:s.address??ue,chainId:s.chainId??Le.id,rpcURL:s.chain?.rpcUrls.default.http[0]??Le.rpcUrls.default.http[0],isConnected:s.isConnected,isContractAddress:!1}}catch(s){throw new Error(s instanceof Error?s.message:String(s))}},disconnect:async()=>{core.getAccount(e).isConnected&&await core.disconnect(e);},getConnectors:async()=>{let r=core.getConnectors(e);return {adapter:orbitCore.OrbitAdapter.EVM,connectors:r.map(t=>t)}},checkAndSwitchNetwork:async r=>await orbitEvm.checkAndSwitchChain(r,e),getExplorerUrl:r=>{let{chain:t}=core.getAccount(e),o=t?.blockExplorers?.default.url;return r?`${o}/${r}`:o},getName:r=>orbitEvm.getName(r),getAvatar:r=>orbitEvm.getAvatar(r),checkIsContractWallet:async({address:r,chainId:t})=>{let o=core.getChains(e);return await mt({config:e,address:r,chainId:t,chains:o})}}}xe.type="impersonated";function xe(e){let r=e.features??{},t=false,o,n;return core.createConnector(s=>({id:"impersonated",name:"Impersonated Connector",type:xe.type,async setup(){o=s.chains[0].id;},async connect({chainId:i}={}){if(r.connectError)throw typeof r.connectError=="boolean"?new g(new Error("Failed to connect.")):r.connectError;let{request:a}=await this.getProvider(),m=await a({method:"eth_requestAccounts"}),f=await this.getChainId();return i&&f!==i&&(f=(await this.switchChain({chainId:i})).id),t=true,{accounts:m,chainId:f}},async disconnect(){t=false,n=void 0;},async getAccounts(){if(!t)throw new Error("Not connected connector");let{request:i}=await this.getProvider();return (await i({method:"eth_accounts"})).map(Ie)},async getChainId(){let{request:i}=await this.getProvider(),a=await i({method:"eth_chainId"});return ye(a,"number")},async isAuthorized(){return t?!!(await this.getAccounts()).length:false},async switchChain({chainId:i}){let a=s.chains.find(f=>f.id===i);if(!a)throw new k(new core.ChainNotConfiguredError);let{request:m}=await this.getProvider();return await m({method:"wallet_switchEthereumChain",params:[{chainId:U(i)}]}),a},onAccountsChanged(i){i.length===0?this.onDisconnect():s.emitter.emit("change",{accounts:i.map(Ie)});},onChainChanged(i){let a=Number(i);s.emitter.emit("change",{chainId:a});},async onDisconnect(){s.emitter.emit("disconnect"),t=false,n=void 0;},async getProvider({chainId:i}={}){n=e.getAccountAddress()?[e.getAccountAddress()||ue]:void 0;let m=(s.chains.find(c=>c.id===i)??s.chains[0]).rpcUrls.default.http[0];return cr({request:async({method:c,params:x})=>{if(c==="eth_chainId")return U(o);if(c==="eth_requestAccounts")return n;if(c==="eth_signTypedData_v4"&&r.signTypedDataError)throw typeof r.signTypedDataError=="boolean"?new g(new Error("Failed to sign typed data.")):r.signTypedDataError;if(c==="wallet_switchEthereumChain"){if(r.switchChainError)throw typeof r.switchChainError=="boolean"?new g(new Error("Failed to switch chain.")):r.switchChainError;o=ye(x[0].chainId,"number"),this.onChainChanged(o.toString());return}if(c==="personal_sign"){if(r.signMessageError)throw typeof r.signMessageError=="boolean"?new g(new Error("Failed to sign message.")):r.signMessageError;c="eth_sign",x=[x[1],x[0]];}let p={method:c,params:x},{error:u,result:y}=await pr.http(m,{body:p});if(u)throw new A({body:p,error:u,url:m});return y}})({retryCount:1})}}))}var po={allowedDomains:[/gnosis-safe.io$/,/app.safe.global$/,/metissafe.tech$/],debug:false},ut=e=>{let r=connectors.injected(),t=connectors.metaMask({dappMetadata:{name:e.appName,url:e.appUrl}}),o=connectors.coinbaseWallet({appName:e.appName,appLogoUrl:e.appLogoUrl}),n=connectors.safe({...po}),s=[r,t,o,n],i=e.appUrl&&e.appIcons&&e.appName&&e.description?{name:e.appName,description:e.description,url:e.appUrl,icons:e.appIcons}:void 0;if(e.projectId&&!e.getImpersonatedAccount)return [connectors.walletConnect({projectId:e.projectId,metadata:i}),...s];if(!e.projectId&&e.getImpersonatedAccount)return [xe({getAccountAddress:e.getImpersonatedAccount}),...s];if(e.projectId&&e.getImpersonatedAccount){let a=connectors.walletConnect({projectId:e.projectId,metadata:i}),m=xe({getAccountAddress:e.getImpersonatedAccount});return [a,m,...s]}else return s};var mo=e=>e.reduce((r,t)=>{let o=t.id;return r[o]=mr(),r},{}),ti=({chains:e,transports:r,projectId:t,appLogoUrl:o,appLogo:n,appUrl:s,appIcons:i,appName:a,getImpersonatedAccount:m,description:f,...c})=>{let x=ut({projectId:t,appLogoUrl:o,appUrl:s,appIcons:i,appName:a,getImpersonatedAccount:m,description:f});return core.createConfig({connectors:x,transports:r??mo(e),chains:e,...c})};/*! Bundled license information:
|
|
5
|
-
|
|
6
|
-
@noble/hashes/esm/utils.js:
|
|
7
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
8
|
-
*/exports.checkIsWalletAddressContract=mt;exports.createWagmiConfig=ti;exports.initAllConnectors=ut;exports.safeSdkOptions=po;exports.satelliteEVMAdapter=Ds;//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';var orbitCore=require('@tuwaio/orbit-core'),orbitEvm=require('@tuwaio/orbit-evm'),core=require('@wagmi/core'),viem=require('viem'),chains=require('viem/chains'),connectors=require('@wagmi/connectors'),utils=require('viem/utils');var f=new Map;async function y({config:t,address:n,chainId:r,chains:o}){if(f.has(n))return f.get(n);if(orbitEvm.createViemClient(r,o)){let e=!!await core.getBytecode(t,{address:n});return f.set(n,e),e}else return false}function le(t,n){if(!t)throw new Error("Satellite EVM adapter requires a wagmi config object.");return {key:orbitCore.OrbitAdapter.EVM,connect:async({walletType:r,chainId:o})=>{let s=core.getConnectors(t).find(e=>orbitCore.getWalletTypeFromConnectorName(orbitCore.OrbitAdapter.EVM,orbitCore.formatWalletName(e.name))===r);if(!s)throw new Error("Cannot find connector with this wallet type");try{await s.isAuthorized()&&await core.disconnect(t,{connector:s}),await core.connect(t,{connector:s,chainId:o}),n&&!orbitCore.isSafeApp&&await n();let e=core.getAccount(t);return {walletType:r,address:e.address??viem.zeroAddress,chainId:e.chainId??chains.mainnet.id,rpcURL:e.chain?.rpcUrls.default.http[0]??chains.mainnet.rpcUrls.default.http[0],isConnected:e.isConnected,isContractAddress:!1,walletIcon:s?.icon?.trim(),connector:s}}catch(e){throw new Error(e instanceof Error?e.message:String(e))}},disconnect:async()=>{let r=core.getConnectors(t);await Promise.allSettled(r.map(async o=>{await core.disconnect(t,{connector:o});}));},getConnectors:()=>{let r=core.getConnectors(t);return {adapter:orbitCore.OrbitAdapter.EVM,connectors:r.map(o=>o)}},checkAndSwitchNetwork:async r=>await orbitEvm.checkAndSwitchChain(Number(r),t),getBalance:async(r,o)=>{let a=await core.getBalance(t,{address:r,chainId:Number(o)});return {value:viem.formatUnits(a.value,a.decimals),symbol:a.symbol}},getExplorerUrl:r=>{let{chain:o}=core.getAccount(t),a=o?.blockExplorers?.default.url;return r?`${a}/${r}`:a},getName:r=>orbitEvm.getName(r),getAvatar:r=>orbitEvm.getAvatar(r),checkIsContractWallet:async({address:r,chainId:o})=>{let a=core.getChains(t);return await y({config:t,address:r,chainId:o,chains:a})},getSafeConnectorChainId:async()=>{let o=core.getConnectors(t).find(a=>a.name==="Safe");if(o)return await o.getChainId()}}}u.type="impersonated";function u(t){let n=t.features??{},r=false,o,a;return core.createConnector(s=>({id:"impersonated",name:"Impersonated Connector",type:u.type,async setup(){o=s.chains[0].id;},async connect({chainId:e}={}){if(n.connectError)throw typeof n.connectError=="boolean"?new viem.UserRejectedRequestError(new Error("Failed to connect.")):n.connectError;let{request:c}=await this.getProvider(),d=await c({method:"eth_requestAccounts"}),m=await this.getChainId();return e&&m!==e&&(m=(await this.switchChain({chainId:e})).id),r=true,{accounts:d,chainId:m}},async disconnect(){r=false,a=void 0;},async getAccounts(){if(!r)throw new Error("Not connected connector");let{request:e}=await this.getProvider();return (await e({method:"eth_accounts"})).map(viem.getAddress)},async getChainId(){let{request:e}=await this.getProvider(),c=await e({method:"eth_chainId"});return viem.fromHex(c,"number")},async isAuthorized(){return r?!!(await this.getAccounts()).length:false},async switchChain({chainId:e}){let c=s.chains.find(m=>m.id===e);if(!c)throw new viem.SwitchChainError(new core.ChainNotConfiguredError);let{request:d}=await this.getProvider();return await d({method:"wallet_switchEthereumChain",params:[{chainId:viem.numberToHex(e)}]}),c},onAccountsChanged(e){e.length===0?this.onDisconnect():s.emitter.emit("change",{accounts:e.map(viem.getAddress)});},onChainChanged(e){let c=Number(e);s.emitter.emit("change",{chainId:c});},async onDisconnect(){s.emitter.emit("disconnect"),r=false,a=void 0;},async getProvider({chainId:e}={}){a=orbitCore.impersonatedHelpers?.getImpersonated()?[orbitCore.impersonatedHelpers.getImpersonated()||viem.zeroAddress]:void 0;let d=(s.chains.find(i=>i.id===e)??s.chains[0]).rpcUrls.default.http[0];return viem.custom({request:async({method:i,params:h})=>{if(i==="eth_chainId")return viem.numberToHex(o);if(i==="eth_requestAccounts")return a;if(i==="eth_signTypedData_v4"&&n.signTypedDataError)throw typeof n.signTypedDataError=="boolean"?new viem.UserRejectedRequestError(new Error("Failed to sign typed data.")):n.signTypedDataError;if(i==="wallet_switchEthereumChain"){if(n.switchChainError)throw typeof n.switchChainError=="boolean"?new viem.UserRejectedRequestError(new Error("Failed to switch chain.")):n.switchChainError;o=viem.fromHex(h[0].chainId,"number"),this.onChainChanged(o.toString());return}if(i==="personal_sign"){if(n.signMessageError)throw typeof n.signMessageError=="boolean"?new viem.UserRejectedRequestError(new Error("Failed to sign message.")):n.signMessageError;i="eth_sign",h=[h[1],h[0]];}let C={method:i,params:h},{error:g,result:S}=await utils.rpc.http(d,{body:C});if(g)throw new viem.RpcRequestError({body:C,error:g,url:d});return S}})({retryCount:1})}}))}var Y={allowedDomains:[/gnosis-safe.io$/,/app.safe.global$/,/metissafe.tech$/],debug:false},be=t=>{let n=connectors.injected(),r=connectors.coinbaseWallet({appName:t.appName,appLogoUrl:t.appLogoUrl}),o=connectors.safe({...Y}),a=[n,r,o,u({})],s=t.appUrl&&t.appIcons&&t.appName&&t.description?{name:t.appName,description:t.description,url:t.appUrl,icons:t.appIcons}:void 0;if(t.projectId){let e=connectors.walletConnect({projectId:t.projectId,metadata:s});a.push(e);}return a};var xe=t=>t.reduce((n,r)=>{let o=r.id;return n[o]=viem.http(),n},{});exports.checkIsWalletAddressContract=y;exports.createDefaultTransports=xe;exports.initAllConnectors=be;exports.safeSdkOptions=Y;exports.satelliteEVMAdapter=le;//# sourceMappingURL=index.js.map
|
|
9
2
|
//# sourceMappingURL=index.js.map
|