From 1904a913b84e01e902173e782ab45e0e3b4ccf8d Mon Sep 17 00:00:00 2001 From: kaotisk Date: Wed, 27 Dec 2023 16:29:28 +0200 Subject: Use only local libraries --- src/external/marked.min.js | 14 + .../@shared/api/external.d.ts | 24 + .../@shared/api/helpers/extensionMessaging.d.ts | 9 + .../stellar-freighter-api/@shared/api/types.d.ts | 158 + .../@shared/constants/applicationState.d.ts | 8 + .../@shared/constants/hardwareWallet.d.ts | 4 + .../@shared/constants/services.d.ts | 62 + .../@shared/constants/stellar.d.ts | 34 + .../@stellar/freighter-api/src/getNetwork.d.ts | 1 + .../freighter-api/src/getNetworkDetails.d.ts | 6 + .../@stellar/freighter-api/src/getPublicKey.d.ts | 1 + .../@stellar/freighter-api/src/getUserInfo.d.ts | 3 + .../@stellar/freighter-api/src/index.d.ts | 40 + .../@stellar/freighter-api/src/isAllowed.d.ts | 1 + .../@stellar/freighter-api/src/isConnected.d.ts | 1 + .../@stellar/freighter-api/src/setAllowed.d.ts | 1 + .../@stellar/freighter-api/src/signAuthEntry.d.ts | 3 + .../@stellar/freighter-api/src/signBlob.d.ts | 3 + .../freighter-api/src/signTransaction.d.ts | 5 + .../config/shims/webextension-polyfill.d.ts | 8 + src/external/stellar-freighter-api/index.min.js | 1 + src/external/stellarSdk.js | 54477 +++++++++++++++++++ src/index.html | 10 +- 23 files changed, 54869 insertions(+), 5 deletions(-) create mode 100644 src/external/marked.min.js create mode 100644 src/external/stellar-freighter-api/@shared/api/external.d.ts create mode 100644 src/external/stellar-freighter-api/@shared/api/helpers/extensionMessaging.d.ts create mode 100644 src/external/stellar-freighter-api/@shared/api/types.d.ts create mode 100644 src/external/stellar-freighter-api/@shared/constants/applicationState.d.ts create mode 100644 src/external/stellar-freighter-api/@shared/constants/hardwareWallet.d.ts create mode 100644 src/external/stellar-freighter-api/@shared/constants/services.d.ts create mode 100644 src/external/stellar-freighter-api/@shared/constants/stellar.d.ts create mode 100644 src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetwork.d.ts create mode 100644 src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetworkDetails.d.ts create mode 100644 src/external/stellar-freighter-api/@stellar/freighter-api/src/getPublicKey.d.ts create mode 100644 src/external/stellar-freighter-api/@stellar/freighter-api/src/getUserInfo.d.ts create mode 100644 src/external/stellar-freighter-api/@stellar/freighter-api/src/index.d.ts create mode 100644 src/external/stellar-freighter-api/@stellar/freighter-api/src/isAllowed.d.ts create mode 100644 src/external/stellar-freighter-api/@stellar/freighter-api/src/isConnected.d.ts create mode 100644 src/external/stellar-freighter-api/@stellar/freighter-api/src/setAllowed.d.ts create mode 100644 src/external/stellar-freighter-api/@stellar/freighter-api/src/signAuthEntry.d.ts create mode 100644 src/external/stellar-freighter-api/@stellar/freighter-api/src/signBlob.d.ts create mode 100644 src/external/stellar-freighter-api/@stellar/freighter-api/src/signTransaction.d.ts create mode 100644 src/external/stellar-freighter-api/config/shims/webextension-polyfill.d.ts create mode 100644 src/external/stellar-freighter-api/index.min.js create mode 100644 src/external/stellarSdk.js (limited to 'src') diff --git a/src/external/marked.min.js b/src/external/marked.min.js new file mode 100644 index 0000000..343e921 --- /dev/null +++ b/src/external/marked.min.js @@ -0,0 +1,14 @@ +/** + * marked v8.0.1 - a markdown parser + * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed) + * https://github.com/markedjs/marked + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).marked={})}(this,function(t){"use strict";function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function n(e){t.defaults=e}t.defaults=e();const r=/[&<>"']/,s=new RegExp(r.source,"g"),i=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,l=new RegExp(i.source,"g"),a={"&":"&","<":"<",">":">",'"':""","'":"'"},o=e=>a[e];function c(e,t){if(t){if(r.test(e))return e.replace(s,o)}else if(i.test(e))return e.replace(l,o);return e}const b=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;const h=/(^|[^\[])\^/g;function p(n,e){n="string"==typeof n?n:n.source,e=e||"";const r={replace:(e,t)=>(t=(t="object"==typeof t&&"source"in t?t.source:t).replace(h,"$1"),n=n.replace(e,t),r),getRegex:()=>new RegExp(n,e)};return r}function u(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}var g={exec:()=>null};function k(e,t){var n=e.replace(/\|/g,(e,t,n)=>{let r=!1,s=t;for(;0<=--s&&"\\"===n[s];)r=!r;return r?"|":" |"}).split(/ \|/);let r=0;if(n[0].trim()||n.shift(),0t)n.splice(t);else for(;n.length{var t=e.match(/^\s+/);return null!==t&&([t]=t,t.length>=n.length)?e.slice(n.length):e}).join("\n")}(t=e[0],e[3]||""),{type:"code",raw:t,lang:e[2]&&e[2].trim().replace(this.rules.inline._escapes,"$1"),text:n}}heading(t){var n,t=this.rules.block.heading.exec(t);if(t){let e=t[2].trim();return/#$/.test(e)&&(n=f(e,"#"),!this.options.pedantic&&n&&!/ $/.test(n)||(e=n.trim())),{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){e=this.rules.block.hr.exec(e);if(e)return{type:"hr",raw:e[0]}}blockquote(e){var t,n,r,e=this.rules.block.blockquote.exec(e);if(e)return t=e[0].replace(/^ *>[ \t]?/gm,""),n=this.lexer.state.top,this.lexer.state.top=!0,r=this.lexer.blockTokens(t),this.lexer.state.top=n,{type:"blockquote",raw:e[0],tokens:r,text:t}}list(h){let p=this.rules.block.list.exec(h);if(p){let e=p[1].trim();var t,n=1" ".repeat(3*e.length)),n=h.split("\n",1)[0],r=0,s=(this.options.pedantic?(r=2,o=t.trimStart()):(r=4<(r=p[2].search(/[^ ]/))?1:r,o=t.slice(r),r+=p[1].length),!1);if(!t&&/^ *$/.test(n)&&(a+=n+"\n",h=h.substring(n.length+1),e=!0),!e)for(var k=new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),f=new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),d=new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),x=new RegExp(`^ {0,${Math.min(3,r-1)}}#`);h;){var b=h.split("\n",1)[0];if(n=b,this.options.pedantic&&(n=n.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),d.test(n))break;if(x.test(n))break;if(k.test(n))break;if(f.test(h))break;if(n.search(/[^ ]/)>=r||!n.trim())o+="\n"+n.slice(r);else{if(s)break;if(4<=t.search(/[^ ]/))break;if(d.test(t))break;if(x.test(t))break;if(f.test(t))break;o+="\n"+n}s||n.trim()||(s=!0),a+=b+"\n",h=h.substring(b.length+1),t=n.slice(r)}u.loose||(c?u.loose=!0:/\n *\n *$/.test(a)&&(c=!0));let i=null,l;this.options.gfm&&(i=/^\[[ xX]\] /.exec(o))&&(l="[ ] "!==i[0],o=o.replace(/^\[[ xX]\] +/,"")),u.items.push({type:"list_item",raw:a,task:!!i,checked:l,loose:!1,text:o,tokens:[]}),u.raw+=a}u.items[u.items.length-1].raw=a.trimEnd(),u.items[u.items.length-1].text=o.trimEnd(),u.raw=u.raw.trimEnd();for(let e=0;e"space"===e.type)).length&&t.some(e=>/\n.*\n/.test(e.raw)),u.loose=t);if(u.loose)for(let e=0;e$/,"$1").replace(this.rules.inline._escapes,"$1"):"",r=e[3]&&e[3].substring(1,e[3].length-1).replace(this.rules.inline._escapes,"$1"),{type:"def",tag:t,raw:e[0],href:n,title:r}}table(e){e=this.rules.block.table.exec(e);if(e){var i={type:"table",raw:e[0],header:k(e[1]).map(e=>({text:e,tokens:[]})),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(i.header.length===i.align.length){let e=i.align.length,t,n,r,s;for(t=0;t({text:e,tokens:[]}));for(e=i.header.length,n=0;n/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){n=this.rules.inline.link.exec(n);if(n){var r=n[2].trim();if(!this.options.pedantic&&/^$/.test(r))return;var s=f(r.slice(0,-1),"\\");if((r.length-s.length)%2==0)return}else{var i,s=function(n,r){if(-1!==n.indexOf(r[1])){let t=0;for(let e=0;e$/.test(r)?e.slice(1):e.slice(1,-1):e)&&e.replace(this.rules.inline._escapes,"$1"),title:t&&t.replace(this.rules.inline._escapes,"$1")},n[0],this.lexer)}}reflink(t,n){let r;if(r=(r=this.rules.inline.reflink.exec(t))||this.rules.inline.nolink.exec(t)){let e=(r[2]||r[1]).replace(/\s+/g," ");return(e=n[e.toLowerCase()])?d(r,e,r[0],this.lexer):{type:"text",raw:t=r[0].charAt(0),text:t}}}emStrong(s,i,e=""){let l=this.rules.inline.emStrong.lDelim.exec(s);if(l&&((!l[3]||!e.match(/[\p{L}\p{N}]/u))&&(!(l[1]||l[2]||"")||!e||this.rules.inline.punctuation.exec(e)))){var a=[...l[0]].length-1;let e,t,n=a,r=0;var o,c,h="*"===l[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(h.lastIndex=0,i=i.slice(-1*s.length+a);null!=(l=h.exec(i));)if(e=l[1]||l[2]||l[3]||l[4]||l[5]||l[6])if(t=[...e].length,l[3]||l[4])n+=t;else if((l[5]||l[6])&&a%3&&!((a+t)%3))r+=t;else if(!(0<(n-=t)))return t=Math.min(t,t+n+r),o=[...s].slice(0,a+l.index+t+1).join(""),Math.min(a,t)%2?(c=o.slice(1,-1),{type:"em",raw:o,text:c,tokens:this.lexer.inlineTokens(c)}):(c=o.slice(2,-2),{type:"strong",raw:o,text:c,tokens:this.lexer.inlineTokens(c)})}}codespan(t){t=this.rules.inline.code.exec(t);if(t){let e=t[2].replace(/\n/g," ");var n=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return e=c(e=n&&r?e.substring(1,e.length-1):e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){e=this.rules.inline.br.exec(e);if(e)return{type:"br",raw:e[0]}}del(e){e=this.rules.inline.del.exec(e);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n){n=this.rules.inline.autolink.exec(n);if(n){let e,t;return t="@"===n[2]?"mailto:"+(e=c(n[1])):e=c(n[1]),{type:"link",raw:n[0],text:e,href:t,tokens:[{type:"text",raw:e,text:e}]}}}url(e){var n,r;if(n=this.rules.inline.url.exec(e)){let e,t;if("@"===n[2])e=c(n[0]),t="mailto:"+e;else{for(;r=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0],r!==n[0];);e=c(n[0]),t="www."===n[1]?"http://"+n[0]:n[0]}return{type:"link",raw:n[0],text:e,href:t,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(t){t=this.rules.inline.text.exec(t);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:c(t[0]),{type:"text",raw:t[0],text:e}}}}const x={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:g,lheading:/^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/},m=(x.def=p(x.def).replace("label",x._label).replace("title",x._title).getRegex(),x.bullet=/(?:[*+-]|\d{1,9}[.)])/,x.listItemStart=p(/^( *)(bull) */).replace("bull",x.bullet).getRegex(),x.list=p(x.list).replace(/bull/g,x.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+x.def.source+")").getRegex(),x._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",x._comment=/|$)/,x.html=p(x.html,"i").replace("comment",x._comment).replace("tag",x._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),x.lheading=p(x.lheading).replace(/bull/g,x.bullet).getRegex(),x.paragraph=p(x._paragraph).replace("hr",x.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",x._tag).getRegex(),x.blockquote=p(x.blockquote).replace("paragraph",x.paragraph).getRegex(),x.normal={...x},x.gfm={...x.normal,table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"},x.gfm.table=p(x.gfm.table).replace("hr",x.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",x._tag).getRegex(),x.gfm.paragraph=p(x._paragraph).replace("hr",x.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",x.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",x._tag).getRegex(),x.pedantic={...x.normal,html:p("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",x._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:g,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:p(x.normal._paragraph).replace("hr",x.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",x.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()},{escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:g,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,rDelimAst:/^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:g,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`^|~"});m.punctuation=p(m.punctuation,"u").replace(/punctuation/g,m._punctuation).getRegex(),m.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,m.anyPunctuation=/\\[punct]/g,m._escapes=/\\([punct])/g,m._comment=p(x._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),m.emStrong.lDelim=p(m.emStrong.lDelim,"u").replace(/punct/g,m._punctuation).getRegex(),m.emStrong.rDelimAst=p(m.emStrong.rDelimAst,"gu").replace(/punct/g,m._punctuation).getRegex(),m.emStrong.rDelimUnd=p(m.emStrong.rDelimUnd,"gu").replace(/punct/g,m._punctuation).getRegex(),m.anyPunctuation=p(m.anyPunctuation,"gu").replace(/punct/g,m._punctuation).getRegex(),m._escapes=p(m._escapes,"gu").replace(/punct/g,m._punctuation).getRegex(),m._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,m._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,m.autolink=p(m.autolink).replace("scheme",m._scheme).replace("email",m._email).getRegex(),m._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,m.tag=p(m.tag).replace("comment",m._comment).replace("attribute",m._attribute).getRegex(),m._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,m._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,m._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,m.link=p(m.link).replace("label",m._label).replace("href",m._href).replace("title",m._title).getRegex(),m.reflink=p(m.reflink).replace("label",m._label).replace("ref",x._label).getRegex(),m.nolink=p(m.nolink).replace("ref",x._label).getRegex(),m.reflinkSearch=p(m.reflinkSearch,"g").replace("reflink",m.reflink).replace("nolink",m.nolink).getRegex(),m.normal={...m},m.pedantic={...m.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:p(/^!?\[(label)\]\((.*?)\)/).replace("label",m._label).getRegex(),reflink:p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",m._label).getRegex()},m.gfm={...m.normal,escape:p(m.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\t+" ".repeat(n.length));let n,e,s,i;for(;r;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(e=>!!(n=e.call({lexer:this},r,t))&&(r=r.substring(n.raw.length),t.push(n),!0))))if(n=this.tokenizer.space(r))r=r.substring(n.raw.length),1===n.raw.length&&0{"number"==typeof(n=e.call({lexer:this},a))&&0<=n&&(t=Math.min(t,n))}),t<1/0&&0<=t&&(s=r.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s)))e=t[t.length-1],i&&"paragraph"===e.type?(e.raw+="\n"+n.raw,e.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=e.text):t.push(n),i=s.length!==r.length,r=r.substring(n.raw.length);else if(n=this.tokenizer.text(r))r=r.substring(n.raw.length),(e=t[t.length-1])&&"text"===e.type?(e.raw+="\n"+n.raw,e.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=e.text):t.push(n);else if(r){var l="Infinite loop on byte: "+r.charCodeAt(0);if(this.options.silent){console.error(l);break}throw new Error(l)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(r,t=[]){let n,e,s,i=r,l,a,o;if(this.tokens.links){var c=Object.keys(this.tokens.links);if(0!!(n=e.call({lexer:this},r,t))&&(r=r.substring(n.raw.length),t.push(n),!0))))if(n=this.tokenizer.escape(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(r))r=r.substring(n.raw.length),(e=t[t.length-1])&&"text"===n.type&&"text"===e.type?(e.raw+=n.raw,e.text+=n.text):t.push(n);else if(n=this.tokenizer.link(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(r,this.tokens.links))r=r.substring(n.raw.length),(e=t[t.length-1])&&"text"===n.type&&"text"===e.type?(e.raw+=n.raw,e.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(r,i,o))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(r))r=r.substring(n.raw.length),t.push(n);else if(!this.state.inLink&&(n=this.tokenizer.url(r)))r=r.substring(n.raw.length),t.push(n);else{if(s=r,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const p=r.slice(1);let n;this.options.extensions.startInline.forEach(e=>{"number"==typeof(n=e.call({lexer:this},p))&&0<=n&&(t=Math.min(t,n))}),t<1/0&&0<=t&&(s=r.substring(0,t+1))}if(n=this.tokenizer.inlineText(s))r=r.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),a=!0,(e=t[t.length-1])&&"text"===e.type?(e.raw+=n.raw,e.text+=n.text):t.push(n);else if(r){var h="Infinite loop on byte: "+r.charCodeAt(0);if(this.options.silent){console.error(h);break}throw new Error(h)}}return t}}class y{options;constructor(e){this.options=e||t.defaults}code(e,t,n){t=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",t?'
'+(n?e:c(e,!0))+"
\n":"
"+(n?e:c(e,!0))+"
\n"}blockquote(e){return`
+${e}
+`}html(e,t){return e}heading(e,t,n){return`${e} +`}hr(){return"
\n"}list(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"}listitem(e,t,n){return`
  • ${e}
  • +`}checkbox(e){return"'}paragraph(e){return`

    ${e}

    +`}table(e,t){return"\n\n"+e+"\n"+(t=t&&`${t}`)+"
    \n"}tablerow(e){return` +${e} +`}tablecell(e,t){var n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+` +`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return"
    "}del(e){return`${e}`}link(e,t,n){var r=u(e);if(null===r)return n;let s='"}image(e,t,n){var r=u(e);if(null===r)return n;let s=`${n}"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""));continue;case"code":i+=this.renderer.code(l.text,l.lang,!!l.escaped);continue;case"table":{var o=l,a="";let t="";for(let e=0;e{n=n.concat(this.walkTokens(o[e],t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){const m=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{var t={...e};if(t.async=this.defaults.async||t.async||!1,e.extensions&&(e.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){const r=m.renderers[n.name];r?m.renderers[n.name]=function(...e){let t=n.renderer.apply(this,e);return t=!1===t?r.apply(this,e):t}:m.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||"block"!==n.level&&"inline"!==n.level)throw new Error("extension level must be 'block' or 'inline'");var e=m[n.level];e?e.unshift(n.tokenizer):m[n.level]=[n.tokenizer],n.start&&("block"===n.level?m.startBlock?m.startBlock.push(n.start):m.startBlock=[n.start]:"inline"===n.level&&(m.startInline?m.startInline.push(n.start):m.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(m.childTokens[n.name]=n.childTokens)}),t.extensions=m),e.renderer){const i=this.defaults.renderer||new y(this.defaults);for(const l in e.renderer){const a=e.renderer[l];var n=l;const o=i[n];i[n]=(...e)=>{let t=a.apply(i,e);return(t=!1===t?o.apply(i,e):t)||""}}t.renderer=i}if(e.tokenizer){const c=this.defaults.tokenizer||new w(this.defaults);for(const h in e.tokenizer){const p=e.tokenizer[h];var r=h;const u=c[r];c[r]=(...e)=>{let t=p.apply(c,e);return t=!1===t?u.apply(c,e):t}}t.tokenizer=c}if(e.hooks){const g=this.defaults.hooks||new v;for(const k in e.hooks){const f=e.hooks[k];var s=k;const d=g[s];v.passThroughHooks.has(k)?g[s]=e=>{return this.defaults.async?Promise.resolve(f.call(g,e)).then(e=>d.call(g,e)):(e=f.call(g,e),d.call(g,e))}:g[s]=(...e)=>{let t=f.apply(g,e);return t=!1===t?d.apply(g,e):t}}t.hooks=g}if(e.walkTokens){const x=this.defaults.walkTokens,b=e.walkTokens;t.walkTokens=function(e){let t=[];return t.push(b.call(this,e)),t=x?t.concat(x.call(this,e)):t}}this.defaults={...this.defaults,...t}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}#parseMarkdown(i,l){return(t,n)=>{n={...n};const r={...this.defaults,...n};!0===this.defaults.async&&!1===n.async&&(r.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),r.async=!0);n=this.#onError(!!r.silent,!!r.async);if(null==t)return n(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(t):t).then(e=>i(e,r)).then(e=>r.walkTokens?Promise.all(this.walkTokens(e,r.walkTokens)).then(()=>e):e).then(e=>l(e,r)).then(e=>r.hooks?r.hooks.postprocess(e):e).catch(n);try{r.hooks&&(t=r.hooks.preprocess(t));var s=i(t,r);r.walkTokens&&this.walkTokens(s,r.walkTokens);let e=l(s,r);return e=r.hooks?r.hooks.postprocess(e):e}catch(e){return n(e)}}}#onError(n,r){return e=>{var t;if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",n)return t="

    An error occurred:

    "+c(e.message+"",!0)+"
    ",r?Promise.resolve(t):t;if(r)return Promise.reject(e);throw e}}}const S=new R;function T(e,t){return S.parse(e,t)}T.options=T.setOptions=function(e){return S.setOptions(e),n(T.defaults=S.defaults),T},T.getDefaults=e,T.defaults=t.defaults,T.use=function(...e){return S.use(...e),n(T.defaults=S.defaults),T},T.walkTokens=function(e,t){return S.walkTokens(e,t)},T.parseInline=S.parseInline,T.Parser=z,T.parser=z.parse,T.Renderer=y,T.TextRenderer=$,T.Lexer=_,T.lexer=_.lex,T.Tokenizer=w,T.Hooks=v;var g=(T.parse=T).options,A=T.setOptions,I=T.use,E=T.walkTokens,Z=T.parseInline,q=T,L=z.parse,D=_.lex;t.Hooks=v,t.Lexer=_,t.Marked=R,t.Parser=z,t.Renderer=y,t.TextRenderer=$,t.Tokenizer=w,t.getDefaults=e,t.lexer=D,t.marked=T,t.options=g,t.parse=q,t.parseInline=Z,t.parser=L,t.setOptions=A,t.use=I,t.walkTokens=E}); \ No newline at end of file diff --git a/src/external/stellar-freighter-api/@shared/api/external.d.ts b/src/external/stellar-freighter-api/@shared/api/external.d.ts new file mode 100644 index 0000000..9755ca4 --- /dev/null +++ b/src/external/stellar-freighter-api/@shared/api/external.d.ts @@ -0,0 +1,24 @@ +import { UserInfo } from "./types"; +export declare const requestPublicKey: () => Promise; +export declare const submitTransaction: (transactionXdr: string, opts?: string | { + network?: string | undefined; + accountToSign?: string | undefined; + networkPassphrase?: string | undefined; +} | undefined, accountToSign?: string | undefined) => Promise; +export declare const submitBlob: (blob: string, opts?: { + accountToSign?: string | undefined; +} | undefined) => Promise; +export declare const submitAuthEntry: (entryXdr: string, opts?: { + accountToSign?: string | undefined; +} | undefined) => Promise; +export declare const requestNetwork: () => Promise; +export declare const requestNetworkDetails: () => Promise<{ + network: string; + networkUrl: string; + networkPassphrase: string; + sorobanRpcUrl?: string | undefined; +}>; +export declare const requestConnectionStatus: () => Promise; +export declare const requestAllowedStatus: () => Promise; +export declare const setAllowedStatus: () => Promise; +export declare const requestUserInfo: () => Promise; diff --git a/src/external/stellar-freighter-api/@shared/api/helpers/extensionMessaging.d.ts b/src/external/stellar-freighter-api/@shared/api/helpers/extensionMessaging.d.ts new file mode 100644 index 0000000..1aed2d8 --- /dev/null +++ b/src/external/stellar-freighter-api/@shared/api/helpers/extensionMessaging.d.ts @@ -0,0 +1,9 @@ +import { EXTERNAL_SERVICE_TYPES, SERVICE_TYPES } from "../../constants/services"; +import { Response } from "../types"; +interface Msg { + [key: string]: any; + type: EXTERNAL_SERVICE_TYPES | SERVICE_TYPES; +} +export declare const sendMessageToContentScript: (msg: Msg) => Promise; +export declare const sendMessageToBackground: (msg: Msg) => Promise; +export {}; diff --git a/src/external/stellar-freighter-api/@shared/api/types.d.ts b/src/external/stellar-freighter-api/@shared/api/types.d.ts new file mode 100644 index 0000000..be44b6a --- /dev/null +++ b/src/external/stellar-freighter-api/@shared/api/types.d.ts @@ -0,0 +1,158 @@ +import BigNumber from "bignumber.js"; +import { Horizon } from "stellar-sdk"; +import { Types } from "@stellar/wallet-sdk"; +import { SERVICE_TYPES, EXTERNAL_SERVICE_TYPES } from "../constants/services"; +import { APPLICATION_STATE } from "../constants/applicationState"; +import { WalletType } from "../constants/hardwareWallet"; +import { NetworkDetails } from "../constants/stellar"; +export declare enum ActionStatus { + IDLE = "IDLE", + PENDING = "PENDING", + SUCCESS = "SUCCESS", + ERROR = "ERROR" +} +export interface UserInfo { + publicKey: string; +} +export interface Response { + error: string; + messagedId: number; + applicationState: APPLICATION_STATE; + publicKey: string; + privateKey: string; + hasPrivateKey: boolean; + mnemonicPhrase: string; + isCorrectPhrase: boolean; + confirmedPassword: boolean; + password: string; + mnemonicPhraseToConfirm: string; + recoverMnemonic: string; + transaction: { + sign: (sourceKeys: {}) => void; + }; + transactionXDR: string; + signedTransaction: string; + signedBlob: string; + signedAuthEntry: string; + source: string; + type: SERVICE_TYPES; + url: string; + isDataSharingAllowed: boolean; + isTestnet: boolean; + isMemoValidationEnabled: boolean; + isSafetyValidationEnabled: boolean; + isValidatingSafeAssetsEnabled: boolean; + isExperimentalModeEnabled: boolean; + networkDetails: NetworkDetails; + sorobanRpcUrl: string; + networksList: NetworkDetails[]; + allAccounts: Array; + accountName: string; + assetCode: string; + assetCanonical: string; + iconUrl: string; + network: string; + networkIndex: number; + networkName: string; + recentAddresses: Array; + hardwareWalletType: WalletType; + bipPath: string; + blockedDomains: BlockedDomains; + blockedAccounts: BlockedAccount[]; + assetDomain: string; + contractId: string; + tokenId: string; + tokenIdList: string[]; + isConnected: boolean; + isAllowed: boolean; + userInfo: UserInfo; + allowList: string[]; +} +export interface BlockedDomains { + [key: string]: boolean; +} +export interface BlockedAccount { + address: string; + name: string; + domain: string | null; + tags: string[]; +} +export interface ExternalRequestBase { + network: string; + networkPassphrase: string; + accountToSign: string; + type: EXTERNAL_SERVICE_TYPES; +} +export interface ExternalRequestTx extends ExternalRequestBase { + transactionXdr: string; +} +export interface ExternalRequestBlob extends ExternalRequestBase { + blob: string; +} +export interface ExternalRequestAuthEntry extends ExternalRequestBase { + entryXdr: string; +} +export declare type ExternalRequest = ExternalRequestTx | ExternalRequestBlob | ExternalRequestAuthEntry; +export interface Account { + publicKey: string; + name: string; + imported: boolean; + hardwareWalletType?: WalletType; +} +export declare enum AccountType { + HW = "HW", + IMPORTED = "IMPORTED", + FREIGHTER = "FREIGHTER" +} +export interface Preferences { + isDataSharingAllowed: boolean; + isMemoValidationEnabled: boolean; + isSafetyValidationEnabled: boolean; + isValidatingSafeAssetsEnabled: boolean; + networksList: NetworkDetails[]; + error: string; + isExperimentalModeEnabled: boolean; +} +export declare type Settings = { + allowList: string[]; + networkDetails: NetworkDetails; + networksList: NetworkDetails[]; + error: string; +} & Preferences; +export interface AssetIcons { + [code: string]: string; +} +export interface AssetDomains { + [code: string]: string; +} +export declare type Balances = Types.BalanceMap | null; +export interface SorobanBalance { + contractId: string; + total: BigNumber; + name: string; + symbol: string; + decimals: number; +} +export declare type AssetType = Types.AssetBalance | Types.NativeBalance | SorobanBalance; +export declare type TokenBalances = SorobanBalance[]; +export declare type HorizonOperation = any; +export interface AccountBalancesInterface { + balances: Balances; + isFunded: boolean | null; + subentryCount: number; +} +export interface AccountHistoryInterface { + operations: Array | []; +} +export interface ErrorMessage { + errorMessage: string; + response?: Horizon.ErrorResponseData.TransactionFailed; +} +declare global { + interface Window { + freighter: boolean; + freighterApi: { + [key: string]: any; + }; + } +} diff --git a/src/external/stellar-freighter-api/@shared/constants/applicationState.d.ts b/src/external/stellar-freighter-api/@shared/constants/applicationState.d.ts new file mode 100644 index 0000000..44f8f14 --- /dev/null +++ b/src/external/stellar-freighter-api/@shared/constants/applicationState.d.ts @@ -0,0 +1,8 @@ +export declare enum APPLICATION_STATE { + APPLICATION_LOADING = "APPLICATION_LOADING", + APPLICATION_ERROR = "APPLICATION_ERROR", + APPLICATION_STARTED = "APPLICATION_STARTED", + PASSWORD_CREATED = "PASSWORD_CREATED", + MNEMONIC_PHRASE_CONFIRMED = "MNEMONIC_PHRASE_CONFIRMED", + MNEMONIC_PHRASE_FAILED = "MNEMONIC_PHRASE_FAILED" +} diff --git a/src/external/stellar-freighter-api/@shared/constants/hardwareWallet.d.ts b/src/external/stellar-freighter-api/@shared/constants/hardwareWallet.d.ts new file mode 100644 index 0000000..54b6088 --- /dev/null +++ b/src/external/stellar-freighter-api/@shared/constants/hardwareWallet.d.ts @@ -0,0 +1,4 @@ +export declare enum WalletType { + LEDGER = "Ledger", + NONE = "" +} diff --git a/src/external/stellar-freighter-api/@shared/constants/services.d.ts b/src/external/stellar-freighter-api/@shared/constants/services.d.ts new file mode 100644 index 0000000..7c4738b --- /dev/null +++ b/src/external/stellar-freighter-api/@shared/constants/services.d.ts @@ -0,0 +1,62 @@ +export declare enum SERVICE_TYPES { + CREATE_ACCOUNT = "CREATE_ACCOUNT", + FUND_ACCOUNT = "FUND_ACCOUNT", + ADD_ACCOUNT = "ADD_ACCOUNT", + IMPORT_ACCOUNT = "IMPORT_ACCOUNT", + IMPORT_HARDWARE_WALLET = "IMPORT_HARDWARE_WALLET", + LOAD_ACCOUNT = "LOAD_ACCOUNT", + MAKE_ACCOUNT_ACTIVE = "MAKE_ACCOUNT_ACTIVE", + UPDATE_ACCOUNT_NAME = "UPDATE_ACCOUNT_NAME", + GET_MNEMONIC_PHRASE = "GET_MNEMONIC_PHRASE", + CONFIRM_MNEMONIC_PHRASE = "CONFIRM_MNEMONIC_PHRASE", + RECOVER_ACCOUNT = "RECOVER_ACCOUNT", + CONFIRM_PASSWORD = "CONFIRM_PASSWORD", + REJECT_ACCESS = "REJECT_ACCESS", + GRANT_ACCESS = "GRANT_ACCESS", + SIGN_TRANSACTION = "SIGN_TRANSACTION", + SIGN_BLOB = "SIGN_BLOB", + SIGN_AUTH_ENTRY = "SIGN_AUTH_ENTRY", + HANDLE_SIGNED_HW_TRANSACTION = "HANDLE_SIGNED_HW_TRANSACTION", + REJECT_TRANSACTION = "REJECT_TRANSACTION", + SIGN_FREIGHTER_TRANSACTION = "SIGN_FREIGHTER_TRANSACTION", + SIGN_FREIGHTER_SOROBAN_TRANSACTION = "SIGN_FREIGHTER_SOROBAN_TRANSACTION", + ADD_RECENT_ADDRESS = "ADD_RECENT_ADDRESS", + LOAD_RECENT_ADDRESSES = "LOAD_RECENT_ADDRESSES", + SIGN_OUT = "SIGN_OUT", + SHOW_BACKUP_PHRASE = "SHOW_BACKUP_PHRASE", + SAVE_ALLOWLIST = "SAVE_ALLOWLIST", + SAVE_SETTINGS = "SAVE_SETTINGS", + LOAD_SETTINGS = "LOAD_SETTINGS", + GET_CACHED_ASSET_ICON = "GET_CACHED_ASSET_ICON", + CACHE_ASSET_ICON = "CACHE_ASSET_ICON", + GET_CACHED_ASSET_DOMAIN = "GET_CACHED_ASSET_DOMAIN", + CACHE_ASSET_DOMAIN = "CACHE_ASSET_DOMAIN", + GET_BLOCKED_ACCOUNTS = "GET_BLOCKED_ACCOUNTS", + GET_BLOCKED_DOMAINS = "GET_BLOCKED_DOMAINS", + ADD_CUSTOM_NETWORK = "ADD_CUSTOM_NETWORK", + CHANGE_NETWORK = "CHANGE_NETWORK", + REMOVE_CUSTOM_NETWORK = "REMOVE_CUSTOM_NETWORK", + EDIT_CUSTOM_NETWORK = "EDIT_CUSTOM_NETWORK", + RESET_EXP_DATA = "RESET_EXP_DATA", + ADD_TOKEN_ID = "ADD_TOKEN_ID", + GET_TOKEN_IDS = "GET_TOKEN_IDS", + REMOVE_TOKEN_ID = "REMOVE_TOKEN_ID" +} +export declare enum EXTERNAL_SERVICE_TYPES { + REQUEST_ACCESS = "REQUEST_ACCESS", + SUBMIT_TRANSACTION = "SUBMIT_TRANSACTION", + SUBMIT_BLOB = "SUBMIT_BLOB", + SUBMIT_AUTH_ENTRY = "SUBMIT_AUTH_ENTRY", + REQUEST_NETWORK = "REQUEST_NETWORK", + REQUEST_NETWORK_DETAILS = "REQUEST_NETWORK_DETAILS", + REQUEST_CONNECTION_STATUS = "REQUEST_CONNECTION_STATUS", + REQUEST_ALLOWED_STATUS = "REQUEST_ALLOWED_STATUS", + SET_ALLOWED_STATUS = "SET_ALLOWED_STATUS", + REQUEST_USER_INFO = "REQUEST_USER_INFO" +} +export declare const EXTERNAL_MSG_REQUEST = "FREIGHTER_EXTERNAL_MSG_REQUEST"; +export declare const EXTERNAL_MSG_RESPONSE = "FREIGHTER_EXTERNAL_MSG_RESPONSE"; +declare const _DEV_SERVER: string; +export { _DEV_SERVER as DEV_SERVER }; +declare const _DEV_EXTENSION: string; +export { _DEV_EXTENSION as DEV_EXTENSION }; diff --git a/src/external/stellar-freighter-api/@shared/constants/stellar.d.ts b/src/external/stellar-freighter-api/@shared/constants/stellar.d.ts new file mode 100644 index 0000000..7f54032 --- /dev/null +++ b/src/external/stellar-freighter-api/@shared/constants/stellar.d.ts @@ -0,0 +1,34 @@ +export declare enum NETWORK_NAMES { + TESTNET = "Test Net", + PUBNET = "Main Net", + FUTURENET = "Future Net" +} +export declare enum NETWORKS { + PUBLIC = "PUBLIC", + TESTNET = "TESTNET", + FUTURENET = "FUTURENET" +} +export declare enum NETWORK_URLS { + PUBLIC = "https://horizon.stellar.org", + TESTNET = "https://horizon-testnet.stellar.org", + FUTURENET = "https://horizon-futurenet.stellar.org" +} +export declare enum FRIENDBOT_URLS { + TESTNET = "https://friendbot.stellar.org", + FUTURENET = "https://friendbot-futurenet.stellar.org" +} +export declare const SOROBAN_RPC_URLS: { + [key in NETWORKS]?: string; +}; +export interface NetworkDetails { + network: string; + networkName: string; + networkUrl: string; + networkPassphrase: string; + friendbotUrl?: string; + sorobanRpcUrl?: string; +} +export declare const MAINNET_NETWORK_DETAILS: NetworkDetails; +export declare const TESTNET_NETWORK_DETAILS: NetworkDetails; +export declare const FUTURENET_NETWORK_DETAILS: NetworkDetails; +export declare const DEFAULT_NETWORKS: Array; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetwork.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetwork.d.ts new file mode 100644 index 0000000..6352aa0 --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetwork.d.ts @@ -0,0 +1 @@ +export declare const getNetwork: () => Promise; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetworkDetails.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetworkDetails.d.ts new file mode 100644 index 0000000..b161629 --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getNetworkDetails.d.ts @@ -0,0 +1,6 @@ +export declare const getNetworkDetails: () => Promise<{ + network: string; + networkUrl: string; + networkPassphrase: string; + sorobanRpcUrl?: string; +}>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getPublicKey.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getPublicKey.d.ts new file mode 100644 index 0000000..80cf670 --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getPublicKey.d.ts @@ -0,0 +1 @@ +export declare const getPublicKey: () => Promise; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/getUserInfo.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getUserInfo.d.ts new file mode 100644 index 0000000..0a464a2 --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/getUserInfo.d.ts @@ -0,0 +1,3 @@ +export declare const getUserInfo: () => Promise<{ + publicKey: string; +}>; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/index.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/index.d.ts new file mode 100644 index 0000000..8c3e29a --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/index.d.ts @@ -0,0 +1,40 @@ +import { getPublicKey } from "./getPublicKey"; +import { signTransaction } from "./signTransaction"; +import { signBlob } from "./signBlob"; +import { signAuthEntry } from "./signAuthEntry"; +import { isConnected } from "./isConnected"; +import { getNetwork } from "./getNetwork"; +import { getNetworkDetails } from "./getNetworkDetails"; +import { isAllowed } from "./isAllowed"; +import { setAllowed } from "./setAllowed"; +import { getUserInfo } from "./getUserInfo"; +export declare const isBrowser: boolean; +export { getPublicKey, signTransaction, signBlob, signAuthEntry, isConnected, getNetwork, getNetworkDetails, isAllowed, setAllowed, getUserInfo, }; +declare const _default: { + getPublicKey: () => Promise; + signTransaction: (transactionXdr: string, opts?: { + network?: string | undefined; + networkPassphrase?: string | undefined; + accountToSign?: string | undefined; + } | undefined) => Promise; + signBlob: (blob: string, opts?: { + accountToSign?: string | undefined; + } | undefined) => Promise; + signAuthEntry: (entryXdr: string, opts?: { + accountToSign?: string | undefined; + } | undefined) => Promise; + isConnected: () => Promise; + getNetwork: () => Promise; + getNetworkDetails: () => Promise<{ + network: string; + networkUrl: string; + networkPassphrase: string; + sorobanRpcUrl?: string | undefined; + }>; + isAllowed: () => Promise; + setAllowed: () => Promise; + getUserInfo: () => Promise<{ + publicKey: string; + }>; +}; +export default _default; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/isAllowed.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/isAllowed.d.ts new file mode 100644 index 0000000..39eed0a --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/isAllowed.d.ts @@ -0,0 +1 @@ +export declare const isAllowed: () => Promise; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/isConnected.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/isConnected.d.ts new file mode 100644 index 0000000..8e4b262 --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/isConnected.d.ts @@ -0,0 +1 @@ +export declare const isConnected: () => Promise; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/setAllowed.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/setAllowed.d.ts new file mode 100644 index 0000000..989cab6 --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/setAllowed.d.ts @@ -0,0 +1 @@ +export declare const setAllowed: () => Promise; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/signAuthEntry.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signAuthEntry.d.ts new file mode 100644 index 0000000..ca8cc91 --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signAuthEntry.d.ts @@ -0,0 +1,3 @@ +export declare const signAuthEntry: (entryXdr: string, opts?: { + accountToSign?: string | undefined; +} | undefined) => Promise; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/signBlob.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signBlob.d.ts new file mode 100644 index 0000000..eab6a5a --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signBlob.d.ts @@ -0,0 +1,3 @@ +export declare const signBlob: (blob: string, opts?: { + accountToSign?: string | undefined; +} | undefined) => Promise; diff --git a/src/external/stellar-freighter-api/@stellar/freighter-api/src/signTransaction.d.ts b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signTransaction.d.ts new file mode 100644 index 0000000..2605f0f --- /dev/null +++ b/src/external/stellar-freighter-api/@stellar/freighter-api/src/signTransaction.d.ts @@ -0,0 +1,5 @@ +export declare const signTransaction: (transactionXdr: string, opts?: { + network?: string | undefined; + networkPassphrase?: string | undefined; + accountToSign?: string | undefined; +} | undefined) => Promise; diff --git a/src/external/stellar-freighter-api/config/shims/webextension-polyfill.d.ts b/src/external/stellar-freighter-api/config/shims/webextension-polyfill.d.ts new file mode 100644 index 0000000..c1f1e2b --- /dev/null +++ b/src/external/stellar-freighter-api/config/shims/webextension-polyfill.d.ts @@ -0,0 +1,8 @@ +declare const _default: { + tabs: { + create: ({ url }: { + url: string; + }) => Window | null; + }; +}; +export default _default; diff --git a/src/external/stellar-freighter-api/index.min.js b/src/external/stellar-freighter-api/index.min.js new file mode 100644 index 0000000..bcd8fc3 --- /dev/null +++ b/src/external/stellar-freighter-api/index.min.js @@ -0,0 +1 @@ +!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.freighterApi=r():e.freighterApi=r()}(this,()=>(()=>{"use strict";var e,r,o={d:(e,r)=>{for(var E in r)o.o(r,E)&&!o.o(e,E)&&Object.defineProperty(e,E,{enumerable:!0,get:r[E]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},E={};o.r(E),o.d(E,{default:()=>a,getNetwork:()=>N,getNetworkDetails:()=>s,getPublicKey:()=>t,getUserInfo:()=>i,isAllowed:()=>O,isBrowser:()=>R,isConnected:()=>n,setAllowed:()=>C,signAuthEntry:()=>A,signBlob:()=>S,signTransaction:()=>_}),function(e){e.CREATE_ACCOUNT="CREATE_ACCOUNT",e.FUND_ACCOUNT="FUND_ACCOUNT",e.ADD_ACCOUNT="ADD_ACCOUNT",e.IMPORT_ACCOUNT="IMPORT_ACCOUNT",e.IMPORT_HARDWARE_WALLET="IMPORT_HARDWARE_WALLET",e.LOAD_ACCOUNT="LOAD_ACCOUNT",e.MAKE_ACCOUNT_ACTIVE="MAKE_ACCOUNT_ACTIVE",e.UPDATE_ACCOUNT_NAME="UPDATE_ACCOUNT_NAME",e.GET_MNEMONIC_PHRASE="GET_MNEMONIC_PHRASE",e.CONFIRM_MNEMONIC_PHRASE="CONFIRM_MNEMONIC_PHRASE",e.RECOVER_ACCOUNT="RECOVER_ACCOUNT",e.CONFIRM_PASSWORD="CONFIRM_PASSWORD",e.REJECT_ACCESS="REJECT_ACCESS",e.GRANT_ACCESS="GRANT_ACCESS",e.SIGN_TRANSACTION="SIGN_TRANSACTION",e.SIGN_BLOB="SIGN_BLOB",e.SIGN_AUTH_ENTRY="SIGN_AUTH_ENTRY",e.HANDLE_SIGNED_HW_TRANSACTION="HANDLE_SIGNED_HW_TRANSACTION",e.REJECT_TRANSACTION="REJECT_TRANSACTION",e.SIGN_FREIGHTER_TRANSACTION="SIGN_FREIGHTER_TRANSACTION",e.SIGN_FREIGHTER_SOROBAN_TRANSACTION="SIGN_FREIGHTER_SOROBAN_TRANSACTION",e.ADD_RECENT_ADDRESS="ADD_RECENT_ADDRESS",e.LOAD_RECENT_ADDRESSES="LOAD_RECENT_ADDRESSES",e.SIGN_OUT="SIGN_OUT",e.SHOW_BACKUP_PHRASE="SHOW_BACKUP_PHRASE",e.SAVE_ALLOWLIST="SAVE_ALLOWLIST",e.SAVE_SETTINGS="SAVE_SETTINGS",e.LOAD_SETTINGS="LOAD_SETTINGS",e.GET_CACHED_ASSET_ICON="GET_CACHED_ASSET_ICON",e.CACHE_ASSET_ICON="CACHE_ASSET_ICON",e.GET_CACHED_ASSET_DOMAIN="GET_CACHED_ASSET_DOMAIN",e.CACHE_ASSET_DOMAIN="CACHE_ASSET_DOMAIN",e.GET_BLOCKED_ACCOUNTS="GET_BLOCKED_ACCOUNTS",e.GET_BLOCKED_DOMAINS="GET_BLOCKED_DOMAINS",e.ADD_CUSTOM_NETWORK="ADD_CUSTOM_NETWORK",e.CHANGE_NETWORK="CHANGE_NETWORK",e.REMOVE_CUSTOM_NETWORK="REMOVE_CUSTOM_NETWORK",e.EDIT_CUSTOM_NETWORK="EDIT_CUSTOM_NETWORK",e.RESET_EXP_DATA="RESET_EXP_DATA",e.ADD_TOKEN_ID="ADD_TOKEN_ID",e.GET_TOKEN_IDS="GET_TOKEN_IDS",e.REMOVE_TOKEN_ID="REMOVE_TOKEN_ID"}(e||(e={})),function(e){e.REQUEST_ACCESS="REQUEST_ACCESS",e.SUBMIT_TRANSACTION="SUBMIT_TRANSACTION",e.SUBMIT_BLOB="SUBMIT_BLOB",e.SUBMIT_AUTH_ENTRY="SUBMIT_AUTH_ENTRY",e.REQUEST_NETWORK="REQUEST_NETWORK",e.REQUEST_NETWORK_DETAILS="REQUEST_NETWORK_DETAILS",e.REQUEST_CONNECTION_STATUS="REQUEST_CONNECTION_STATUS",e.REQUEST_ALLOWED_STATUS="REQUEST_ALLOWED_STATUS",e.SET_ALLOWED_STATUS="SET_ALLOWED_STATUS",e.REQUEST_USER_INFO="REQUEST_USER_INFO"}(r||(r={}));const T=e=>{const o=Date.now()+Math.random();return window.postMessage({source:"FREIGHTER_EXTERNAL_MSG_REQUEST",messageId:o,...e},window.location.origin),new Promise(E=>{let T=0;e.type===r.REQUEST_CONNECTION_STATUS&&(T=setTimeout(()=>{E({isConnected:!1}),window.removeEventListener("message",t)},2e3));const t=e=>{var r,_;e.source===window&&"FREIGHTER_EXTERNAL_MSG_RESPONSE"===(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.source)&&(null===(_=null==e?void 0:e.data)||void 0===_?void 0:_.messagedId)===o&&(E(e.data),window.removeEventListener("message",t),clearTimeout(T))};window.addEventListener("message",t,!1)})},t=()=>R?(async()=>{let e={publicKey:"",error:""};try{e=await T({type:r.REQUEST_ACCESS})}catch(e){console.error(e)}const{publicKey:o,error:E}=e;if(E)throw E;return o})():Promise.resolve(""),_=(e,o)=>R?(async(e,o,E)=>{let t="",_="",S="";"object"==typeof o?(t=o.network||"",_=o.accountToSign||"",S=o.networkPassphrase||""):(t=o||"",_="");let A={signedTransaction:"",error:""};try{A=await T({transactionXdr:e,network:t,networkPassphrase:S,accountToSign:_,type:r.SUBMIT_TRANSACTION})}catch(e){throw console.error(e),e}const{signedTransaction:n,error:N}=A;if(N)throw N;return n})(e,o):Promise.resolve(""),S=(e,o)=>R?(async(e,o)=>{let E={signedBlob:"",error:""};const t=(o||{}).accountToSign||"";try{E=await T({blob:e,accountToSign:t,type:r.SUBMIT_BLOB})}catch(e){throw console.error(e),e}const{signedBlob:_,error:S}=E;if(S)throw S;return _})(e,o):Promise.resolve(""),A=(e,o)=>R?(async(e,o)=>{let E={signedAuthEntry:"",error:""};const t=(o||{}).accountToSign||"";try{E=await T({entryXdr:e,accountToSign:t,type:r.SUBMIT_AUTH_ENTRY})}catch(e){console.error(e)}const{signedAuthEntry:_,error:S}=E;if(S)throw S;return _})(e,o):Promise.resolve(""),n=()=>R?window.freighter?Promise.resolve(window.freighter):(async()=>{let e={isConnected:!1};try{e=await T({type:r.REQUEST_CONNECTION_STATUS})}catch(e){console.error(e)}return e.isConnected})():Promise.resolve(!1),N=()=>R?(async()=>{let e={network:"",error:""};try{e=await T({type:r.REQUEST_NETWORK})}catch(e){console.error(e)}const{network:o,error:E}=e;if(E)throw E;return o})():Promise.resolve(""),s=()=>R?(async()=>{let e={networkDetails:{network:"",networkName:"",networkUrl:"",networkPassphrase:"",sorobanRpcUrl:void 0},error:""};try{e=await T({type:r.REQUEST_NETWORK_DETAILS})}catch(e){console.error(e)}const{networkDetails:o,error:E}=e,{network:t,networkUrl:_,networkPassphrase:S,sorobanRpcUrl:A}=o;if(E)throw E;return{network:t,networkUrl:_,networkPassphrase:S,sorobanRpcUrl:A}})():Promise.resolve({network:"",networkUrl:"",networkPassphrase:"",sorobanRpcUrl:""}),O=()=>R?(async()=>{let e={isAllowed:!1};try{e=await T({type:r.REQUEST_ALLOWED_STATUS})}catch(e){console.error(e)}return e.isAllowed})():Promise.resolve(!1),C=()=>R?(async()=>{let e={isAllowed:!1,error:""};try{e=await T({type:r.SET_ALLOWED_STATUS})}catch(e){console.error(e)}const{isAllowed:o,error:E}=e;if(E)throw E;return o})():Promise.resolve(!1),i=()=>R?(async()=>{let e={userInfo:{publicKey:""},error:""};try{e=await T({type:r.REQUEST_USER_INFO})}catch(e){console.error(e)}const{userInfo:o,error:E}=e;if(E)throw E;return o})():Promise.resolve({publicKey:""}),R="undefined"!=typeof window,a={getPublicKey:t,signTransaction:_,signBlob:S,signAuthEntry:A,isConnected:n,getNetwork:N,getNetworkDetails:s,isAllowed:O,setAllowed:C,getUserInfo:i};return E})()); \ No newline at end of file diff --git a/src/external/stellarSdk.js b/src/external/stellarSdk.js new file mode 100644 index 0000000..4cf2a40 --- /dev/null +++ b/src/external/stellarSdk.js @@