@rango-dev/provider-phantom 0.1.11-next.75 → 0.1.11-next.77
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.ts +3 -2
- package/dist/provider-phantom.cjs.development.js +7 -6
- package/dist/provider-phantom.cjs.development.js.map +1 -1
- package/dist/provider-phantom.cjs.production.min.js +1 -1
- package/dist/provider-phantom.cjs.production.min.js.map +1 -1
- package/dist/provider-phantom.esm.js +7 -6
- package/dist/provider-phantom.esm.js.map +1 -1
- package/dist/signer.d.ts +2 -2
- package/package.json +5 -6
- package/src/index.ts +2 -4
- package/src/signer.ts +8 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { WalletType, CanSwitchNetwork, Connect, Subscribe,
|
|
1
|
+
import { WalletType, CanSwitchNetwork, Connect, Subscribe, WalletInfo } from '@rango-dev/wallets-shared';
|
|
2
2
|
import { phantom as phantom_instance } from './helpers';
|
|
3
|
+
import { SignerFactory, BlockchainMeta } from 'rango-types';
|
|
3
4
|
export declare const config: {
|
|
4
5
|
type: WalletType;
|
|
5
6
|
};
|
|
@@ -7,5 +8,5 @@ export declare const getInstance: typeof phantom_instance;
|
|
|
7
8
|
export declare const connect: Connect;
|
|
8
9
|
export declare const subscribe: Subscribe;
|
|
9
10
|
export declare const canSwitchNetworkTo: CanSwitchNetwork;
|
|
10
|
-
export declare const getSigners: (provider: any) =>
|
|
11
|
+
export declare const getSigners: (provider: any) => SignerFactory;
|
|
11
12
|
export declare const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var walletsShared = require('@rango-dev/wallets-shared');
|
|
6
|
+
var signerSolana = require('@rango-dev/signer-solana');
|
|
7
|
+
var rangoTypes = require('rango-types');
|
|
6
8
|
|
|
7
9
|
function _regeneratorRuntime() {
|
|
8
10
|
_regeneratorRuntime = function () {
|
|
@@ -348,11 +350,10 @@ function phantom() {
|
|
|
348
350
|
}
|
|
349
351
|
|
|
350
352
|
function getSigners(provider) {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
});
|
|
353
|
+
var solProvider = walletsShared.getNetworkInstance(provider, walletsShared.Network.SOLANA);
|
|
354
|
+
var signers = new rangoTypes.SignerFactory();
|
|
355
|
+
signers.registerSigner(rangoTypes.TransactionType.SOLANA, new signerSolana.DefaultSolanaSigner(solProvider));
|
|
356
|
+
return signers;
|
|
356
357
|
}
|
|
357
358
|
|
|
358
359
|
var WALLET = walletsShared.WalletType.PHANTOM;
|
|
@@ -394,7 +395,7 @@ var canSwitchNetworkTo = function canSwitchNetworkTo() {
|
|
|
394
395
|
};
|
|
395
396
|
var getSigners$1 = getSigners;
|
|
396
397
|
var getWalletInfo = function getWalletInfo(allBlockChains) {
|
|
397
|
-
var solana =
|
|
398
|
+
var solana = rangoTypes.solanaBlockchain(allBlockChains);
|
|
398
399
|
return {
|
|
399
400
|
name: 'Phantom',
|
|
400
401
|
img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/phantom.svg',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-phantom.cjs.development.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["export function phantom() {\n if ('phantom' in window) {\n const instance = window.phantom?.solana;\n\n if (instance?.isPhantom) {\n return instance;\n }\n }\n\n return null;\n}\n","import {
|
|
1
|
+
{"version":3,"file":"provider-phantom.cjs.development.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["export function phantom() {\n if ('phantom' in window) {\n const instance = window.phantom?.solana;\n\n if (instance?.isPhantom) {\n return instance;\n }\n }\n\n return null;\n}\n","import { DefaultSolanaSigner } from '@rango-dev/signer-solana';\nimport { Network, getNetworkInstance } from '@rango-dev/wallets-shared';\nimport { SignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default function getSigners(provider: any): SignerFactory {\n const solProvider = getNetworkInstance(provider, Network.SOLANA);\n const signers = new SignerFactory();\n signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider));\n return signers;\n}\n","import {\n Network,\n WalletType,\n CanSwitchNetwork,\n Connect,\n Subscribe,\n getSolanaAccounts,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\nimport { phantom as phantom_instance } from './helpers';\nimport signer from './signer';\nimport { SignerFactory, BlockchainMeta, solanaBlockchain } from 'rango-types';\n\nconst WALLET = WalletType.PHANTOM;\n\nexport const config = {\n type: WALLET,\n};\n\nexport const getInstance = phantom_instance;\nexport const connect: Connect = getSolanaAccounts;\n\nexport const subscribe: Subscribe = ({ instance, updateAccounts, connect }) => {\n instance?.on('accountChanged', async (publicKey: string) => {\n const network = Network.SOLANA;\n if (publicKey) {\n const account = publicKey.toString();\n updateAccounts([account]);\n } else {\n connect(network);\n }\n });\n};\n\nexport const canSwitchNetworkTo: CanSwitchNetwork = () => false;\n\nexport const getSigners: (provider: any) => SignerFactory = signer;\n\nexport const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (\n allBlockChains\n) => {\n const solana = solanaBlockchain(allBlockChains);\n return {\n name: 'Phantom',\n img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/phantom.svg',\n installLink: {\n CHROME:\n 'https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa',\n\n DEFAULT: 'https://phantom.app/',\n },\n color: '#4d40c6',\n supportedChains: solana,\n };\n};\n"],"names":["phantom","window","_window$phantom","instance","solana","isPhantom","getSigners","provider","solProvider","getNetworkInstance","Network","SOLANA","signers","SignerFactory","registerSigner","TxType","DefaultSolanaSigner","WALLET","WalletType","PHANTOM","config","type","getInstance","phantom_instance","connect","getSolanaAccounts","subscribe","_ref","updateAccounts","on","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","publicKey","network","account","wrap","_callee$","_context","prev","next","toString","stop","_x","apply","arguments","canSwitchNetworkTo","signer","getWalletInfo","allBlockChains","solanaBlockchain","name","img","installLink","CHROME","DEFAULT","color","supportedChains"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAgBA,OAAOA;EACrB,IAAI,SAAS,IAAIC,MAAM,EAAE;IAAA,IAAAC,eAAA;IACvB,IAAMC,QAAQ,IAAAD,eAAA,GAAGD,MAAM,CAACD,OAAO,qBAAdE,eAAA,CAAgBE,MAAM;IAEvC,IAAID,QAAQ,YAARA,QAAQ,CAAEE,SAAS,EAAE;MACvB,OAAOF,QAAQ;;;EAInB,OAAO,IAAI;AACb;;SCNwBG,UAAUA,CAACC,QAAa;EAC9C,IAAMC,WAAW,GAAGC,gCAAkB,CAACF,QAAQ,EAAEG,qBAAO,CAACC,MAAM,CAAC;EAChE,IAAMC,OAAO,GAAG,IAAIC,wBAAa,EAAE;EACnCD,OAAO,CAACE,cAAc,CAACC,0BAAM,CAACJ,MAAM,EAAE,IAAIK,gCAAmB,CAACR,WAAW,CAAC,CAAC;EAC3E,OAAOI,OAAO;AAChB;;ACIA,IAAMK,MAAM,GAAGC,wBAAU,CAACC,OAAO;AAEjC,IAAaC,MAAM,GAAG;EACpBC,IAAI,EAAEJ;CACP;AAED,IAAaK,WAAW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EAAE,SAAS;IAChBC,eAAe,EAAEvD;GAClB;AACH,CAAC;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@rango-dev/wallets-shared");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@rango-dev/wallets-shared"),e=require("@rango-dev/signer-solana"),r=require("rango-types");function n(){n=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),a=new j(n||[]);return o(i,"_invoke",{value:b(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var f={};function p(){}function v(){}function d(){}var y={};s(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(k([])));m&&m!==e&&r.call(m,a)&&(y=m);var w=d.prototype=p.prototype=Object.create(y);function x(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){var n;o(this,"_invoke",{value:function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,c){var u=h(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}})}function b(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=E(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=h(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:_}}function _(){return{value:void 0,done:!0}}return v.prototype=d,o(w,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:v,configurable:!0}),v.displayName=s(d,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},x(L.prototype),s(L.prototype,c,(function(){return this})),t.AsyncIterator=L,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new L(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(w),s(w,u,"Generator"),s(w,a,(function(){return this})),s(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function o(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var i={type:t.WalletType.PHANTOM},a=t.getSolanaAccounts;exports.canSwitchNetworkTo=function(){return!1},exports.config=i,exports.connect=a,exports.getInstance=function(){if("phantom"in window){var t,e=null==(t=window.phantom)?void 0:t.solana;if(null!=e&&e.isPhantom)return e}return null},exports.getSigners=function(n){var o=t.getNetworkInstance(n,t.Network.SOLANA),i=new r.SignerFactory;return i.registerSigner(r.TransactionType.SOLANA,new e.DefaultSolanaSigner(o)),i},exports.getWalletInfo=function(t){return{name:"Phantom",img:"https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/phantom.svg",installLink:{CHROME:"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa",DEFAULT:"https://phantom.app/"},color:"#4d40c6",supportedChains:r.solanaBlockchain(t)}},exports.subscribe=function(e){var r=e.instance,i=e.updateAccounts,a=e.connect;null==r||r.on("accountChanged",function(){var e,r=(e=n().mark((function e(r){var o,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=t.Network.SOLANA,r?(c=r.toString(),i([c])):a(o);case 2:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function c(t){o(a,n,i,c,u,"next",t)}function u(t){o(a,n,i,c,u,"throw",t)}c(void 0)}))});return function(t){return r.apply(this,arguments)}}())};
|
|
2
2
|
//# sourceMappingURL=provider-phantom.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-phantom.cjs.production.min.js","sources":["../src/index.ts","../src/helpers.ts","../src/signer.ts"],"sourcesContent":["import {\n Network,\n WalletType,\n CanSwitchNetwork,\n Connect,\n Subscribe,\n
|
|
1
|
+
{"version":3,"file":"provider-phantom.cjs.production.min.js","sources":["../src/index.ts","../src/helpers.ts","../src/signer.ts"],"sourcesContent":["import {\n Network,\n WalletType,\n CanSwitchNetwork,\n Connect,\n Subscribe,\n getSolanaAccounts,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\nimport { phantom as phantom_instance } from './helpers';\nimport signer from './signer';\nimport { SignerFactory, BlockchainMeta, solanaBlockchain } from 'rango-types';\n\nconst WALLET = WalletType.PHANTOM;\n\nexport const config = {\n type: WALLET,\n};\n\nexport const getInstance = phantom_instance;\nexport const connect: Connect = getSolanaAccounts;\n\nexport const subscribe: Subscribe = ({ instance, updateAccounts, connect }) => {\n instance?.on('accountChanged', async (publicKey: string) => {\n const network = Network.SOLANA;\n if (publicKey) {\n const account = publicKey.toString();\n updateAccounts([account]);\n } else {\n connect(network);\n }\n });\n};\n\nexport const canSwitchNetworkTo: CanSwitchNetwork = () => false;\n\nexport const getSigners: (provider: any) => SignerFactory = signer;\n\nexport const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (\n allBlockChains\n) => {\n const solana = solanaBlockchain(allBlockChains);\n return {\n name: 'Phantom',\n img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/phantom.svg',\n installLink: {\n CHROME:\n 'https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa',\n\n DEFAULT: 'https://phantom.app/',\n },\n color: '#4d40c6',\n supportedChains: solana,\n };\n};\n","export function phantom() {\n if ('phantom' in window) {\n const instance = window.phantom?.solana;\n\n if (instance?.isPhantom) {\n return instance;\n }\n }\n\n return null;\n}\n","import { DefaultSolanaSigner } from '@rango-dev/signer-solana';\nimport { Network, getNetworkInstance } from '@rango-dev/wallets-shared';\nimport { SignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default function getSigners(provider: any): SignerFactory {\n const solProvider = getNetworkInstance(provider, Network.SOLANA);\n const signers = new SignerFactory();\n signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider));\n return signers;\n}\n"],"names":["config","type","WalletType","PHANTOM","connect","getSolanaAccounts","window","_window$phantom","instance","phantom","solana","isPhantom","provider","solProvider","getNetworkInstance","Network","SOLANA","signers","SignerFactory","registerSigner","TxType","DefaultSolanaSigner","allBlockChains","name","img","installLink","CHROME","DEFAULT","color","supportedChains","solanaBlockchain","_ref","updateAccounts","on","_ref2","_regeneratorRuntime","mark","_callee","publicKey","network","account","wrap","_context","prev","next","toString","stop","_x","apply","arguments"],"mappings":"8uNAaA,IAEaA,EAAS,CACpBC,KAHaC,aAAWC,SAObC,EAAmBC,+CAcoB,WAArB,OAA2B,qECjCxD,GAAI,YAAaC,OAAQ,CAAA,IAAAC,EACjBC,SAAQD,EAAGD,OAAOG,gBAAPF,EAAgBG,OAEjC,SAAIF,GAAAA,EAAUG,UACZ,OAAOH,EAIX,OAAO,kCCL0BI,GACjC,IAAMC,EAAcC,qBAAmBF,EAAUG,UAAQC,QACnDC,EAAU,IAAIC,gBAEpB,OADAD,EAAQE,eAAeC,kBAAOJ,OAAQ,IAAIK,sBAAoBR,IACvDI,yBF8BsE,SAC7EK,GAGA,MAAO,CACLC,KAAM,UACNC,IAAK,qGACLC,YAAa,CACXC,OACE,qFAEFC,QAAS,wBAEXC,MAAO,UACPC,gBAXaC,mBAAiBR,uBAnBE,SAAdS,OAAiBvB,EAAQuB,EAARvB,SAAUwB,EAAcD,EAAdC,eAAgB5B,EAAO2B,EAAP3B,cAC/DI,GAAAA,EAAUyB,GAAG,4BAAgB,MAAAC,KAAAC,IAAAC,MAAE,SAAAC,EAAOC,GAAiB,IAAAC,EAAAC,EAAA,OAAAL,IAAAM,eAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,OAC/CL,EAAUxB,UAAQC,OACpBsB,GACIE,EAAUF,EAAUO,WAC1Bb,EAAe,CAACQ,KAEhBpC,EAAQmC,GACT,OAAA,UAAA,OAAAG,EAAAI,UAAAT,qLACF,gBAAAU,GAAA,OAAAb,EAAAc,WAAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getNetworkInstance, Network, getSolanaAccounts, WalletType } from '@rango-dev/wallets-shared';
|
|
2
|
+
import { DefaultSolanaSigner } from '@rango-dev/signer-solana';
|
|
3
|
+
import { SignerFactory, TransactionType, solanaBlockchain } from 'rango-types';
|
|
2
4
|
|
|
3
5
|
function _regeneratorRuntime() {
|
|
4
6
|
_regeneratorRuntime = function () {
|
|
@@ -344,11 +346,10 @@ function phantom() {
|
|
|
344
346
|
}
|
|
345
347
|
|
|
346
348
|
function getSigners(provider) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
});
|
|
349
|
+
var solProvider = getNetworkInstance(provider, Network.SOLANA);
|
|
350
|
+
var signers = new SignerFactory();
|
|
351
|
+
signers.registerSigner(TransactionType.SOLANA, new DefaultSolanaSigner(solProvider));
|
|
352
|
+
return signers;
|
|
352
353
|
}
|
|
353
354
|
|
|
354
355
|
var WALLET = WalletType.PHANTOM;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-phantom.esm.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["export function phantom() {\n if ('phantom' in window) {\n const instance = window.phantom?.solana;\n\n if (instance?.isPhantom) {\n return instance;\n }\n }\n\n return null;\n}\n","import {
|
|
1
|
+
{"version":3,"file":"provider-phantom.esm.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["export function phantom() {\n if ('phantom' in window) {\n const instance = window.phantom?.solana;\n\n if (instance?.isPhantom) {\n return instance;\n }\n }\n\n return null;\n}\n","import { DefaultSolanaSigner } from '@rango-dev/signer-solana';\nimport { Network, getNetworkInstance } from '@rango-dev/wallets-shared';\nimport { SignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default function getSigners(provider: any): SignerFactory {\n const solProvider = getNetworkInstance(provider, Network.SOLANA);\n const signers = new SignerFactory();\n signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider));\n return signers;\n}\n","import {\n Network,\n WalletType,\n CanSwitchNetwork,\n Connect,\n Subscribe,\n getSolanaAccounts,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\nimport { phantom as phantom_instance } from './helpers';\nimport signer from './signer';\nimport { SignerFactory, BlockchainMeta, solanaBlockchain } from 'rango-types';\n\nconst WALLET = WalletType.PHANTOM;\n\nexport const config = {\n type: WALLET,\n};\n\nexport const getInstance = phantom_instance;\nexport const connect: Connect = getSolanaAccounts;\n\nexport const subscribe: Subscribe = ({ instance, updateAccounts, connect }) => {\n instance?.on('accountChanged', async (publicKey: string) => {\n const network = Network.SOLANA;\n if (publicKey) {\n const account = publicKey.toString();\n updateAccounts([account]);\n } else {\n connect(network);\n }\n });\n};\n\nexport const canSwitchNetworkTo: CanSwitchNetwork = () => false;\n\nexport const getSigners: (provider: any) => SignerFactory = signer;\n\nexport const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (\n allBlockChains\n) => {\n const solana = solanaBlockchain(allBlockChains);\n return {\n name: 'Phantom',\n img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/phantom.svg',\n installLink: {\n CHROME:\n 'https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa',\n\n DEFAULT: 'https://phantom.app/',\n },\n color: '#4d40c6',\n supportedChains: solana,\n };\n};\n"],"names":["phantom","window","_window$phantom","instance","solana","isPhantom","getSigners","provider","solProvider","getNetworkInstance","Network","SOLANA","signers","SignerFactory","registerSigner","TxType","DefaultSolanaSigner","WALLET","WalletType","PHANTOM","config","type","getInstance","phantom_instance","connect","getSolanaAccounts","subscribe","_ref","updateAccounts","on","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","publicKey","network","account","wrap","_callee$","_context","prev","next","toString","stop","_x","apply","arguments","canSwitchNetworkTo","signer","getWalletInfo","allBlockChains","solanaBlockchain","name","img","installLink","CHROME","DEFAULT","color","supportedChains"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAgBA,OAAOA;EACrB,IAAI,SAAS,IAAIC,MAAM,EAAE;IAAA,IAAAC,eAAA;IACvB,IAAMC,QAAQ,IAAAD,eAAA,GAAGD,MAAM,CAACD,OAAO,qBAAdE,eAAA,CAAgBE,MAAM;IAEvC,IAAID,QAAQ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AAAI,IAAA;;SAAAV,OAAA;KACF;IAAA,iBAAAW,EAAA;MAAA,OAAAf,KAAA,CAAAgB,KAAA,OAAAC,SAAA;;MAAC;AACJ,CAAC;AAED,IAAaC,kBAAkB,GAAqB,SAAvCA,kBAAkBA;EAAA,OAA2B,KAAK;AAAA;AAE/D,IAAa1C,YAAU,GAAqC2C;AAE5D,IAAaC,aAAa,GAAqD,SAAlEA,aAAaA,CACxBC,cAAc;EAEd,IAAM/C,MAAM,GAAGgD,gBAAgB,CAACD,cAAc,CAAC;EAC/C,OAAO;IACLE,IAAI,EAAE,SAAS;IACfC,GAAG,EAAE,oGAAoG;IACzGC,WAAW,EAAE;MACXC,MAAM,EACJ,oFAAoF;MAEtFC,OAAO,EAAE;KACV;IACDC,KAAK,EAAE,SAAS;IAChBC,eAAe,EAAEvD;GAClB;AACH,CAAC;;;;"}
|
package/dist/signer.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default function getSigners(provider: any):
|
|
1
|
+
import { SignerFactory } from 'rango-types';
|
|
2
|
+
export default function getSigners(provider: any): SignerFactory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/provider-phantom",
|
|
3
|
-
"version": "0.1.11-next.
|
|
3
|
+
"version": "0.1.11-next.77",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"module": "dist/provider-phantom.esm.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,15 +11,12 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"start": "tsdx watch",
|
|
14
|
-
"build": "tsdx build",
|
|
14
|
+
"build": "tsdx build --tsconfig ./tsconfig.json",
|
|
15
15
|
"test": "tsdx test --passWithNoTests",
|
|
16
16
|
"lint": "tsdx lint",
|
|
17
17
|
"size": "size-limit",
|
|
18
18
|
"analyze": "size-limit --why"
|
|
19
19
|
},
|
|
20
|
-
"peerDependencies": {
|
|
21
|
-
"react": ">=16"
|
|
22
|
-
},
|
|
23
20
|
"husky": {
|
|
24
21
|
"hooks": {
|
|
25
22
|
"pre-commit": "tsdx lint"
|
|
@@ -42,7 +39,9 @@
|
|
|
42
39
|
}
|
|
43
40
|
],
|
|
44
41
|
"dependencies": {
|
|
45
|
-
"@rango-dev/
|
|
42
|
+
"@rango-dev/signer-solana": "^0.1.11-next.77",
|
|
43
|
+
"@rango-dev/wallets-shared": "^0.1.11-next.77",
|
|
44
|
+
"rango-types": "^0.1.21"
|
|
46
45
|
},
|
|
47
46
|
"publishConfig": {
|
|
48
47
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -4,14 +4,12 @@ import {
|
|
|
4
4
|
CanSwitchNetwork,
|
|
5
5
|
Connect,
|
|
6
6
|
Subscribe,
|
|
7
|
-
WalletSigners,
|
|
8
7
|
getSolanaAccounts,
|
|
9
|
-
BlockchainMeta,
|
|
10
8
|
WalletInfo,
|
|
11
|
-
solanaBlockchain,
|
|
12
9
|
} from '@rango-dev/wallets-shared';
|
|
13
10
|
import { phantom as phantom_instance } from './helpers';
|
|
14
11
|
import signer from './signer';
|
|
12
|
+
import { SignerFactory, BlockchainMeta, solanaBlockchain } from 'rango-types';
|
|
15
13
|
|
|
16
14
|
const WALLET = WalletType.PHANTOM;
|
|
17
15
|
|
|
@@ -36,7 +34,7 @@ export const subscribe: Subscribe = ({ instance, updateAccounts, connect }) => {
|
|
|
36
34
|
|
|
37
35
|
export const canSwitchNetworkTo: CanSwitchNetwork = () => false;
|
|
38
36
|
|
|
39
|
-
export const getSigners: (provider: any) =>
|
|
37
|
+
export const getSigners: (provider: any) => SignerFactory = signer;
|
|
40
38
|
|
|
41
39
|
export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (
|
|
42
40
|
allBlockChains
|
package/src/signer.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
defaultSigners,
|
|
5
|
-
} from '@rango-dev/wallets-shared';
|
|
1
|
+
import { DefaultSolanaSigner } from '@rango-dev/signer-solana';
|
|
2
|
+
import { Network, getNetworkInstance } from '@rango-dev/wallets-shared';
|
|
3
|
+
import { SignerFactory, TransactionType as TxType } from 'rango-types';
|
|
6
4
|
|
|
7
|
-
export default function getSigners(provider: any):
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
5
|
+
export default function getSigners(provider: any): SignerFactory {
|
|
6
|
+
const solProvider = getNetworkInstance(provider, Network.SOLANA);
|
|
7
|
+
const signers = new SignerFactory();
|
|
8
|
+
signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider));
|
|
9
|
+
return signers;
|
|
13
10
|
}
|