@openfort/openfort-js 0.8.30 → 0.8.31
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/cjs/sdk/src/evm/evmProvider.js +1 -1
- package/dist/cjs/sdk/src/evm/provider/eip6963.js +1 -1
- package/dist/cjs/sdk/src/evm/sendCalls.js +1 -1
- package/dist/cjs/sdk/src/version.js +1 -1
- package/dist/index.d.ts +0 -41
- package/dist/sdk/src/evm/evmProvider.js +1 -1
- package/dist/sdk/src/evm/provider/eip6963.js +1 -1
- package/dist/sdk/src/evm/sendCalls.js +1 -1
- package/dist/sdk/src/version.js +1 -1
- package/package.json +4 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@ethersproject/providers"),r=require("@ethersproject/bytes"),t=require("../configuration/authentication.js"),
|
|
1
|
+
"use strict";var e=require("@ethersproject/providers"),r=require("@ethersproject/bytes"),t=require("../configuration/authentication.js"),a=require("./types.js"),s=require("./JsonRpcError.js"),o=require("./signTypedDataV4.js"),i=require("../types.js"),n=require("../utils/typedEventEmitter.js"),c=require("../chains/index.js"),h=require("../configuration/account.js"),d=require("../manager/signer.js"),u=require("../storage/istorage.js"),g=require("./addEthereumChain.js"),l=require("./registerSession.js"),p=require("./revokeSession.js"),m=require("./sendCalls.js"),E=require("./getCallsStatus.js"),f=require("./personalSign.js"),A=require("./estimateGas.js");exports.EvmProvider=class{#e;#r;updatePolicy(e){this.#r=e}#t;#a;#s;#o;isOpenfort=!0;constructor({storage:r,backendApiClients:t,openfortEventEmitter:a,policyId:s,validateAndRefreshSession:o}){this.#e=r,this.#r=s,this.#t=o,this.#o=t;const d=h.Account.fromStorage(this.#e),u=d?.chainId||8453;this.#s=new e.StaticJsonRpcProvider(c.chainRpcs[u]),this.#o=t,this.#a=new n,a.on(i.OpenfortEvents.LOGGED_OUT,this.#i)}#i=()=>{const e=!!h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage();r?.logout(),this.#e.remove(u.StorageKeys.ACCOUNT),this.#e.remove(u.StorageKeys.AUTHENTICATION),this.#e.remove(u.StorageKeys.SIGNER),e&&this.#a.emit(a.ProviderEvent.ACCOUNTS_CHANGED,[])};async#n(i){switch(i.method){case"eth_accounts":{const e=h.Account.fromStorage(this.#e);return e?[e.address]:[]}case"eth_requestAccounts":{let e=h.Account.fromStorage(this.#e);if(e)return this.#a.emit(a.ProviderEvent.ACCOUNTS_CONNECT,{chainId:r.hexlify(e.chainId)}),[e.address];if(!d.SignerManager.fromStorage())throw new s.JsonRpcError(s.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer");if(await d.SignerManager.embedded(),e=h.Account.fromStorage(this.#e),!e)throw new s.JsonRpcError(s.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - no account available");return this.#a.emit(a.ProviderEvent.ACCOUNTS_CHANGED,[e.address]),[e.address]}case"eth_sendTransaction":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage(),a=t.Authentication.fromStorage(this.#e);if(!e||!r||!a)throw new s.JsonRpcError(s.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await m.sendCalls({params:i.params||[],signer:r,account:e,authentication:a,backendClient:this.#o,policyId:this.#r})}case"eth_estimateGas":{const e=h.Account.fromStorage(this.#e),r=t.Authentication.fromStorage(this.#e);if(!e||!r)throw new s.JsonRpcError(s.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await A.estimateGas({params:i.params||[],account:e,authentication:r,backendClient:this.#o,policyId:this.#r})}case"eth_signTypedData":case"eth_signTypedData_v4":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage();if(!e||!r)throw new s.JsonRpcError(s.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await o.signTypedDataV4({method:i.method,params:i.params||[],signer:r,accountType:e.type,rpcProvider:this.#s})}case"personal_sign":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage();if(!e||!r)throw new s.JsonRpcError(s.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await f.personalSign({params:i.params||[],signer:r,account:e})}case"eth_chainId":{const{chainId:e}=await this.#s.detectNetwork();return r.hexlify(e)}case"wallet_switchEthereumChain":{const r=d.SignerManager.fromStorage();if(!r)throw new s.JsonRpcError(s.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer");if(!i.params||!Array.isArray(i.params)||0===i.params.length)throw new s.JsonRpcError(s.RpcErrorCode.INVALID_PARAMS,"Invalid parameters for wallet_switchEthereumChain");this.#t();try{const t=parseInt(i.params[0].chainId,16);await r.switchChain({chainId:t}),this.#s=new e.StaticJsonRpcProvider(c.chainRpcs[t])}catch(e){throw new s.JsonRpcError(s.RpcErrorCode.INTERNAL_ERROR,"Failed to switch chain")}return null}case"wallet_addEthereumChain":if(!d.SignerManager.fromStorage())throw new s.JsonRpcError(s.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer");return await g.addEthereumChain({params:i.params||[],rpcProvider:this.#s});case"wallet_showCallsStatus":return null;case"wallet_getCallsStatus":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage(),a=t.Authentication.fromStorage(this.#e);if(!e||!r||!a)throw new s.JsonRpcError(s.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await E.getCallStatus({params:i.params||{},authentication:a,backendClient:this.#o,account:e})}case"wallet_sendCalls":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage(),a=t.Authentication.fromStorage(this.#e);if(!e||!r||!a)throw new s.JsonRpcError(s.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await m.sendCalls({params:i.params?i.params[0].calls:[],signer:r,account:e,authentication:a,backendClient:this.#o,policyId:this.#r})}case"wallet_grantPermissions":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage(),a=t.Authentication.fromStorage(this.#e);if(!e||!r||!a)throw new s.JsonRpcError(s.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await l.registerSession({params:i.params||[],signer:r,account:e,authentication:a,backendClient:this.#o,policyId:this.#r})}case"wallet_revokePermissions":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage(),a=t.Authentication.fromStorage(this.#e);if(!e||!r||!a)throw new s.JsonRpcError(s.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await p.revokeSession({params:i.params||[],signer:r,account:e,authentication:a,backendClient:this.#o})}case"wallet_getCapabilities":{const{chainId:e}=await this.#s.detectNetwork();return{[r.hexlify(e)]:{permissions:{supported:!0,signerTypes:["account","key"],keyTypes:["secp256k1"],permissionTypes:["contract-calls"]},paymasterService:{supported:!0},atomicBatch:{supported:!0}}}}case"eth_gasPrice":case"eth_getBalance":case"eth_getCode":case"eth_getStorageAt":case"eth_call":case"eth_blockNumber":case"eth_getBlockByHash":case"eth_getBlockByNumber":case"eth_getTransactionByHash":case"eth_getTransactionReceipt":case"eth_getTransactionCount":return this.#s.send(i.method,i.params||[]);default:throw new s.JsonRpcError(s.ProviderErrorCode.UNSUPPORTED_METHOD,`${i.method}: Method not supported`)}}async request(e){try{return this.#n(e)}catch(e){if(e instanceof s.JsonRpcError)throw e;if(e instanceof Error)throw new s.JsonRpcError(s.RpcErrorCode.INTERNAL_ERROR,e.message);throw new s.JsonRpcError(s.RpcErrorCode.INTERNAL_ERROR,"Internal error")}}on(e,r){this.#a.on(e,r)}removeListener(e,r){this.#a.removeListener(e,r)}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e={icon:'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="597.32 331.34 171.36 105.32" ><g><rect x="673.9" y="404.26" width="18.2" height="32.4" /><polygon points="768.68,331.36 768.68,331.36 768.68,331.34 610.78,331.34 610.78,331.36 597.32,331.36 597.32,436.64 615.52,436.64 615.52,349.54 750.48,349.54 750.48,436.64 768.68,436.64 " /><polygon points="732.16,367.79 633.83,367.79 633.83,370.19 633.79,370.19 633.79,436.64 651.99,436.64 651.99,385.99 713.9,385.99 713.9,436.64 732.09,436.64 732.09,385.99 732.16,385.99 " /></g></svg>',name:"Openfort",rdns:"xyz.openfort",uuid:
|
|
1
|
+
"use strict";const e={icon:'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="597.32 331.34 171.36 105.32" ><g><rect x="673.9" y="404.26" width="18.2" height="32.4" /><polygon points="768.68,331.36 768.68,331.36 768.68,331.34 610.78,331.34 610.78,331.36 597.32,331.36 597.32,436.64 615.52,436.64 615.52,349.54 750.48,349.54 750.48,436.64 768.68,436.64 " /><polygon points="732.16,367.79 633.83,367.79 633.83,370.19 633.79,370.19 633.79,436.64 651.99,436.64 651.99,385.99 713.9,385.99 713.9,436.64 732.09,436.64 732.09,385.99 732.16,385.99 " /></g></svg>',name:"Openfort",rdns:"xyz.openfort",uuid:crypto.randomUUID()};exports.announceProvider=function(e){if("undefined"==typeof window)return;const n=new CustomEvent("eip6963:announceProvider",{detail:Object.freeze(e)});window.dispatchEvent(n),window.addEventListener("eip6963:requestProvider",(()=>window.dispatchEvent(n)))},exports.openfortProviderInfo=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var r=require("../errors/openfortError.js"),
|
|
1
|
+
"use strict";var r=require("../errors/openfortError.js"),e=require("./JsonRpcError.js");exports.sendCalls=async({params:a,signer:t,account:n,authentication:o,backendClient:s,policyId:i})=>{const c=a[0]?.capabilities?.paymasterService?.policy??i,p=await(async(a,t,n,o,s)=>{const i=a.map((r=>{if(!r.to)throw new e.JsonRpcError(e.RpcErrorCode.INVALID_PARAMS,'wallet_sendCalls requires a "to" field');return{to:String(r.to),data:r.data?String(r.data):void 0,value:r.value?String(r.value):void 0}}));return r.withOpenfortError((async()=>(await t.transactionIntentsApi.createTransactionIntent({createTransactionIntentRequest:{policy:s,chainId:n.chainId,interactions:i}},{headers:{authorization:`Bearer ${t.config.backend.accessToken}`,"x-player-token":o.token,"x-auth-provider":o.thirdPartyProvider,"x-token-type":o.thirdPartyTokenType}})).data),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR})})(a,s,n,o,c).catch((r=>{throw new e.JsonRpcError(e.RpcErrorCode.TRANSACTION_REJECTED,r.message)}));if(p.response?.error.reason)throw new e.JsonRpcError(e.RpcErrorCode.TRANSACTION_REJECTED,p.response?.error.reason);if(p?.nextAction?.payload?.signableHash){let a;a=[300,531050104,324,50104,2741,11124].includes(n.chainId)?await t.sign(p.nextAction.payload.signableHash,!1,!1):await t.sign(p.nextAction.payload.signableHash);const o=await r.withOpenfortError((async()=>await s.transactionIntentsApi.signature({id:p.id,signatureRequest:{signature:a}})),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR}).catch((r=>{throw new e.JsonRpcError(e.RpcErrorCode.TRANSACTION_REJECTED,r.message)}));if(0===o.data.response?.status)throw new e.JsonRpcError(e.RpcErrorCode.TRANSACTION_REJECTED,o.data.response?.error.reason);return o.data.response?.transactionHash}return p.response?.transactionHash};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.VERSION="0.8.
|
|
1
|
+
"use strict";exports.VERSION="0.8.31";
|
package/dist/index.d.ts
CHANGED
|
@@ -472,32 +472,6 @@ declare class SDKConfiguration {
|
|
|
472
472
|
constructor({ baseConfiguration, shieldConfiguration, overrides, }: OpenfortSDKConfiguration);
|
|
473
473
|
}
|
|
474
474
|
|
|
475
|
-
/**
|
|
476
|
-
* ProviderErrors should take priority over RpcErrorCodes
|
|
477
|
-
* https://eips.ethereum.org/EIPS/eip-1193#provider-errors
|
|
478
|
-
* https://eips.ethereum.org/EIPS/eip-1474#error-codes
|
|
479
|
-
*/
|
|
480
|
-
declare enum ProviderErrorCode {
|
|
481
|
-
USER_REJECTED_REQUEST = 4001,
|
|
482
|
-
UNAUTHORIZED = 4100,
|
|
483
|
-
UNSUPPORTED_METHOD = 4200,
|
|
484
|
-
DISCONNECTED = 4900
|
|
485
|
-
}
|
|
486
|
-
declare enum RpcErrorCode {
|
|
487
|
-
RPC_SERVER_ERROR = -32000,
|
|
488
|
-
INVALID_REQUEST = -32600,
|
|
489
|
-
METHOD_NOT_FOUND = -32601,
|
|
490
|
-
INVALID_PARAMS = -32602,
|
|
491
|
-
INTERNAL_ERROR = -32603,
|
|
492
|
-
PARSE_ERROR = -32700,
|
|
493
|
-
TRANSACTION_REJECTED = -32003
|
|
494
|
-
}
|
|
495
|
-
declare class JsonRpcError extends Error {
|
|
496
|
-
readonly message: string;
|
|
497
|
-
readonly code: ProviderErrorCode | RpcErrorCode;
|
|
498
|
-
constructor(code: ProviderErrorCode | RpcErrorCode, message: string);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
475
|
interface TypedDataPayload {
|
|
502
476
|
types: {
|
|
503
477
|
[K in string]: Array<{
|
|
@@ -524,23 +498,8 @@ interface RequestArguments {
|
|
|
524
498
|
method: string;
|
|
525
499
|
params?: Array<any>;
|
|
526
500
|
}
|
|
527
|
-
type JsonRpcRequestPayload = RequestArguments & {
|
|
528
|
-
jsonrpc?: string;
|
|
529
|
-
id?: string | number;
|
|
530
|
-
};
|
|
531
|
-
interface JsonRpcRequestCallback {
|
|
532
|
-
(err: JsonRpcError | null, result?: JsonRpcResponsePayload | (JsonRpcResponsePayload | null)[] | null): void;
|
|
533
|
-
}
|
|
534
|
-
interface JsonRpcResponsePayload {
|
|
535
|
-
result?: Array<any> | null;
|
|
536
|
-
error?: JsonRpcError | null;
|
|
537
|
-
jsonrpc?: string;
|
|
538
|
-
id?: string | number;
|
|
539
|
-
}
|
|
540
501
|
type Provider = {
|
|
541
502
|
request: (request: RequestArguments) => Promise<any>;
|
|
542
|
-
sendAsync: (request: JsonRpcRequestPayload | JsonRpcRequestPayload[], callback: JsonRpcRequestCallback) => void;
|
|
543
|
-
send: (request: string | JsonRpcRequestPayload | JsonRpcRequestPayload[], callbackOrParams?: JsonRpcRequestCallback | Array<any>, callback?: JsonRpcRequestCallback) => void;
|
|
544
503
|
on: (event: string, listener: (...args: any[]) => void) => void;
|
|
545
504
|
removeListener: (event: string, listener: (...args: any[]) => void) => void;
|
|
546
505
|
isOpenfort: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{StaticJsonRpcProvider as t}from"@ethersproject/providers";import{hexlify as e}from"@ethersproject/bytes";import{Authentication as r}from"../configuration/authentication.js";import{ProviderEvent as
|
|
1
|
+
import{StaticJsonRpcProvider as t}from"@ethersproject/providers";import{hexlify as e}from"@ethersproject/bytes";import{Authentication as r}from"../configuration/authentication.js";import{ProviderEvent as a}from"./types.js";import{JsonRpcError as s,ProviderErrorCode as i,RpcErrorCode as o}from"./JsonRpcError.js";import{signTypedDataV4 as n}from"./signTypedDataV4.js";import{OpenfortEvents as c}from"../types.js";import h from"../utils/typedEventEmitter.js";import{chainRpcs as m}from"../chains/index.js";import{Account as d}from"../configuration/account.js";import{SignerManager as l}from"../manager/signer.js";import{StorageKeys as p}from"../storage/istorage.js";import{addEthereumChain as u}from"./addEthereumChain.js";import{registerSession as g}from"./registerSession.js";import{revokeSession as f}from"./revokeSession.js";import{sendCalls as w}from"./sendCalls.js";import{getCallStatus as A}from"./getCallsStatus.js";import{personalSign as S}from"./personalSign.js";import{estimateGas as _}from"./estimateGas.js";class U{#t;#e;updatePolicy(t){this.#e=t}#r;#a;#s;#i;isOpenfort=!0;constructor({storage:e,backendApiClients:r,openfortEventEmitter:a,policyId:s,validateAndRefreshSession:i}){this.#t=e,this.#e=s,this.#r=i,this.#i=r;const o=d.fromStorage(this.#t),n=o?.chainId||8453;this.#s=new t(m[n]),this.#i=r,this.#a=new h,a.on(c.LOGGED_OUT,this.#o)}#o=()=>{const t=!!d.fromStorage(this.#t),e=l.fromStorage();e?.logout(),this.#t.remove(p.ACCOUNT),this.#t.remove(p.AUTHENTICATION),this.#t.remove(p.SIGNER),t&&this.#a.emit(a.ACCOUNTS_CHANGED,[])};async#n(c){switch(c.method){case"eth_accounts":{const t=d.fromStorage(this.#t);return t?[t.address]:[]}case"eth_requestAccounts":{let t=d.fromStorage(this.#t);if(t)return this.#a.emit(a.ACCOUNTS_CONNECT,{chainId:e(t.chainId)}),[t.address];if(!l.fromStorage())throw new s(i.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer");if(await l.embedded(),t=d.fromStorage(this.#t),!t)throw new s(i.UNAUTHORIZED,"Unauthorized - no account available");return this.#a.emit(a.ACCOUNTS_CHANGED,[t.address]),[t.address]}case"eth_sendTransaction":{const t=d.fromStorage(this.#t),e=l.fromStorage(),a=r.fromStorage(this.#t);if(!t||!e||!a)throw new s(i.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await w({params:c.params||[],signer:e,account:t,authentication:a,backendClient:this.#i,policyId:this.#e})}case"eth_estimateGas":{const t=d.fromStorage(this.#t),e=r.fromStorage(this.#t);if(!t||!e)throw new s(i.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await _({params:c.params||[],account:t,authentication:e,backendClient:this.#i,policyId:this.#e})}case"eth_signTypedData":case"eth_signTypedData_v4":{const t=d.fromStorage(this.#t),e=l.fromStorage();if(!t||!e)throw new s(i.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await n({method:c.method,params:c.params||[],signer:e,accountType:t.type,rpcProvider:this.#s})}case"personal_sign":{const t=d.fromStorage(this.#t),e=l.fromStorage();if(!t||!e)throw new s(i.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await S({params:c.params||[],signer:e,account:t})}case"eth_chainId":{const{chainId:t}=await this.#s.detectNetwork();return e(t)}case"wallet_switchEthereumChain":{const e=l.fromStorage();if(!e)throw new s(i.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer");if(!c.params||!Array.isArray(c.params)||0===c.params.length)throw new s(o.INVALID_PARAMS,"Invalid parameters for wallet_switchEthereumChain");this.#r();try{const r=parseInt(c.params[0].chainId,16);await e.switchChain({chainId:r}),this.#s=new t(m[r])}catch(t){throw new s(o.INTERNAL_ERROR,"Failed to switch chain")}return null}case"wallet_addEthereumChain":if(!l.fromStorage())throw new s(i.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer");return await u({params:c.params||[],rpcProvider:this.#s});case"wallet_showCallsStatus":return null;case"wallet_getCallsStatus":{const t=d.fromStorage(this.#t),e=l.fromStorage(),a=r.fromStorage(this.#t);if(!t||!e||!a)throw new s(i.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await A({params:c.params||{},authentication:a,backendClient:this.#i,account:t})}case"wallet_sendCalls":{const t=d.fromStorage(this.#t),e=l.fromStorage(),a=r.fromStorage(this.#t);if(!t||!e||!a)throw new s(i.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await w({params:c.params?c.params[0].calls:[],signer:e,account:t,authentication:a,backendClient:this.#i,policyId:this.#e})}case"wallet_grantPermissions":{const t=d.fromStorage(this.#t),e=l.fromStorage(),a=r.fromStorage(this.#t);if(!t||!e||!a)throw new s(i.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await g({params:c.params||[],signer:e,account:t,authentication:a,backendClient:this.#i,policyId:this.#e})}case"wallet_revokePermissions":{const t=d.fromStorage(this.#t),e=l.fromStorage(),a=r.fromStorage(this.#t);if(!t||!e||!a)throw new s(i.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await f({params:c.params||[],signer:e,account:t,authentication:a,backendClient:this.#i})}case"wallet_getCapabilities":{const{chainId:t}=await this.#s.detectNetwork();return{[e(t)]:{permissions:{supported:!0,signerTypes:["account","key"],keyTypes:["secp256k1"],permissionTypes:["contract-calls"]},paymasterService:{supported:!0},atomicBatch:{supported:!0}}}}case"eth_gasPrice":case"eth_getBalance":case"eth_getCode":case"eth_getStorageAt":case"eth_call":case"eth_blockNumber":case"eth_getBlockByHash":case"eth_getBlockByNumber":case"eth_getTransactionByHash":case"eth_getTransactionReceipt":case"eth_getTransactionCount":return this.#s.send(c.method,c.params||[]);default:throw new s(i.UNSUPPORTED_METHOD,`${c.method}: Method not supported`)}}async request(t){try{return this.#n(t)}catch(t){if(t instanceof s)throw t;if(t instanceof Error)throw new s(o.INTERNAL_ERROR,t.message);throw new s(o.INTERNAL_ERROR,"Internal error")}}on(t,e){this.#a.on(t,e)}removeListener(t,e){this.#a.removeListener(t,e)}}export{U as EvmProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const e={icon:'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="597.32 331.34 171.36 105.32" ><g><rect x="673.9" y="404.26" width="18.2" height="32.4" /><polygon points="768.68,331.36 768.68,331.36 768.68,331.34 610.78,331.34 610.78,331.36 597.32,331.36 597.32,436.64 615.52,436.64 615.52,349.54 750.48,349.54 750.48,436.64 768.68,436.64 " /><polygon points="732.16,367.79 633.83,367.79 633.83,370.19 633.79,370.19 633.79,436.64 651.99,436.64 651.99,385.99 713.9,385.99 713.9,436.64 732.09,436.64 732.09,385.99 732.16,385.99 " /></g></svg>',name:"Openfort",rdns:"xyz.openfort",uuid:crypto.randomUUID()};function n(e){if("undefined"==typeof window)return;const n=new CustomEvent("eip6963:announceProvider",{detail:Object.freeze(e)});window.dispatchEvent(n);window.addEventListener("eip6963:requestProvider",(()=>window.dispatchEvent(n)))}export{n as announceProvider,e as openfortProviderInfo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withOpenfortError as a,OpenfortErrorType as t}from"../errors/openfortError.js";import{JsonRpcError as e,RpcErrorCode as n}from"./JsonRpcError.js";const r=async({params:r,signer:
|
|
1
|
+
import{withOpenfortError as a,OpenfortErrorType as t}from"../errors/openfortError.js";import{JsonRpcError as e,RpcErrorCode as n}from"./JsonRpcError.js";const r=async({params:r,signer:s,account:o,authentication:i,backendClient:c,policyId:d})=>{const p=r[0]?.capabilities?.paymasterService?.policy??d,l=await(async(r,s,o,i,c)=>{const d=r.map((a=>{if(!a.to)throw new e(n.INVALID_PARAMS,'wallet_sendCalls requires a "to" field');return{to:String(a.to),data:a.data?String(a.data):void 0,value:a.value?String(a.value):void 0}}));return a((async()=>(await s.transactionIntentsApi.createTransactionIntent({createTransactionIntentRequest:{policy:c,chainId:o.chainId,interactions:d}},{headers:{authorization:`Bearer ${s.config.backend.accessToken}`,"x-player-token":i.token,"x-auth-provider":i.thirdPartyProvider,"x-token-type":i.thirdPartyTokenType}})).data),{default:t.AUTHENTICATION_ERROR})})(r,c,o,i,p).catch((a=>{throw new e(n.TRANSACTION_REJECTED,a.message)}));if(l.response?.error.reason)throw new e(n.TRANSACTION_REJECTED,l.response?.error.reason);if(l?.nextAction?.payload?.signableHash){let r;r=[300,531050104,324,50104,2741,11124].includes(o.chainId)?await s.sign(l.nextAction.payload.signableHash,!1,!1):await s.sign(l.nextAction.payload.signableHash);const i=await a((async()=>await c.transactionIntentsApi.signature({id:l.id,signatureRequest:{signature:r}})),{default:t.AUTHENTICATION_ERROR}).catch((a=>{throw new e(n.TRANSACTION_REJECTED,a.message)}));if(0===i.data.response?.status)throw new e(n.TRANSACTION_REJECTED,i.data.response?.error.reason);return i.data.response?.transactionHash}return l.response?.transactionHash};export{r as sendCalls};
|
package/dist/sdk/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="0.8.
|
|
1
|
+
const o="0.8.31";export{o as VERSION};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfort/openfort-js",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.31",
|
|
4
4
|
"author": "Openfort (https://www.openfort.io)",
|
|
5
5
|
"bugs": "https://github.com/openfort-xyz/openfort-js/issues",
|
|
6
6
|
"repository": "openfort-xyz/openfort-js.git",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@ethersproject/signing-key": "^5.8.0",
|
|
40
40
|
"@ethersproject/transactions": "^5.8.0",
|
|
41
41
|
"@noble/curves": "^1.1.0",
|
|
42
|
-
"@openfort/shield-js": "^0.1.
|
|
43
|
-
"axios": "1.
|
|
42
|
+
"@openfort/shield-js": "^0.1.14",
|
|
43
|
+
"axios": "1.8.2",
|
|
44
44
|
"buffer": "^6.0.3",
|
|
45
45
|
"crypto-browserify": "^3.12.0",
|
|
46
46
|
"crypto-js": "^4.2.0",
|
|
@@ -48,8 +48,7 @@
|
|
|
48
48
|
"jose": "^5.2.2",
|
|
49
49
|
"jsrsasign": "^11.1.0",
|
|
50
50
|
"path": "^0.12.7",
|
|
51
|
-
"stream-browserify": "^3.0.0"
|
|
52
|
-
"uuid": "^8.3.2"
|
|
51
|
+
"stream-browserify": "^3.0.0"
|
|
53
52
|
},
|
|
54
53
|
"exports": {
|
|
55
54
|
"./package.json": "./package.json",
|
|
@@ -75,7 +74,6 @@
|
|
|
75
74
|
"@types/crypto-js": "^4.2.2",
|
|
76
75
|
"@types/jest": "^29.4.3",
|
|
77
76
|
"@types/jsrsasign": "^10.5.15",
|
|
78
|
-
"@types/uuid": "^8.3.4",
|
|
79
77
|
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
80
78
|
"@typescript-eslint/parser": "^5.57.1",
|
|
81
79
|
"buffer": "^5.5.0||^6.0.0",
|