@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.
@@ -1 +1 @@
1
- "use strict";var e=require("@ethersproject/providers"),r=require("@ethersproject/bytes"),t=require("../configuration/authentication.js"),s=require("./types.js"),o=require("./JsonRpcError.js"),a=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"),p=require("./addEthereumChain.js"),l=require("./registerSession.js"),g=require("./revokeSession.js"),m=require("./sendCalls.js"),f=require("./getCallsStatus.js"),E=require("./personalSign.js"),A=require("./estimateGas.js");exports.EvmProvider=class{#e;#r;updatePolicy(e){this.#r=e}#t;#s;#o;#a;isOpenfort=!0;constructor({storage:r,backendApiClients:t,openfortEventEmitter:s,policyId:o,validateAndRefreshSession:a}){this.#e=r,this.#r=o,this.#t=a,this.#a=t;const d=h.Account.fromStorage(this.#e),u=d?.chainId||8453;this.#o=new e.StaticJsonRpcProvider(c.chainRpcs[u]),this.#a=t,this.#s=new n,s.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.#s.emit(s.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.#s.emit(s.ProviderEvent.ACCOUNTS_CONNECT,{chainId:r.hexlify(e.chainId)}),[e.address];if(!d.SignerManager.fromStorage())throw new o.JsonRpcError(o.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 o.JsonRpcError(o.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - no account available");return this.#s.emit(s.ProviderEvent.ACCOUNTS_CHANGED,[e.address]),[e.address]}case"eth_sendTransaction":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage(),s=t.Authentication.fromStorage(this.#e);if(!e||!r||!s)throw new o.JsonRpcError(o.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await m.sendCalls({params:i.params||[],signer:r,account:e,authentication:s,backendClient:this.#a,policyId:this.#r})}case"eth_estimateGas":{const e=h.Account.fromStorage(this.#e),r=t.Authentication.fromStorage(this.#e);if(!e||!r)throw new o.JsonRpcError(o.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await A.estimateGas({params:i.params||[],account:e,authentication:r,backendClient:this.#a,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 o.JsonRpcError(o.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await a.signTypedDataV4({method:i.method,params:i.params||[],signer:r,accountType:e.type,rpcProvider:this.#o})}case"personal_sign":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage();if(!e||!r)throw new o.JsonRpcError(o.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await E.personalSign({params:i.params||[],signer:r,account:e})}case"eth_chainId":{const{chainId:e}=await this.#o.detectNetwork();return r.hexlify(e)}case"wallet_switchEthereumChain":{const r=d.SignerManager.fromStorage();if(!r)throw new o.JsonRpcError(o.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer");if(!i.params||!Array.isArray(i.params)||0===i.params.length)throw new o.JsonRpcError(o.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.#o=new e.StaticJsonRpcProvider(c.chainRpcs[t])}catch(e){throw new o.JsonRpcError(o.RpcErrorCode.INTERNAL_ERROR,"Failed to switch chain")}return null}case"wallet_addEthereumChain":if(!d.SignerManager.fromStorage())throw new o.JsonRpcError(o.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer");return await p.addEthereumChain({params:i.params||[],rpcProvider:this.#o});case"wallet_showCallsStatus":return null;case"wallet_getCallsStatus":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage(),s=t.Authentication.fromStorage(this.#e);if(!e||!r||!s)throw new o.JsonRpcError(o.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await f.getCallStatus({params:i.params||{},authentication:s,backendClient:this.#a,account:e})}case"wallet_sendCalls":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage(),s=t.Authentication.fromStorage(this.#e);if(!e||!r||!s)throw new o.JsonRpcError(o.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:s,backendClient:this.#a,policyId:this.#r})}case"wallet_grantPermissions":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage(),s=t.Authentication.fromStorage(this.#e);if(!e||!r||!s)throw new o.JsonRpcError(o.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await l.registerSession({params:i.params||[],signer:r,account:e,authentication:s,backendClient:this.#a,policyId:this.#r})}case"wallet_revokePermissions":{const e=h.Account.fromStorage(this.#e),r=d.SignerManager.fromStorage(),s=t.Authentication.fromStorage(this.#e);if(!e||!r||!s)throw new o.JsonRpcError(o.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#t(),await g.revokeSession({params:i.params||[],signer:r,account:e,authentication:s,backendClient:this.#a})}case"wallet_getCapabilities":{const{chainId:e}=await this.#o.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.#o.send(i.method,i.params||[]);default:throw new o.JsonRpcError(o.ProviderErrorCode.UNSUPPORTED_METHOD,`${i.method}: Method not supported`)}}async#c(e){const{id:r,jsonrpc:t}=e;try{return{id:r,jsonrpc:t,result:await this.#n(e)}}catch(e){let s;return s=e instanceof o.JsonRpcError?e:e instanceof Error?new o.JsonRpcError(o.RpcErrorCode.INTERNAL_ERROR,e.message):new o.JsonRpcError(o.RpcErrorCode.INTERNAL_ERROR,"Internal error"),{id:r,jsonrpc:t,error:s}}}async request(e){try{return this.#n(e)}catch(e){if(e instanceof o.JsonRpcError)throw e;if(e instanceof Error)throw new o.JsonRpcError(o.RpcErrorCode.INTERNAL_ERROR,e.message);throw new o.JsonRpcError(o.RpcErrorCode.INTERNAL_ERROR,"Internal error")}}sendAsync(e,r){if(!r)throw new Error("No callback provided");Array.isArray(e)?Promise.all(e.map(this.#c)).then((e=>{r(null,e)})).catch((e=>{r(e,[])})):this.#c(e).then((e=>{r(null,e)})).catch((e=>{r(e,null)}))}async send(e,r,t){if("string"==typeof e)return"function"==typeof r?this.sendAsync({method:e,params:[]},r):t?this.sendAsync({method:e,params:Array.isArray(r)?r:[]},t):this.request({method:e,params:Array.isArray(r)?r:[]});if("function"==typeof r)return this.sendAsync(e,r);if(!Array.isArray(e)&&"object"==typeof e)return this.#c(e);throw new o.JsonRpcError(o.RpcErrorCode.INVALID_REQUEST,"Invalid request")}on(e,r){this.#s.on(e,r)}removeListener(e,r){this.#s.removeListener(e,r)}};
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:require("uuid").v4()};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
+ "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"),a=require("./JsonRpcError.js");exports.sendCalls=async({params:t,signer:e,account:n,authentication:o,backendClient:s,policyId:i})=>{const c=t[0]?.capabilities?.paymasterService?.policy??i,p=await(async(t,e,n,o,s)=>{const i=t.map((r=>{if(!r.to)throw new a.JsonRpcError(a.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 e.transactionIntentsApi.createTransactionIntent({createTransactionIntentRequest:{policy:s,chainId:n.chainId,interactions:i}},{headers:{authorization:`Bearer ${e.config.backend.accessToken}`,"x-player-token":o.token,"x-auth-provider":o.thirdPartyProvider,"x-token-type":o.thirdPartyTokenType}})).data),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR})})(t,s,n,o,c).catch((r=>{throw new a.JsonRpcError(a.RpcErrorCode.TRANSACTION_REJECTED,r.message)}));if(p?.nextAction?.payload?.signableHash){let t;t=[300,531050104,324,50104,2741,11124].includes(n.chainId)?await e.sign(p.nextAction.payload.signableHash,!1,!1):await e.sign(p.nextAction.payload.signableHash);const o=await r.withOpenfortError((async()=>await s.transactionIntentsApi.signature({id:p.id,signatureRequest:{signature:t}})),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR}).catch((r=>{throw new a.JsonRpcError(a.RpcErrorCode.TRANSACTION_REJECTED,r.message)}));if(0===o.data.response?.status)throw new a.JsonRpcError(a.RpcErrorCode.RPC_SERVER_ERROR,o.data.response?.error.reason);return o.data.response?.transactionHash}return p.response?.transactionHash};
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.30";
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 s}from"./types.js";import{JsonRpcError as a,ProviderErrorCode as o,RpcErrorCode as i}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 p}from"../manager/signer.js";import{StorageKeys as l}from"../storage/istorage.js";import{addEthereumChain as u}from"./addEthereumChain.js";import{registerSession as f}from"./registerSession.js";import{revokeSession as g}from"./revokeSession.js";import{sendCalls as w}from"./sendCalls.js";import{getCallStatus as A}from"./getCallsStatus.js";import{personalSign as R}from"./personalSign.js";import{estimateGas as S}from"./estimateGas.js";class y{#t;#e;updatePolicy(t){this.#e=t}#r;#s;#a;#o;isOpenfort=!0;constructor({storage:e,backendApiClients:r,openfortEventEmitter:s,policyId:a,validateAndRefreshSession:o}){this.#t=e,this.#e=a,this.#r=o,this.#o=r;const i=d.fromStorage(this.#t),n=i?.chainId||8453;this.#a=new t(m[n]),this.#o=r,this.#s=new h,s.on(c.LOGGED_OUT,this.#i)}#i=()=>{const t=!!d.fromStorage(this.#t),e=p.fromStorage();e?.logout(),this.#t.remove(l.ACCOUNT),this.#t.remove(l.AUTHENTICATION),this.#t.remove(l.SIGNER),t&&this.#s.emit(s.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.#s.emit(s.ACCOUNTS_CONNECT,{chainId:e(t.chainId)}),[t.address];if(!p.fromStorage())throw new a(o.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer");if(await p.embedded(),t=d.fromStorage(this.#t),!t)throw new a(o.UNAUTHORIZED,"Unauthorized - no account available");return this.#s.emit(s.ACCOUNTS_CHANGED,[t.address]),[t.address]}case"eth_sendTransaction":{const t=d.fromStorage(this.#t),e=p.fromStorage(),s=r.fromStorage(this.#t);if(!t||!e||!s)throw new a(o.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await w({params:c.params||[],signer:e,account:t,authentication:s,backendClient:this.#o,policyId:this.#e})}case"eth_estimateGas":{const t=d.fromStorage(this.#t),e=r.fromStorage(this.#t);if(!t||!e)throw new a(o.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await S({params:c.params||[],account:t,authentication:e,backendClient:this.#o,policyId:this.#e})}case"eth_signTypedData":case"eth_signTypedData_v4":{const t=d.fromStorage(this.#t),e=p.fromStorage();if(!t||!e)throw new a(o.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await n({method:c.method,params:c.params||[],signer:e,accountType:t.type,rpcProvider:this.#a})}case"personal_sign":{const t=d.fromStorage(this.#t),e=p.fromStorage();if(!t||!e)throw new a(o.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await R({params:c.params||[],signer:e,account:t})}case"eth_chainId":{const{chainId:t}=await this.#a.detectNetwork();return e(t)}case"wallet_switchEthereumChain":{const e=p.fromStorage();if(!e)throw new a(o.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer");if(!c.params||!Array.isArray(c.params)||0===c.params.length)throw new a(i.INVALID_PARAMS,"Invalid parameters for wallet_switchEthereumChain");this.#r();try{const r=parseInt(c.params[0].chainId,16);await e.switchChain({chainId:r}),this.#a=new t(m[r])}catch(t){throw new a(i.INTERNAL_ERROR,"Failed to switch chain")}return null}case"wallet_addEthereumChain":if(!p.fromStorage())throw new a(o.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer");return await u({params:c.params||[],rpcProvider:this.#a});case"wallet_showCallsStatus":return null;case"wallet_getCallsStatus":{const t=d.fromStorage(this.#t),e=p.fromStorage(),s=r.fromStorage(this.#t);if(!t||!e||!s)throw new a(o.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await A({params:c.params||{},authentication:s,backendClient:this.#o,account:t})}case"wallet_sendCalls":{const t=d.fromStorage(this.#t),e=p.fromStorage(),s=r.fromStorage(this.#t);if(!t||!e||!s)throw new a(o.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await w({params:c.params?c.params[0].calls:[],signer:e,account:t,authentication:s,backendClient:this.#o,policyId:this.#e})}case"wallet_grantPermissions":{const t=d.fromStorage(this.#t),e=p.fromStorage(),s=r.fromStorage(this.#t);if(!t||!e||!s)throw new a(o.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await f({params:c.params||[],signer:e,account:t,authentication:s,backendClient:this.#o,policyId:this.#e})}case"wallet_revokePermissions":{const t=d.fromStorage(this.#t),e=p.fromStorage(),s=r.fromStorage(this.#t);if(!t||!e||!s)throw new a(o.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return this.#r(),await g({params:c.params||[],signer:e,account:t,authentication:s,backendClient:this.#o})}case"wallet_getCapabilities":{const{chainId:t}=await this.#a.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.#a.send(c.method,c.params||[]);default:throw new a(o.UNSUPPORTED_METHOD,`${c.method}: Method not supported`)}}async#c(t){const{id:e,jsonrpc:r}=t;try{return{id:e,jsonrpc:r,result:await this.#n(t)}}catch(t){let s;return s=t instanceof a?t:t instanceof Error?new a(i.INTERNAL_ERROR,t.message):new a(i.INTERNAL_ERROR,"Internal error"),{id:e,jsonrpc:r,error:s}}}async request(t){try{return this.#n(t)}catch(t){if(t instanceof a)throw t;if(t instanceof Error)throw new a(i.INTERNAL_ERROR,t.message);throw new a(i.INTERNAL_ERROR,"Internal error")}}sendAsync(t,e){if(!e)throw new Error("No callback provided");Array.isArray(t)?Promise.all(t.map(this.#c)).then((t=>{e(null,t)})).catch((t=>{e(t,[])})):this.#c(t).then((t=>{e(null,t)})).catch((t=>{e(t,null)}))}async send(t,e,r){if("string"==typeof t)return"function"==typeof e?this.sendAsync({method:t,params:[]},e):r?this.sendAsync({method:t,params:Array.isArray(e)?e:[]},r):this.request({method:t,params:Array.isArray(e)?e:[]});if("function"==typeof e)return this.sendAsync(t,e);if(!Array.isArray(t)&&"object"==typeof t)return this.#c(t);throw new a(i.INVALID_REQUEST,"Invalid request")}on(t,e){this.#s.on(t,e)}removeListener(t,e){this.#s.removeListener(t,e)}}export{y as EvmProvider};
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
- import{v4 as e}from"uuid";const n={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:e()};function t(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{t as announceProvider,n as openfortProviderInfo};
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:i,account:s,authentication:o,backendClient:c,policyId:d})=>{const p=r[0]?.capabilities?.paymasterService?.policy??d,l=await(async(r,i,s,o,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 i.transactionIntentsApi.createTransactionIntent({createTransactionIntentRequest:{policy:c,chainId:s.chainId,interactions:d}},{headers:{authorization:`Bearer ${i.config.backend.accessToken}`,"x-player-token":o.token,"x-auth-provider":o.thirdPartyProvider,"x-token-type":o.thirdPartyTokenType}})).data),{default:t.AUTHENTICATION_ERROR})})(r,c,s,o,p).catch((a=>{throw new e(n.TRANSACTION_REJECTED,a.message)}));if(l?.nextAction?.payload?.signableHash){let r;r=[300,531050104,324,50104,2741,11124].includes(s.chainId)?await i.sign(l.nextAction.payload.signableHash,!1,!1):await i.sign(l.nextAction.payload.signableHash);const o=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===o.data.response?.status)throw new e(n.RPC_SERVER_ERROR,o.data.response?.error.reason);return o.data.response?.transactionHash}return l.response?.transactionHash};export{r as sendCalls};
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};
@@ -1 +1 @@
1
- const o="0.8.30";export{o as VERSION};
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.30",
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.11",
43
- "axios": "1.7.7",
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",