@magic-ext/aptos
Advanced tools
Comparing version 0.3.0-canary.520.5050580750.0 to 0.3.0-canary.521.5050667243.0
@@ -1,2 +0,2 @@ | ||
"use strict";var s=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var g=(e,r)=>{for(var t in r)s(e,t,{get:r[t],enumerable:!0})},f=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of u(r))!d.call(e,o)&&o!==t&&s(e,o,{get:()=>r[o],enumerable:!(n=h(r,o))||n.enumerable});return e};var m=e=>f(s({},"__esModule",{value:!0}),e);var T={};g(T,{AptosExtension:()=>a});module.exports=m(T);var p=require("@magic-sdk/commons"),l=require("aptos");var w=e=>{if(e==="https://fullnode.mainnet.aptoslabs.com")return{rpcUrl:"https://aptos-mainnet-rpc.allthatnode.com/v1",network:"mainnet",chainId:1};if(e==="https://fullnode.testnet.aptoslabs.com")return{rpcUrl:"https://aptos-testnet-rpc.allthatnode.com/v1",network:"testnet",chainId:2};if(e==="https://fullnode.devnet.aptoslabs.com")return{rpcUrl:"",network:"devnet",chainId:54};throw new Error("Invalid nodeUrl")},a=class extends p.Extension.Internal{constructor(t){var o,i,c;super();this.aptosConfig=t;this.name="aptos";this.serializeRawTranasction=t=>{try{let n=new l.BCS.Serializer;return t.serialize(n),n.getBytes()}catch(n){throw console.error("Invalid transaction. Please generate transaction with generateTransaction method of aptos sdk.",n),n}};this.getAccount=()=>this.request(this.utils.createJsonRpcRequestPayload("aptos_getAccount",[]));this.signTransaction=t=>{let n=this.serializeRawTranasction(t);return this.request(this.utils.createJsonRpcRequestPayload("aptos_signTransaction",[n]))};let n=w(t.nodeUrl);this.config={chainType:"APTOS",nodeUrl:t.nodeUrl,rpcUrl:(o=t.rpcUrl)!=null?o:n.rpcUrl,network:(i=t.network)!=null?i:n.network,chainId:(c=t.chainId)!=null?c:n.chainId}}}; | ||
"use strict";var u=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var w=(e,r)=>{for(var t in r)u(e,t,{get:r[t],enumerable:!0})},y=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of f(r))!m.call(e,o)&&o!==t&&u(e,o,{get:()=>r[o],enumerable:!(n=d(r,o))||n.enumerable});return e};var T=e=>y(u({},"__esModule",{value:!0}),e);var A=(e,r,t)=>new Promise((n,o)=>{var c=s=>{try{p(t.next(s))}catch(l){o(l)}},a=s=>{try{p(t.throw(s))}catch(l){o(l)}},p=s=>s.done?n(s.value):Promise.resolve(s.value).then(c,a);p((t=t.apply(e,r)).next())});var I={};w(I,{AptosExtension:()=>h});module.exports=T(I);var g=require("@magic-sdk/commons"),i=require("aptos");var U=e=>{if(e==="https://fullnode.mainnet.aptoslabs.com")return{rpcUrl:"https://aptos-mainnet-rpc.allthatnode.com/v1",network:"mainnet",chainId:1};if(e==="https://fullnode.testnet.aptoslabs.com")return{rpcUrl:"https://aptos-testnet-rpc.allthatnode.com/v1",network:"testnet",chainId:2};if(e==="https://fullnode.devnet.aptoslabs.com")return{rpcUrl:"",network:"devnet",chainId:54};throw new Error("Invalid nodeUrl")},h=class extends g.Extension.Internal{constructor(t){var o,c,a;super();this.aptosConfig=t;this.name="aptos";this.serializeRawTranasction=t=>{try{let n=new i.BCS.Serializer;return t.serialize(n),n.getBytes()}catch(n){throw console.error("Invalid transaction. Please generate transaction with generateTransaction method of aptos sdk.",n),n}};this.getAccount=()=>this.request(this.utils.createJsonRpcRequestPayload("aptos_getAccount",[]));this.signTransaction=t=>{let n=this.serializeRawTranasction(t);return this.request(this.utils.createJsonRpcRequestPayload("aptos_signTransaction",[n]))};this.getAptosAccount=()=>A(this,null,function*(){let t=yield this.request(this.utils.createJsonRpcRequestPayload("aptos_getAccount",[])),n=yield this.request(this.utils.createJsonRpcRequestPayload("aptos_getAptosAccount",[t]));return i.AptosAccount.fromAptosAccountObject(n)});let n=U(t.nodeUrl);this.config={chainType:"APTOS",nodeUrl:t.nodeUrl,rpcUrl:(o=t.rpcUrl)!=null?o:n.rpcUrl,network:(c=t.network)!=null?c:n.network,chainId:(a=t.chainId)!=null?a:n.chainId}}}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{Extension as i}from"@magic-sdk/commons";import{BCS as c}from"aptos";var p=e=>{if(e==="https://fullnode.mainnet.aptoslabs.com")return{rpcUrl:"https://aptos-mainnet-rpc.allthatnode.com/v1",network:"mainnet",chainId:1};if(e==="https://fullnode.testnet.aptoslabs.com")return{rpcUrl:"https://aptos-testnet-rpc.allthatnode.com/v1",network:"testnet",chainId:2};if(e==="https://fullnode.devnet.aptoslabs.com")return{rpcUrl:"",network:"devnet",chainId:54};throw new Error("Invalid nodeUrl")},a=class extends i.Internal{constructor(n){var r,o,s;super();this.aptosConfig=n;this.name="aptos";this.serializeRawTranasction=n=>{try{let t=new c.Serializer;return n.serialize(t),t.getBytes()}catch(t){throw console.error("Invalid transaction. Please generate transaction with generateTransaction method of aptos sdk.",t),t}};this.getAccount=()=>this.request(this.utils.createJsonRpcRequestPayload("aptos_getAccount",[]));this.signTransaction=n=>{let t=this.serializeRawTranasction(n);return this.request(this.utils.createJsonRpcRequestPayload("aptos_signTransaction",[t]))};let t=p(n.nodeUrl);this.config={chainType:"APTOS",nodeUrl:n.nodeUrl,rpcUrl:(r=n.rpcUrl)!=null?r:t.rpcUrl,network:(o=n.network)!=null?o:t.network,chainId:(s=n.chainId)!=null?s:t.chainId}}};export{a as AptosExtension}; | ||
var l=(r,p,t)=>new Promise((n,o)=>{var s=e=>{try{a(t.next(e))}catch(i){o(i)}},c=e=>{try{a(t.throw(e))}catch(i){o(i)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(s,c);a((t=t.apply(r,p)).next())});import{Extension as h}from"@magic-sdk/commons";import{AptosAccount as A,BCS as g}from"aptos";var d=r=>{if(r==="https://fullnode.mainnet.aptoslabs.com")return{rpcUrl:"https://aptos-mainnet-rpc.allthatnode.com/v1",network:"mainnet",chainId:1};if(r==="https://fullnode.testnet.aptoslabs.com")return{rpcUrl:"https://aptos-testnet-rpc.allthatnode.com/v1",network:"testnet",chainId:2};if(r==="https://fullnode.devnet.aptoslabs.com")return{rpcUrl:"",network:"devnet",chainId:54};throw new Error("Invalid nodeUrl")},u=class extends h.Internal{constructor(t){var o,s,c;super();this.aptosConfig=t;this.name="aptos";this.serializeRawTranasction=t=>{try{let n=new g.Serializer;return t.serialize(n),n.getBytes()}catch(n){throw console.error("Invalid transaction. Please generate transaction with generateTransaction method of aptos sdk.",n),n}};this.getAccount=()=>this.request(this.utils.createJsonRpcRequestPayload("aptos_getAccount",[]));this.signTransaction=t=>{let n=this.serializeRawTranasction(t);return this.request(this.utils.createJsonRpcRequestPayload("aptos_signTransaction",[n]))};this.getAptosAccount=()=>l(this,null,function*(){let t=yield this.request(this.utils.createJsonRpcRequestPayload("aptos_getAccount",[])),n=yield this.request(this.utils.createJsonRpcRequestPayload("aptos_getAptosAccount",[t]));return A.fromAptosAccountObject(n)});let n=d(t.nodeUrl);this.config={chainType:"APTOS",nodeUrl:t.nodeUrl,rpcUrl:(o=t.rpcUrl)!=null?o:n.rpcUrl,network:(s=t.network)!=null?s:n.network,chainId:(c=t.chainId)!=null?c:n.chainId}}};export{u as AptosExtension}; | ||
//# sourceMappingURL=index.js.map |
import { Extension } from '@magic-sdk/commons'; | ||
import { AptosAccount } from 'aptos'; | ||
import { AptosConfig, ConfigType } from './type'; | ||
@@ -19,2 +20,3 @@ export declare class AptosExtension extends Extension.Internal<'aptos', any> { | ||
}>; | ||
getAptosAccount: () => Promise<AptosAccount>; | ||
} |
@@ -16,3 +16,4 @@ export interface AptosConfig { | ||
AptosGetAccount = "aptos_getAccount", | ||
AptosSignTransaction = "aptos_signTransaction" | ||
AptosSignTransaction = "aptos_signTransaction", | ||
AptosGetAptosAccount = "aptos_getAptosAccount" | ||
} |
{ | ||
"name": "@magic-ext/aptos", | ||
"version": "0.3.0-canary.520.5050580750.0", | ||
"version": "0.3.0-canary.521.5050667243.0", | ||
"description": "magic aptos extension", | ||
@@ -30,3 +30,3 @@ "author": "Magic <team@magic.link> (https://magic.link/)", | ||
"devDependencies": { | ||
"@magic-sdk/commons": "13.2.0-canary.520.5050580750.0", | ||
"@magic-sdk/commons": "^13.1.5", | ||
"aptos": "^1.8.5" | ||
@@ -37,3 +37,3 @@ }, | ||
}, | ||
"gitHead": "2221ad32aa4a6d642aedf7e4d52a3c136606483b" | ||
"gitHead": "c6fb3f3d704f3f0f6baf68e11d8797d9c3ab5793" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23382
68