From ceb9f2ca86ba2407936223e1524f1a1df4335a07 Mon Sep 17 00:00:00 2001 From: yasincaliskan Date: Tue, 24 Oct 2023 13:28:17 +0000 Subject: [PATCH] deploy: 2c1fe352b7cc62133a95ee986a7dda21f97509ff --- asset-manifest.json | 6 +++--- index.html | 2 +- static/js/main.126ededd.chunk.js | 2 -- static/js/main.126ededd.chunk.js.map | 1 - static/js/main.8957c232.chunk.js | 2 ++ static/js/main.8957c232.chunk.js.map | 1 + 6 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 static/js/main.126ededd.chunk.js delete mode 100644 static/js/main.126ededd.chunk.js.map create mode 100644 static/js/main.8957c232.chunk.js create mode 100644 static/js/main.8957c232.chunk.js.map diff --git a/asset-manifest.json b/asset-manifest.json index 908a5d5..fd868a7 100644 --- a/asset-manifest.json +++ b/asset-manifest.json @@ -1,8 +1,8 @@ { "files": { "main.css": "/pera-demo-dapp/static/css/main.c74028e2.chunk.css", - "main.js": "/pera-demo-dapp/static/js/main.126ededd.chunk.js", - "main.js.map": "/pera-demo-dapp/static/js/main.126ededd.chunk.js.map", + "main.js": "/pera-demo-dapp/static/js/main.8957c232.chunk.js", + "main.js.map": "/pera-demo-dapp/static/js/main.8957c232.chunk.js.map", "runtime-main.js": "/pera-demo-dapp/static/js/runtime-main.47422eae.js", "runtime-main.js.map": "/pera-demo-dapp/static/js/runtime-main.47422eae.js.map", "static/css/2.61444cb8.chunk.css": "/pera-demo-dapp/static/css/2.61444cb8.chunk.css", @@ -21,6 +21,6 @@ "static/css/2.61444cb8.chunk.css", "static/js/2.c30b6f72.chunk.js", "static/css/main.c74028e2.chunk.css", - "static/js/main.126ededd.chunk.js" + "static/js/main.8957c232.chunk.js" ] } \ No newline at end of file diff --git a/index.html b/index.html index 3e6968f..5a26256 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Pera Wallet Example dApp
\ No newline at end of file +Pera Wallet Example dApp
\ No newline at end of file diff --git a/static/js/main.126ededd.chunk.js b/static/js/main.126ededd.chunk.js deleted file mode 100644 index 70fd298..0000000 --- a/static/js/main.126ededd.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -(this["webpackJsonppera-demo-dapp"]=this["webpackJsonppera-demo-dapp"]||[]).push([[0],{11:function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"c",(function(){return i})),n.d(t,"b",(function(){return m}));var a,r=n(0),s=n(7),o=n(6);!function(e){e.MainNet="mainnet",e.TestNet="testnet"}(a||(a={}));var c=new o.default.Algodv2("","https://mainnet-api.algonode.cloud",""),u=new o.default.Algodv2("","https://testnet-api.algonode.cloud","");function i(e){switch(e){case a.MainNet:return c;case a.TestNet:return u;default:throw new Error("Unknown chain type: ".concat(e))}}function m(e){return d.apply(this,arguments)}function d(){return(d=Object(s.a)(Object(r.a)().mark((function e(t){var n;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i(t).getTransactionParams().do();case 2:return n=e.sent,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},121:function(e,t,n){"use strict";(function(e){var a=n(0),r=n(7),s=n(17),o=n(12),c=n(10),u=n(6),i=n(49),m=n(11),d=n(124),f=n(123),l=n(8);t.a=function(t){var n=t.accountAddress,p=t.peraWallet,b=t.handleSetLog,g=t.chain,x=t.refecthAccountDetail,j=Object(o.useState)(!1),O=Object(s.a)(j,2),h=O[0],v=O[1],y=Object(f.a)(),T=y.isModalOpen,P=y.openModal,w=y.closeModal;return Object(l.jsxs)(l.Fragment,{children:[Object(l.jsx)(c.Button,{customClassName:"app__button--connect",onClick:P,children:"Create Transaction"}),Object(l.jsx)(d.a,{chain:g,peraWallet:p,address:n,isOpen:T,onClose:w}),Object(l.jsxs)("div",{style:{marginTop:"45px"},children:[Object(l.jsx)("h3",{children:"Mainnet only, do not sign!"}),g===m.a.TestNet&&Object(l.jsx)("small",{children:"Switch to MainNet to see txns"}),Object(l.jsx)(c.List,{items:i.b,customClassName:"app__actions",children:function(e){return Object(l.jsx)(c.ListItem,{children:Object(l.jsx)(c.Button,{customClassName:"app__button",onClick:function(){return I(e.scenario,e.name)},shouldDisplaySpinner:h,isDisabled:h,children:h?"Loading...":e.name})})}})]}),Object(l.jsxs)("div",{style:{marginTop:"45px"},children:[Object(l.jsx)("h3",{children:"Both Networks"}),Object(l.jsx)(c.List,{items:i.c,customClassName:"app__actions",children:function(e){return Object(l.jsx)(c.ListItem,{children:Object(l.jsx)(c.Button,{customClassName:"app__button",onClick:function(){return I(e.scenario,e.name)},shouldDisplaySpinner:h,isDisabled:h,children:h?"Loading...":e.name})})}}),Object(l.jsxs)("div",{style:{display:"flex",gap:"20px"},children:[Object(l.jsx)(c.Button,{customClassName:"app__button",style:{width:"160px"},onClick:function(){return A.apply(this,arguments)},shouldDisplaySpinner:h,isDisabled:h,children:h?"Loading...":"Sign Single Arbitrary Data"}),Object(l.jsx)(c.Button,{customClassName:"app__button",style:{width:"160px"},onClick:function(){return k.apply(this,arguments)},shouldDisplaySpinner:h,isDisabled:h,children:h?"Loading...":"Sign Multiple Arbitrary Data"})]})]})]});function A(){return(A=Object(r.a)(Object(a.a)().mark((function t(){var n;return Object(a.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=[{data:new Uint8Array(e.from("timestamp//".concat(Date.now()))),message:"Timestamp confirmation"}],t.next=3,F(n);case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function k(){return(k=Object(r.a)(Object(a.a)().mark((function t(){var n;return Object(a.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=[{data:new Uint8Array(e.from("timestamp//".concat(Date.now()))),message:"Timestamp confirmation"},{data:new Uint8Array(e.from("agent//".concat(navigator.userAgent))),message:"User agent confirmation"}],t.next=3,F(n);case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function F(e){return S.apply(this,arguments)}function S(){return(S=Object(r.a)(Object(a.a)().mark((function e(t){var r;return Object(a.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,p.signData(t,n);case 3:r=e.sent,t.forEach((function(e,t){var a=u.default.verifyBytes(e.data,r[t],n);console.log({data:e,signedData:r[t],isVerified:a}),a||b("Arbitrary data did not match with signed data!")})),console.log({signedData:r}),b("Data signed successfully"),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(0),console.log(e.t0),b("".concat(e.t0));case 13:case"end":return e.stop()}}),e,null,[[0,9]])})))).apply(this,arguments)}function I(e,t){return U.apply(this,arguments)}function U(){return(U=Object(r.a)(Object(a.a)().mark((function e(t,s){var o,c,u,i,d,f;return Object(a.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return v(!0),e.prev=1,e.next=4,t(g,n);case 4:return o=e.sent,c=o.transaction,u=o.transactionTimeout,i=c.reduce((function(e,t){return e.concat(t)}),[]),e.next=10,p.signTransaction([i]);case 10:if(d=e.sent,console.log({transactions:i,signedTransactions:d}),b("Transaction signed successfully: ".concat(s)),!u){e.next=17;break}setTimeout(Object(r.a)(Object(a.a)().mark((function e(){return Object(a.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(m.c)(g).sendRawTransaction(d).do();case 2:b("Transaction sended network: ".concat(s));case 3:case"end":return e.stop()}}),e)}))),u),e.next=25;break;case 17:f=0;case 18:if(!(f=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function p(e,t){var n=e.title,r=e.titleId,s=l(e,d);return m.createElement("svg",f({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:t,"aria-labelledby":r},s),n?m.createElement("title",{id:r},n):null,a||(a=m.createElement("path",{d:"M20 4L4 20M20 20L4 4",stroke:"#0A0A0A",strokeWidth:1.5})))}var b=m.forwardRef(p),g=(n.p,n(178),n(6)),x=n(10),j=n(41),O=(n(179),n(61)),h=n.n(O),v=n(18),y=n.n(v),T=n(8),P=["customClassName","children","closeTimeoutMS","shouldCloseOnOverlayClick","shouldCloseOnEsc","bodyOpenClassName","onClose","shouldPreventScrollOnOverlay","isOpen"],w=2e3*parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--modal-transition-duration").trim()||"0.2");function A(){return document.querySelector("#modal-root")}h.a.defaultStyles={},h.a.setAppElement("#root");var k=function(e){var t=e.customClassName,n=e.children,a=e.closeTimeoutMS,r=void 0===a?w:a,s=e.shouldCloseOnOverlayClick,o=void 0===s||s,c=e.shouldCloseOnEsc,i=void 0!==c&&c,d=e.bodyOpenClassName,f=e.onClose,l=e.shouldPreventScrollOnOverlay,p=void 0===l||l,b=e.isOpen,g=Object(j.a)(e,P);return Object(m.useEffect)((function(){return p&&b&&(document.body.style.overflow="hidden"),function(){p&&(document.body.style.overflow="unset")}}),[b,p]),Object(T.jsx)("div",{style:{position:"absolute"},onClick:function(e){return e.stopPropagation()},children:Object(T.jsx)(h.a,Object(u.a)(Object(u.a)({parentSelector:A,isOpen:b,className:y()("modal",t),onRequestClose:function(e){f&&(o||i)&&f(e)},closeTimeoutMS:r,bodyOpenClassName:y()("ReactModal__Body--open",d),shouldCloseOnOverlayClick:o,shouldCloseOnEsc:i},g),{},{children:n}))})},F=n(11),S=n(122);var I=[{id:"pay",title:"pay"},{id:"axfer",title:"axfer"},{id:"keyreg",title:"keyreg"},{id:"acfg",title:"acfg"}],U=[{id:"create",content:"Create"},{id:"modify",content:"Modify"},{id:"destroy",content:"Destroy"}];t.a=function(e){var t=e.chain,n=e.address,a=e.isOpen,d=e.onClose,f=e.peraWallet,l=Object(m.useState)([]),p=Object(i.a)(l,2),j=p[0],O=p[1],h=Object(m.useState)({id:"pay",title:"pay"}),v=Object(i.a)(h,2),y=v[0],P=v[1],w=Object(m.useState)({address:n,toAddress:"",amount:"",note:"",assetIndex:"",rekeyTo:"",closeTo:"",transactionAmount:1,assetTxnType:"create"}),A=Object(i.a)(w,2),C=A[0],W=A[1],N=Object(m.useState)(!1),D=Object(i.a)(N,2),M=D[0],_=D[1];return Object(T.jsxs)(k,{customClassName:"create-txn",contentLabel:"Create Txn Modal",isOpen:a,onClose:d,children:[Object(T.jsx)(b,{onClick:d,className:"modal__close",width:24,height:24}),Object(T.jsx)("h3",{style:{marginBottom:"10px"},children:"Create Transaction"}),Object(T.jsx)(x.FormField,{label:"Transaction Type",children:Object(T.jsx)(x.Dropdown,{customClassName:"app__header__chain-select-dropdown",role:"menu",options:I,selectedOption:y,onSelect:function(e){P(e)},hasDeselectOption:!1})}),Object(T.jsx)(x.FormField,{label:"From Address",children:Object(T.jsx)(x.Input,{value:n,name:"from",isDisabled:!0,onChange:function(){return console.log("a")}})}),function(){switch(null===y||void 0===y?void 0:y.id){case"pay":return Object(T.jsxs)(T.Fragment,{children:[Object(T.jsx)(x.FormField,{label:"To Address",children:Object(T.jsx)(x.Input,{value:C.toAddress,name:"to",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{toAddress:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Amount (on microAlgos)",children:Object(T.jsx)(x.Input,{value:C.amount,name:"amount",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{amount:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Rekey To",children:Object(T.jsx)(x.Input,{value:C.rekeyTo,name:"rekeyto",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{rekeyTo:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Close To",children:Object(T.jsx)(x.Input,{value:C.closeTo,name:"closeTo",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{closeTo:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Note",children:Object(T.jsx)(x.Textarea,{value:C.note,name:"note",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{note:e.currentTarget.value}))}})})]});case"axfer":return Object(T.jsxs)(T.Fragment,{children:[Object(T.jsx)(x.FormField,{label:"To Address",children:Object(T.jsx)(x.Input,{value:C.toAddress,name:"to",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{toAddress:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Asset Index",children:Object(T.jsx)(x.Input,{value:C.assetIndex,name:"assetIndex",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{assetIndex:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Amount (on microAlgos)",children:Object(T.jsx)(x.Input,{value:C.amount,name:"amount",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{amount:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Rekey To",children:Object(T.jsx)(x.Input,{value:C.rekeyTo,name:"rekeyto",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{rekeyTo:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Close To",children:Object(T.jsx)(x.Input,{value:C.closeTo,name:"closeTo",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{closeTo:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Note",children:Object(T.jsx)(x.Textarea,{value:C.note,name:"note",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{note:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Transaction Amount (optional)",children:Object(T.jsx)(x.Input,{value:C.transactionAmount,name:"transactionAmount",type:"number",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{transactionAmount:Number(e.currentTarget.value)}))}})})]});case"keyreg":return Object(T.jsxs)(T.Fragment,{children:[Object(T.jsx)(x.FormField,{label:"".concat(C.isOnlineKeyregTxn?"Online":"Offline"," Keyreg Transaction"),children:Object(T.jsx)(x.Switch,{isToggledOn:C.isOnlineKeyregTxn||!1,onToggle:function(){return W(Object(u.a)(Object(u.a)({},C),{},{isOnlineKeyregTxn:!C.isOnlineKeyregTxn}))}})}),Object(T.jsx)(x.FormField,{label:"Rekey To (optional)",children:Object(T.jsx)(x.Input,{value:C.rekeyTo,name:"rekeyto",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{rekeyTo:e.currentTarget.value}))}})}),C.isOnlineKeyregTxn&&Object(T.jsxs)(T.Fragment,{children:[Object(T.jsx)(x.FormField,{label:"Vote Key",children:Object(T.jsx)(x.Input,{value:C.voteKey,name:"voteKey",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{voteKey:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Selection Key",children:Object(T.jsx)(x.Input,{value:C.selectionKey,name:"selectionKey",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{selectionKey:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"State Proof Key",children:Object(T.jsx)(x.Input,{value:C.stateProofKey,name:"stateProofKey",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{stateProofKey:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Vote First",children:Object(T.jsx)(x.Input,{value:C.voteFirst,name:"voteFirst",type:"number",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{voteFirst:Number(e.currentTarget.value)}))}})}),Object(T.jsx)(x.FormField,{label:"Vote Last",children:Object(T.jsx)(x.Input,{value:C.voteLast,name:"voteLast",type:"number",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{voteLast:Number(e.currentTarget.value)}))}})}),Object(T.jsx)(x.FormField,{label:"Vote Key Dilution",children:Object(T.jsx)(x.Input,{value:C.voteKeyDilution,name:"voteKeyDilution",type:"number",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{voteKeyDilution:Number(e.currentTarget.value)}))}})})]})]});case"acfg":return Object(T.jsx)(T.Fragment,{children:Object(T.jsx)(x.Tab,{items:U,initialActiveTabIndex:0,customClassName:"create-txn__asset-tab",onTabChange:E,children:R()})});default:return null}}(),Object(T.jsx)(x.FormField,{label:"Send Blockchain",children:Object(T.jsx)(x.Switch,{onToggle:function(){_(!M)},isToggledOn:M})}),j.length>0&&Object(T.jsx)(x.List,{items:j,children:function(e,t,n){return Object(T.jsx)(x.ListItem,{children:"Txn ".concat((n||0)+1," type: ").concat(e.txn.type)})}}),Object(T.jsx)(S.a,{txnForm:C,type:y.id,chain:t,onResetForm:function(){W(Object(u.a)(Object(u.a)({},C),{},{toAddress:"",amount:"",note:"",assetIndex:"",rekeyTo:"",closeTo:"",transactionAmount:1}))},onSetTransactions:function(e){O([].concat(Object(c.a)(j),Object(c.a)(e)))}}),Object(T.jsx)(x.Button,{onClick:function(){try{var e,t=function(e,t){for(var n=[],a=e.length/t,r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=t.locale,a=void 0===n?O:n,r=Object(g.a)(t,j),s=r,o="currency"===s.style,c="shorten-large-numbers"===s.style;s=o?Object(b.a)({currency:"USD",maximumFractionDigits:5,minimumFractionDigits:2,currencyDisplay:"narrowSymbol"},r):c?Object(b.a)({maximumFractionDigits:2,minimumFractionDigits:0,style:"decimal"},Object(x.b)(r,"style")):Object(b.a)({maximumFractionDigits:5,minimumFractionDigits:2,style:"decimal"},r);try{e=new Intl.NumberFormat(a||[navigator.language,"en-GB"],s)}catch(u){if(e={format:function(e){return e.toLocaleString()}},o)try{s.currencyDisplay="symbol",e=new Intl.NumberFormat(a||[navigator.language,"en-GB"],s)}catch(i){console.error({currencyFormattingError:i})}}return function(t){var n="";return Object.is(t,NaN)||(n=c?t>=Math.pow(10,9)?"".concat(e.format(t/Math.pow(10,9)),"b"):t>=Math.pow(10,6)?"".concat(e.format(t/Math.pow(10,6)),"m"):t>=Math.pow(10,3)?"".concat(e.format(t/Math.pow(10,3)),"k"):e.format(t):e.format(t)),n&&"USD"===s.currency&&(n=n.replace("US$","$")),n}}({minimumFractionDigits:2})(Object(l.microalgosToAlgos)(Number(e.amount)))," ALGO")}var v="PeraWallet.Wallet",y="CompactMode";function T(){var e,t=null===(e="undefined"===typeof localStorage?void 0:localStorage)||void 0===e?void 0:e.getItem(v);return t?JSON.parse(t):null}var P=n(8);var w=function(e){var t,n=e.accountInformation,a=e.chain,r=T();return Object(P.jsxs)("div",{children:[Object(P.jsxs)("div",{className:"app__account-address",children:[Object(P.jsx)("b",{className:"app__text-purple",children:"Connected to: "}),(t=n.address,"".concat(t.substring(0,8),"...").concat(t.substring(t.length-4)))]}),Object(P.jsxs)("div",{className:"app__account-address",children:[Object(P.jsx)("b",{className:"app__text-purple",children:"Chain: "}),a.toUpperCase()]}),Object(P.jsxs)("div",{className:"app__account-address",children:[Object(P.jsx)("b",{className:"app__text-purple",children:"Wallet Type: "}),null===r||void 0===r?void 0:r.type]}),n&&Object(P.jsxs)("div",{className:"app__account-address",children:[Object(P.jsx)("b",{className:"app__text-purple",children:"Balance: "}),h(n)]})]})},A=n(121),k=(n(191),n(18)),F=n.n(k);var S=function(e){var t=e.message,n=e.customClassName;return Object(P.jsx)("div",{className:F()("pera-toast",n),children:Object(P.jsx)("div",{children:t})})},I=n(60);var U=function(e){var t=e.chain,n=e.accountAddress,r=Object(I.a)(),s=r.state,o=r.runAsyncProcess,u=Object(c.useToaster)().display,i=Object(a.useCallback)((function(){if(t&&n)try{o(function(e,t){return new Promise((function(n,a){try{n(Object(p.c)(e).accountInformation(t).do())}catch(r){a(r)}}))}(t,n))}catch(e){u({render:function(){return Object(P.jsx)(S,{message:e})}})}}),[n,t,u,o]);return Object(a.useEffect)((function(){i()}),[i]),{accountInformationState:s,refetchAccountDetail:i}},C=n(49),W=n(50),N=localStorage.getItem(y),D=new d.PeraWalletConnect({compactMode:"true"===N}),M=new f.a({optInEnabled:!0});var _=function(){var e=Object(a.useState)(p.a.TestNet),t=Object(m.a)(e,2),n=t[0],r=t[1],s=Object(a.useState)({id:"testnet",title:"TestNet"}),o=Object(m.a)(s,2),f=o[0],l=o[1],b=Object(a.useState)(null),g=Object(m.a)(b,2),x=g[0],j=g[1],O=!!x,h=Object(c.useToaster)().display,v=U({chain:n,accountAddress:x||""}),T=v.accountInformationState,k=v.refetchAccountDetail,F=Object(a.useState)(D.compactMode||!1),I=Object(m.a)(F,2),N=I[0],_=I[1];return Object(a.useEffect)((function(){D=new d.PeraWalletConnect({compactMode:N})}),[N]),Object(a.useEffect)((function(){D.reconnectSession().then((function(e){var t;e&&(j(e[0]),L("Connected to Pera Wallet")),null===(t=D.connector)||void 0===t||t.on("disconnect",(function(){j(null)}))})).catch((function(e){return console.log(e)}))}),[]),Object(P.jsxs)("div",{className:"app ".concat(O?"app--connected":""),children:[Object(P.jsx)("div",{className:"app__header",children:Object(P.jsx)(c.Dropdown,{customClassName:"app__header__chain-select-dropdown",role:"menu",options:[{id:"testnet",title:"TestNet"},{id:"mainnet",title:"MainNet"}],selectedOption:f,onSelect:function(e){!function(e){"testnet"===(null===e||void 0===e?void 0:e.id)?(r(p.a.TestNet),l({id:"testnet",title:"TestNet"}),W.a.updateFetcher(p.a.TestNet)):"mainnet"===(null===e||void 0===e?void 0:e.id)&&(r(p.a.MainNet),l({id:"mainnet",title:"MainNet"}),W.a.updateFetcher(p.a.MainNet))}(e)},hasDeselectOption:!1})}),n===p.a.MainNet&&Object(P.jsx)("div",{className:"app__chain-message",children:"You are using MainNet right now. Please be careful when you trying to send transactions."}),Object(P.jsxs)("h1",{className:"app__title",children:["Pera Wallet"," ",Object(P.jsx)("small",{children:"Example dApp"})]}),!O&&Object(P.jsxs)("div",{className:"app__compact-mode-switch",children:[Object(P.jsx)("p",{children:"Pera Connect Compact Mode: "}),Object(P.jsx)(c.Switch,{onToggle:function(){_(!N),localStorage.setItem(y,"true"===localStorage.getItem(y)?"false":"true")},isToggledOn:N})]}),T.data&&Object(P.jsx)(w,{accountInformation:T.data,chain:n}),O&&"mainnet"===n&&Object(P.jsx)(c.Button,{customClassName:"app__button--connect",onClick:function(){x&&(E(),M.on({OPT_IN_REQUEST:function(){var e=Object(i.a)(Object(u.a)().mark((function e(t){var a,r,s,o,c,i;return Object(u.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.accountAddress,r=t.assetID,e.prev=1,e.next=4,Object(C.a)(n,a,Number(r));case 4:return s=e.sent,o=s.transaction,c=o.reduce((function(e,t){return e.concat(t)}),[]),e.next=9,D.signTransaction([c]);case 9:return i=e.sent,e.next=12,Object(p.c)(n).sendRawTransaction(i).do();case 12:M.close(),E(),e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),L("".concat(e.t0));case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),ADD_FUNDS_COMPLETED:function(){L("Add funds completed")},ADD_FUNDS_FAILED:function(){L("Add funds failed")}}))},children:"Add funds"}),Object(P.jsx)(c.Button,{customClassName:"app__button--connect",onClick:O?function(){D.disconnect(),j(null)}:function(){return R.apply(this,arguments)},children:O?"Disconnect":"Connect to Pera Wallet"}),O&&Object(P.jsx)(A.a,{accountAddress:x,peraWallet:D,handleSetLog:L,chain:n,refecthAccountDetail:k})]});function E(){x&&M.addFunds({accountAddress:x}).then((function(){L("Funds added")})).catch((function(e){L("".concat(e))}))}function R(){return(R=Object(i.a)(Object(u.a)().mark((function e(){var t;return Object(u.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,D.connect();case 3:t=e.sent,L("Connected to Pera Wallet"),j(t[0]),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),console.log(e.t0),L("".concat(e.t0));case 12:case"end":return e.stop()}}),e,null,[[0,8]])})))).apply(this,arguments)}function L(e){h({timeout:1e4,render:function(){return Object(P.jsx)(S,{message:e})}})}},E={debounceTime:150};var R=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:E,n=Object(a.useRef)(void 0),r=Object(a.useRef)(e);Object(a.useEffect)((function(){r.current=e}),[e]),Object(a.useEffect)((function(){return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e),clearTimeout(n.current)};function e(){n.current||(n.current=setTimeout((function(){r.current(),n.current=void 0}),t.debounceTime))}}),[t.debounceTime])};var L=function(){function e(){document.documentElement.style.setProperty("--vh","".concat(.01*window.innerHeight,"px"))}Object(a.useEffect)((function(){e()}),[]),R((function(){e()}))};var G=function(){return L(),Object(P.jsx)(_,{})},K=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,193)).then((function(t){var n=t.getCLS,a=t.getFID,r=t.getFCP,s=t.getLCP,o=t.getTTFB;n(e),a(e),r(e),s(e),o(e)}))};o.a.render(Object(P.jsx)(r.a.StrictMode,{children:Object(P.jsx)(c.ToastContextProvider,{children:Object(P.jsx)(G,{})})}),document.getElementById("root")),K()},49:function(e,t,n){"use strict";(function(e){n.d(t,"b",(function(){return ke})),n.d(t,"c",(function(){return Fe})),n.d(t,"a",(function(){return d}));var a,r=n(0),s=n(7),o=(n(15),n(6)),c=n(11),u=[o.default.mnemonicToSecretKey("cannon scatter chest item way pulp seminar diesel width tooth enforce fire rug mushroom tube sustain glide apple radar chronic ask plastic brown ability badge"),o.default.mnemonicToSecretKey("person congress dragon morning road sweet horror famous bomb engine eager silent home slam civil type melt field dry daring wheel monitor custom above term"),o.default.mnemonicToSecretKey("faint protect home drink journey humble tube clinic game rough conduct sell violin discover limit lottery anger baby leaf mountain peasant rude scene abstract casual")];function i(e,t){return e===c.a.MainNet?t===a.Transfer?604:t===a.Close?672:312769:t===a.Transfer?11711:t===a.Close?180132:135270}function m(e){if(e===c.a.MainNet)return 305162725;if(e===c.a.TestNet)return 22314999;throw new Error("App not defined for chain ".concat(e))}!function(e){e.Transfer="asset-transfer",e.OptIn="asset-opt-in",e.Close="asset-close"}(a||(a={}));var d=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a,s){var u,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return u=t.sent,i=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,amount:0,assetIndex:s,note:new Uint8Array(e.from("example note value")),suggestedParams:u}),m=[{txn:i}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n,a){return t.apply(this,arguments)}}(),f=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message"}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),l=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:s}),m=[{txn:i}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),p=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),rekeyTo:u[2].addr,suggestedParams:s}),m=[{txn:i}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),b=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),rekeyTo:u[2].addr,closeRemainderTo:u[1].addr,suggestedParams:s}),m=[{txn:i}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),g=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message",authAddr:"INVALID_ADDRESS"}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),x=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var u,m,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return u=t.sent,m=i(n,a.OptIn),d=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:m,note:new Uint8Array(e.from("example note value")),suggestedParams:u}),f=[{txn:d}],t.abrupt("return",{transaction:[f]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),j=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,100,u=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,amount:0,assetIndex:100,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),i=[{txn:u}],t.abrupt("return",{transaction:[i]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),O=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:1e6,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),l=[{txn:f}],t.abrupt("return",{transaction:[l]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),h=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:1e6,assetIndex:d,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:m}),l=[{txn:f,message:"This is a transaction message"}],t.abrupt("return",{transaction:[l]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),v=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,100,i=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e6,assetIndex:100,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i}],t.abrupt("return",{transaction:[m]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),y=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationOptInTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),T=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n){var a,s,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return a=t.sent,s=m(n),i=o.default.makeApplicationOptInTxnFromObject({from:u[1].addr,appIndex:s,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],rekeyTo:u[2].addr,suggestedParams:a}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),P=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),w=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[],suggestedParams:s}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),A=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=m(n),d=o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:i,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],rekeyTo:u[2].addr,suggestedParams:s}),f=[{txn:d}],t.abrupt("return",{transaction:[f]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),k=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationCloseOutTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:i,message:"This is a transaction message"}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),F=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationClearStateTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),S=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,m,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=Uint8Array.from([4,129,1,67]),i=Uint8Array.from([3,129,1,67]),m=o.default.makeApplicationCreateTxnFromObject({from:a,approvalProgram:u,clearProgram:i,numGlobalInts:1,numGlobalByteSlices:2,numLocalInts:3,numLocalByteSlices:4,onComplete:o.default.OnApplicationComplete.NoOpOC,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:m}],t.abrupt("return",{transaction:[d]});case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),I=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,m,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=Uint8Array.from([4,129,1,67]),i=Uint8Array.from([3,129,1,67]),m=o.default.makeApplicationCreateTxnFromObject({from:a,approvalProgram:u,clearProgram:i,numGlobalInts:1,numGlobalByteSlices:2,numLocalInts:3,numLocalByteSlices:4,extraPages:1,onComplete:o.default.OnApplicationComplete.NoOpOC,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:m}],t.abrupt("return",{transaction:[d]});case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),U=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d,f,l;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=Uint8Array.from([4,129,1,67]),i=Uint8Array.from([3,129,1,67]),d=m(n),f=o.default.makeApplicationUpdateTxnFromObject({from:a,appIndex:d,approvalProgram:u,clearProgram:i,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),l=[{txn:f}],t.abrupt("return",{transaction:[l]});case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),C=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationDeleteTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),W=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=i(n,a.OptIn),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:1e6,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=[{txn:l},{txn:p,signers:[]}],o.default.assignGroupID(b.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[b]});case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),N=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=i(n,a.OptIn),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:1e6,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:5e5,note:new Uint8Array(e.from("this is a payment txn")),suggestedParams:m}),g=[{txn:l},{txn:p,signers:[]},{txn:b,message:"This is a transaction message"}],o.default.assignGroupID(g.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[g]});case 11:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),D=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=i(n,a.OptIn),l=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:5e5,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:1e6,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=[{txn:l},{txn:p},{txn:b}],o.default.assignGroupID(g.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[g]});case 11:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),M=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:5e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:5e5,note:new Uint8Array(e.from("example note value")),rekeyTo:u[2].addr,suggestedParams:s}),d=[{txn:i},{txn:m,message:"This is a transaction message"}],o.default.assignGroupID(d.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[d]});case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),_=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=i(n,a.Close),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:50,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:50,assetIndex:f,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:m}),b=[{txn:l},{txn:p}],o.default.assignGroupID(b.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[b]});case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),E=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:50,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:50,assetIndex:d,note:new Uint8Array(e.from("example note value")),rekeyTo:u[2].addr,suggestedParams:m}),p=[{txn:f,message:"This is a transaction message"},{txn:l}],o.default.assignGroupID(p.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[p]});case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),R=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Close),f=i(n,a.Transfer),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,assetIndex:f,amount:10,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:20,assetIndex:d,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:30,assetIndex:f,note:new Uint8Array(e.from("example note value")),rekeyTo:u[2].addr,suggestedParams:m}),g=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:40,assetIndex:f,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,rekeyTo:u[2].addr,suggestedParams:m}),x=[{txn:l,message:"This is a transaction message"},{txn:p},{txn:b},{txn:g,message:"This is a transaction message"}],o.default.assignGroupID(x.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[x]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),L=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j,O,h,v;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=i(n,a.OptIn),l=i(n,a.Close),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:50,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:50,assetIndex:l,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:m}),x=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:5e5,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),j=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:0,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:m}),O=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:1e3,note:new Uint8Array(e.from("example note value")),rekeyTo:u[2].addr,suggestedParams:m}),h=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:5e4,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,rekeyTo:u[2].addr,suggestedParams:m}),v=[{txn:p},{txn:b},{txn:g},{txn:x},{txn:j},{txn:O},{txn:h}],o.default.assignGroupID(v.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[v]});case 16:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),G=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:for(m=t.sent,d=[],f=0;f<8;f++)l=i(n,a.Transfer),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:l,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:l,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:m}),d.push({txn:p}),d.push({txn:b});return o.default.assignGroupID(d.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),K=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100003,note:new Uint8Array(e.from("txn 3")),suggestedParams:s}),f=[{txn:i}],l=[{txn:m,message:"This is a transaction message"}],p=[{txn:d}],t.abrupt("return",{transaction:[f,l,p]});case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),B=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.OptIn),f=i(n,a.Transfer),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:1e4,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:3e4,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=[{txn:l}],x=[{txn:p}],j=[{txn:b,message:"This is a transaction message"}],t.abrupt("return",{transaction:[g,x,j]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),V=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.OptIn),f=i(n,a.Transfer),l=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("txn 1")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:1e4,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=[{txn:l}],x=[{txn:p}],j=[{txn:b}],t.abrupt("return",{transaction:[g,x,j]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),X=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p,b;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("atomic group 2 txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100003,note:new Uint8Array(e.from("txn 3")),suggestedParams:s}),f=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100004,note:new Uint8Array(e.from("txn 4")),suggestedParams:s}),l=[{txn:i,message:"This is a transaction message"},{txn:m,message:"This is a transaction message"}],o.default.assignGroupID(l.map((function(e){return e.txn}))),p=[{txn:d}],b=[{txn:f}],t.abrupt("return",{transaction:[l,p,b]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Q=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j,O;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.OptIn),f=i(n,a.Transfer),l=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:1e4,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100004,note:new Uint8Array(e.from("txn 4")),suggestedParams:m}),x=[{txn:l},{txn:p}],o.default.assignGroupID(x.map((function(e){return e.txn}))),j=[{txn:b,message:"This is a transaction message"}],O=[{txn:g}],t.abrupt("return",{transaction:[x,j,O]});case 14:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),H=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("atomic group 1 txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100003,note:new Uint8Array(e.from("atomic group 2 txn 1")),suggestedParams:s}),f=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100004,note:new Uint8Array(e.from("atomic group 2 txn 2")),suggestedParams:s}),l=[{txn:i},{txn:m}],o.default.assignGroupID(l.map((function(e){return e.txn}))),p=[{txn:d},{txn:f}],o.default.assignGroupID(p.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[l,p]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),z=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.OptIn),f=i(n,a.Transfer),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:1e4,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:2e3,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),x=[{txn:l},{txn:p,signers:[]}],o.default.assignGroupID(x.map((function(e){return e.txn}))),j=[{txn:b},{txn:g,signers:[]}],o.default.assignGroupID(j.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[x,j]});case 14:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),J=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,100,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:s}),m=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:2e3,assetIndex:100,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100003,note:new Uint8Array(e.from("atomic group 2 txn 1")),suggestedParams:s}),f=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100004,note:new Uint8Array(e.from("atomic group 2 txn 2")),suggestedParams:s}),l=[{txn:i},{txn:m}],o.default.assignGroupID(l.map((function(e){return e.txn}))),p=[{txn:d},{txn:f}],o.default.assignGroupID(p.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[l,p]});case 13:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Y=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.OptIn),f=i(n,a.Transfer),l=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:1e4,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100004,note:new Uint8Array(e.from("atomic group 2 txn 2")),suggestedParams:m}),x=[{txn:l},{txn:p,signers:[]}],o.default.assignGroupID(x.map((function(e){return e.txn}))),j=[{txn:b},{txn:g}],o.default.assignGroupID(j.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[x,j]});case 14:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Z=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.OptIn),f=i(n,a.Transfer),l=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:m}),p=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("atomic group 1 txn 2")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:2e3,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),x=[{txn:l},{txn:p}],o.default.assignGroupID(x.map((function(e){return e.txn}))),j=[{txn:b,signers:[]},{txn:g}],o.default.assignGroupID(j.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[x,j]});case 14:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),q=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("atomic group 2 txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100003,note:new Uint8Array(e.from("txn 3")),suggestedParams:s}),f=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100004,note:new Uint8Array(e.from("txn 4")),suggestedParams:s}),l=[{txn:i,signers:[]},{txn:m}],o.default.assignGroupID(l.map((function(e){return e.txn}))),p=[{txn:d,signers:[]},{txn:f}],o.default.assignGroupID(p.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[l,p]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),$=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("atomic group 2 txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100003,note:new Uint8Array(e.from("txn 3")),suggestedParams:s}),f=[{txn:i,signers:[]},{txn:m}],o.default.assignGroupID(f.map((function(e){return e.txn}))),l=[{txn:d}],t.abrupt("return",{transaction:[f,l]});case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ee=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100001,note:new Uint8Array(e.from("txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100002,note:new Uint8Array(e.from("txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100003,note:new Uint8Array(e.from("txn 3")),suggestedParams:s}),f=[{txn:i,signers:[]},{txn:m,signers:[]},{txn:d,signers:[]}],o.default.assignGroupID(f.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[f]});case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),te=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100003,note:new Uint8Array(e.from("txn 3")),suggestedParams:s}),f=[{txn:i}],l=[{txn:m,message:"This is a transaction message"}],p=[{txn:d,signers:[]}],t.abrupt("return",{transaction:[f,l,p]});case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ne=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("max length note (512)"+"!".repeat(491))),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message"}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ae=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:a,decimals:2,defaultFrozen:!1,total:BigInt("0xffffffffffffffff"),assetName:"Example asset",unitName:"EX",assetURL:"https://example.com",assetMetadataHash:new Uint8Array(e.from("59fc007607ccc82d96f016857aaa697c545002d18045e49324696f12b7be8f45","hex")),manager:a,reserve:u[0].addr,clawback:u[1].addr,freeze:u[2].addr,note:new Uint8Array(e.from("example note value")),rekeyTo:u[1].addr,suggestedParams:s}),m=[{txn:i,message:"This is a transaction message"}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),re=function(){var e=Object(s.a)(Object(r.a)().mark((function e(t,n){var a,s,u;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(c.b)(t);case 2:return a=e.sent,s=o.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:n,decimals:0,defaultFrozen:!1,total:1,suggestedParams:a}),u=[{txn:s,message:"This is a transaction message"}],e.abrupt("return",{transaction:[u]});case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),se=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=o.default.makeAssetConfigTxnWithSuggestedParamsFromObject({from:s,assetIndex:i(n,a.Transfer),clawback:s,freeze:u[0].addr,manager:u[1].addr,reserve:u[2].addr,strictEmptyAddressChecking:!0,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),f=[{txn:d,message:"This is a transaction message"}],t.abrupt("return",{transaction:[f]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),oe=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var u,m,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return u=t.sent,m=o.default.makeAssetConfigTxnWithSuggestedParamsFromObject({from:s,assetIndex:i(n,a.Transfer),strictEmptyAddressChecking:!1,note:new Uint8Array(e.from("example note value")),suggestedParams:u}),d=[{txn:m,message:"This is a transaction message"}],t.abrupt("return",{transaction:[d]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ce=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var u,m,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return u=t.sent,m=o.default.makeAssetDestroyTxnWithSuggestedParamsFromObject({from:s,assetIndex:i(n,a.Transfer),note:new Uint8Array(e.from("example note value")),suggestedParams:u}),d=[{txn:m,message:"This is a transaction message"}],t.abrupt("return",{transaction:[d]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ue=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100001,note:new Uint8Array(e.from("txn with 0 fee")),suggestedParams:s}),(m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("txn with double fee")),suggestedParams:s})).fee+=i.fee,i.fee=0,d=[{txn:i,signers:[]},{txn:m}],o.default.assignGroupID(d.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[d]});case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ie=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:for(s=t.sent,i=[],4,m=0;m<4;m++){for(d=[],f=0;f<16;f++)d.push({txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:0,note:new Uint8Array(e.from("No ".concat(16*m+f+1," of 64"))),suggestedParams:s})});o.default.assignGroupID(d.map((function(e){return e.txn}))),i.push(d)}return t.abrupt("return",{transaction:i});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),me=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:for(s=t.sent,i=[],4,m=0;m<4;m++){for(d=[],f=0;f<16;f++)d.push({txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:0,note:new Uint8Array(e.from("No ".concat(16*m+f+1," of 65"))),suggestedParams:s})});o.default.assignGroupID(d.map((function(e){return e.txn}))),i.push(d)}return i.push([{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:0,note:new Uint8Array(e.from("No 65 of 65")),suggestedParams:s})}]),t.abrupt("return",{transaction:i});case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),de=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:for(s=t.sent,i=[],32,m=0;m<32;m++){for(d=[],f=0;f<16;f++)d.push({txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:0,note:new Uint8Array(e.from("No ".concat(16*m+f+1," of 64"))),suggestedParams:s})});o.default.assignGroupID(d.map((function(e){return e.txn}))),i.push(d)}return t.abrupt("return",{transaction:i});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),fe=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p,b,g,x,j;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=prompt("Please enter minutes for future transaction: "),m=(new Date).getTime(),d=m+6e4*Number(i),f=Math.round((d-m)/1e3),l=Math.abs(Math.round(f/4)),p=s.firstRound+l,b=p+1e3,g={fee:s.fee,firstRound:p,lastRound:b,genesisHash:s.genesisHash,genesisID:s.genesisID},x=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("Example future transaction")),suggestedParams:g}),j=[{txn:x,message:"This is a transaction message"}],t.abrupt("return",{transaction:[j],transactionTimeout:1e3*f});case 14:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),le=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e6,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e6,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e6,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),f=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e6,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),l=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:1e6,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),p=[{txn:i},{txn:m},{txn:d},{txn:f},{txn:l}],o.default.assignGroupID(p.map((function(e){return e.txn}))),p.pop(),t.abrupt("return",{transaction:[p]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),pe=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[],suggestedParams:s,boxes:[{appIndex:u,name:Uint8Array.from([0])}]}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),be=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message",authAddr:"INVALID_ADDRESS"}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ge=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message",authAddr:u[1].addr}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),xe=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message",signers:["INVALID_ADDRESS"]}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),je=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message",signers:[a]}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Oe=function(){var e=Object(s.a)(Object(r.a)().mark((function e(t,n){var a,s;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(c.b)(t);case 2:return a=e.sent,(s=[[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:n,to:n,amount:0,assetIndex:31566704,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"NGIHJMECRSFHIEQDHBVTLR54K7DOZWM5M6UM3A5CIOYSP6H3QTGSHHGJCQ",amount:5e6,suggestedParams:a})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:n,appIndex:605929989,appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:a})}]])[2][0].txn.fee=2e3,s.forEach((function(e){return o.default.assignGroupID(e.map((function(e){return e.txn})))})),e.abrupt("return",{transaction:s});case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),he=function(){var e=Object(s.a)(Object(r.a)().mark((function e(t,n){var a,s;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(c.b)(t);case 2:return a=e.sent,(s=[[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:n,to:n,amount:0,assetIndex:386195940,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"6NXX7RGJFLEI3HEQEZXDP73SMQKAPWS4N7CEQJ4IEVONUWYWJLT4NM5QQM",amount:3e6,suggestedParams:a})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:n,appIndex:607660059,appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:a})}]])[2][0].txn.fee=2e3,s.forEach((function(e){return o.default.assignGroupID(e.map((function(e){return e.txn})))})),e.abrupt("return",{transaction:s});case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),ve=function(){var e=Object(s.a)(Object(r.a)().mark((function e(t,n){var a,s;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(c.b)(t);case 2:return a=e.sent,(s=[[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"AV6PFVXWDQ7RVNQYOEXCWXCLXVJ5V57WVMVQZ2TWH4EKTB7GSWKUIAUPXQ",amount:2e6,suggestedParams:a})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:n,appIndex:686498781,appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:a})}]])[1][0].txn.fee=3e3,s.forEach((function(e){return o.default.assignGroupID(e.map((function(e){return e.txn})))})),e.abrupt("return",{transaction:s});case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),ye=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,(u=[[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,amount:0,assetIndex:919950894,suggestedParams:s})}],[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:"KIW56KLIBX5UMWS5RT346TNA4HRV5H445S2LMQLRCR73SOHRVSM5TZBQ4A",amount:1160825,assetIndex:31566704,suggestedParams:s})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:"KIW56KLIBX5UMWS5RT346TNA4HRV5H445S2LMQLRCR73SOHRVSM5TZBQ4A",amount:3977452,suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_1"))],suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_2"))],suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_3"))],suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_4"))],suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_5"))],suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_6"))],suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_7"))],suggestedParams:s})}]])[3][0].txn.fee=29e3,u.forEach((function(e){return o.default.assignGroupID(e.map((function(e){return e.txn})))})),t.abrupt("return",{transaction:u});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Te=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=[[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:a,amount:0,note:new Uint8Array(e.from("challenge/1449301/gems")),suggestedParams:s})}]],t.abrupt("return",{transaction:u});case 5:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Pe=function(){var e=Object(s.a)(Object(r.a)().mark((function e(t,n){var a,s;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(c.b)(t);case 2:return a=e.sent,(s=[[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:n,to:n,amount:0,assetIndex:886237574,suggestedParams:a})}],[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:"N4EJ2ZFGWCEL4PVTCJSLD7RC4WVIUNO57V7LW2FQY7DFOP4EEN4XYC5UEM",to:n,amount:1,assetIndex:886237574,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"RJASLRMECMQL66PH2KLMFSCYMOOBOK7KRX3XMAWDKDB2PQ5J3U5FMPAJNE",amount:36e5,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"VWZBFLBUN6O5A5W6IWHMDUVP5NH2LPV4ZYFMAHP4FQBBYP627MP6WPOEG4",amount:4e5,suggestedParams:a})}]]).forEach((function(e){return o.default.assignGroupID(e.map((function(e){return e.txn})))})),e.abrupt("return",{transaction:s});case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),we=function(){var e=Object(s.a)(Object(r.a)().mark((function e(t,n){var a,s;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(c.b)(t);case 2:return a=e.sent,(s=[[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:n,to:n,amount:0,assetIndex:865021507,suggestedParams:a})}],[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:"CATN6JYGMBZF4OAQBXZTGALLB3X3XUUU6CQAKXUPNKVOC32VNTRWK25HD4",to:n,amount:1,assetIndex:865021507,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"BSKX6GSPTSY2KKXBO5L367OBY5SJT6GD25FV3RY25VLOGCMORQ6COPCOXY",amount:196900,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"ANGEL3CMT7TEXSBJR3DCTJTZCQFOF6FJB6PDKU4IOAMTNPXGR7XUYKOU5Y",amount:18803950,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"XNFT36FUCFRR6CK675FW4BEBCCCOJ4HOSMGCN6J2W6ZMB34KM2ENTNQCP4",amount:689150,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"CATN6JYGMBZF4OAQBXZTGALLB3X3XUUU6CQAKXUPNKVOC32VNTRWK25HD4",amount:1e3,suggestedParams:a})}]]).forEach((function(e){return o.default.assignGroupID(e.map((function(e){return e.txn})))})),e.abrupt("return",{transaction:s});case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Ae=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e6,assetIndex:444035862,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ke=[{name:"1. Swap Algo to USDC (algofi)",scenario:Oe},{name:"2. Swap Algo to GoETH (algofi)",scenario:he},{name:"3. Deposit Algo (folksfinance)",scenario:ve},{name:"4. Pool ALGO-USDC (folksfinance)",scenario:ye},{name:"5. Auth (algogems)",scenario:Te},{name:"6. Buy NFT (algogems)",scenario:Pe},{name:"7. Buy NFT (algoxnft)",scenario:we},{name:"8. Zone Transfer",scenario:Ae}],Fe=[{name:"1. Sign single pay txn",scenario:f},{name:"2. Sign single pay txn with close",scenario:l},{name:"3. Sign single pay txn with rekey",scenario:p},{name:"4. Sign single pay txn with rekey and close",scenario:b},{name:"5. Single pay txn with invalid auth address",scenario:g},{name:"6. Sign single asset opt-in txn",scenario:x},{name:"7. Sign single asset opt-in txn with invalid asset id",scenario:j},{name:"8. Sign single asset transfer txn",scenario:O},{name:"9. Sign single asset transfer txn with close",scenario:h},{name:"10. Sign single asset transfer txn with invalid asset id",scenario:v},{name:"11. Sign single app opt-in txn",scenario:y},{name:"12. Sign single app call txn",scenario:P},{name:"13. Sign single app call txn with rekey",scenario:A},{name:"14. Sign single app close out txn",scenario:k},{name:"15. Sign 1 of 2 txns from a group",scenario:W},{name:"16. Sign 2 of 3 txns from a group",scenario:N},{name:"17. Sign txn group with pay, asset opt-in, and asset transfer",scenario:D},{name:"18. Sign txn group with pay and rekey",scenario:M},{name:"19. Sign txn group with asset close",scenario:_},{name:"20. Sign txn group with rekey",scenario:E},{name:"21. Sign txn group with rekey and asset close",scenario:R},{name:"22. Sign group of 7",scenario:L},{name:"23. Full txn group",scenario:G},{name:"24. Sign multiple non-atomic txns",scenario:K},{name:"25. Sign multiple non-atomic txns for only assets",scenario:B},{name:"26. Sign mixed multiple non-atomic txns",scenario:V},{name:"27. Sign atomic txn group and non-atomic txns for only payment",scenario:X},{name:"28. Sign mixed atomic txn group and non-atomic txns",scenario:Q},{name:"29. Sign multiple atomic txn groups for only payment",scenario:H},{name:"30. Sign multiple atomic txn groups for only assets",scenario:z},{name:"31. Sign multiple atomic txn groups with invalid asset",scenario:J},{name:"32. Sign first mixed 2 atomic txn groups",scenario:Y},{name:"33. Sign second mixed 2 atomic txn groups",scenario:Z},{name:"34. Sign only 2 txns in multiple atomic txn groups",scenario:q},{name:"35. Sign only 2 txns in atomic txn group and non-atomic txns",scenario:$},{name:"36. Atomic group with no sig needed (invalid)",scenario:ee},{name:"37. Atomic group and single txn with no sig needed (invalid)",scenario:te},{name:"38. Txn with large note",scenario:ne},{name:"39. Sign single app clear state txn",scenario:F},{name:"40. Sign single app create txn",scenario:S},{name:"41. Sign single app update txn",scenario:U},{name:"42. Sign single app delete txn",scenario:C},{name:"43. Sign single app call with no args",scenario:w},{name:"44. Sign single app create txn with extra page (not working with ledger app v1.2.15)",scenario:I},{name:"45. Sign asset create + rekey txn",scenario:ae},{name:"46. Sign asset create txn with minimal info",scenario:re},{name:"47. Sign asset reconfig txn",scenario:se},{name:"48. Sign asset reconfig txn clear all",scenario:oe},{name:"49. Sign asset delete txn",scenario:ce},{name:"50. Sign txn group with 0 fee",scenario:ue},{name:"51. Sign 64 transactions",scenario:ie},{name:"52. Sign 65 transactions",scenario:me},{name:"53. Future transaction",scenario:fe},{name:"54. Invalid Grouping issue",scenario:le},{name:"55. Application txn with boxes",scenario:pe},{name:"56. Invalid auth address",scenario:be},{name:"57. Valid auth address",scenario:ge},{name:"58. Invalid signers",scenario:xe},{name:"59. Valid signers",scenario:je},{name:"60. 512 Transactions",scenario:de},{name:"61. Sign single app opt-in with rekey",scenario:T}]}).call(this,n(5).Buffer)},50:function(e,t,n){"use strict";var a=n(9),r=n(2),s=n(1),o=n(0),c=n(15),u=n(7),i=n(41),m=n(58),d=n(59),f=n(40),l=n(3),p=n(4),b=n(37),g=function(e){Object(l.a)(n,e);var t=Object(p.a)(n);function n(e){var a;Object(r.a)(this,n);for(var s=arguments.length,o=new Array(s>1?s-1:0),c=1;c1?t-1:0),a=1;a {\n const params = await clientForChain(chain).getTransactionParams().do();\n\n return params;\n}\n\nexport {clientForChain, apiGetTxnParams};\n","import {useState} from \"react\";\nimport {Button, List, ListItem} from \"@hipo/react-ui-toolkit\";\nimport {PeraWalletConnect} from \"@perawallet/connect\";\nimport {PeraWalletArbitraryData, SignerTransaction} from \"@perawallet/connect/dist/util/model/peraWalletModels\";\nimport algosdk from \"algosdk\";\n\nimport {mainnetScenarios, Scenario, scenarios} from \"./util/signTxnUtils\";\nimport {ChainType, clientForChain} from \"../../utils/algod/algod\";\nimport CreateTxn from \"./create/CreateTxn\";\nimport useModalVisibilityState from \"../../hooks/useModalVisibilityState\";\n\ninterface SignTxnProps {\n accountAddress: string;\n peraWallet: PeraWalletConnect;\n handleSetLog: (log: string) => void;\n chain: ChainType;\n refecthAccountDetail: () => void;\n}\n\nfunction SignTxn({\n accountAddress,\n peraWallet,\n handleSetLog,\n chain,\n refecthAccountDetail\n}: SignTxnProps) {\n const [isRequestPending, setIsRequestPending] = useState(false);\n const {isModalOpen, openModal, closeModal} = useModalVisibilityState();\n\n return (\n <>\n \n\n \n\n
\n

{\"Mainnet only, do not sign!\"}

\n {chain === ChainType.TestNet && {\"Switch to MainNet to see txns\"}}\n\n \n {(item) => (\n \n signTransaction(item.scenario, item.name)}\n shouldDisplaySpinner={isRequestPending}\n isDisabled={isRequestPending}>\n {isRequestPending ? \"Loading...\" : item.name}\n \n \n )}\n \n
\n\n
\n

{\"Both Networks\"}

\n\n \n {(item) => (\n \n signTransaction(item.scenario, item.name)}\n shouldDisplaySpinner={isRequestPending}\n isDisabled={isRequestPending}>\n {isRequestPending ? \"Loading...\" : item.name}\n \n \n )}\n \n\n
\n \n {isRequestPending ? \"Loading...\" : \"Sign Single Arbitrary Data\"}\n \n\n \n {isRequestPending ? \"Loading...\" : \"Sign Multiple Arbitrary Data\"}\n \n
\n
\n \n );\n\n async function signSingleArbitraryData() {\n const unsignedData = [\n {\n data: new Uint8Array(Buffer.from(`timestamp//${Date.now()}`)),\n message: \"Timestamp confirmation\"\n }];\n\n await signArbitraryData(unsignedData);\n }\n\n async function signMultipleArbitraryData() {\n const unsignedData = [\n {\n data: new Uint8Array(Buffer.from(`timestamp//${Date.now()}`)),\n message: \"Timestamp confirmation\"\n },\n {\n data: new Uint8Array(Buffer.from(`agent//${navigator.userAgent}`)),\n message: \"User agent confirmation\"\n }\n ];\n\n await signArbitraryData(unsignedData);\n }\n\n async function signArbitraryData(arbitraryData: PeraWalletArbitraryData[]) {\n try {\n const signedData: Uint8Array[] = await peraWallet.signData(\n arbitraryData,\n accountAddress\n );\n\n arbitraryData.forEach((data, index) => {\n const isVerified = algosdk.verifyBytes(data.data, signedData[index], accountAddress)\n\n console.log({data, signedData: signedData[index], isVerified});\n\n if (!isVerified) {\n handleSetLog(`Arbitrary data did not match with signed data!`);\n }\n });\n\n console.log({signedData});\n handleSetLog(\"Data signed successfully\");\n } catch (error) {\n console.log(error)\n handleSetLog(`${error}`);\n }\n }\n\n async function signTransaction(scenario: Scenario, name: string) {\n setIsRequestPending(true);\n\n try {\n const {transaction: txnsToSign, transactionTimeout} = await scenario(\n chain,\n accountAddress\n );\n\n const transactions: SignerTransaction[] = txnsToSign.reduce(\n (acc, val) => acc.concat(val),\n []\n );\n\n const signedTransactions = await peraWallet.signTransaction([transactions]);\n\n console.log({transactions, signedTransactions});\n\n handleSetLog(`Transaction signed successfully: ${name}`);\n\n if (transactionTimeout) {\n setTimeout(async () => {\n await clientForChain(chain).sendRawTransaction(signedTransactions).do();\n handleSetLog(`Transaction sended network: ${name}`);\n }, transactionTimeout);\n } else {\n for (let i = 0; i < txnsToSign.length; i++) {\n await clientForChain(chain)\n // eslint-disable-next-line no-magic-numbers\n .sendRawTransaction(signedTransactions.slice(i * 16, (i + 1) * 16))\n .do();\n }\n\n handleSetLog(`Transaction sended network: ${name}`);\n }\n } catch (error) {\n handleSetLog(`${error}`);\n console.log(error);\n } finally {\n setIsRequestPending(false);\n refecthAccountDetail();\n }\n }\n}\n\nexport default SignTxn;\n","import {useEffect, useRef, useState} from \"react\";\nimport {Button} from \"@hipo/react-ui-toolkit\";\nimport algosdk, {Transaction, isValidAddress} from \"algosdk\";\nimport {SignerTransaction} from \"@perawallet/connect/dist/util/model/peraWalletModels\";\n\nimport useAsyncProcess from \"../../../../hooks/useAsyncProcess/useAsyncProcess\";\nimport peraApi, {Asset} from \"../../../../utils/pera/api/peraApi\";\nimport {getSearchParams} from \"../../../../utils/url/urlUtils\";\nimport {TxnForm} from \"../CreateTxn\";\nimport {ChainType, apiGetTxnParams} from \"../../../../utils/algod/algod\";\nimport {PeraTransactionType} from \"../../../../transaction/transactionTypes\";\n\nfunction CreateTxnButton({\n txnForm,\n type,\n chain,\n onResetForm,\n onSetTransactions\n}: {\n txnForm: TxnForm;\n type: PeraTransactionType;\n chain: ChainType;\n onResetForm: VoidFunction;\n onSetTransactions: (txns: SignerTransaction[]) => void;\n}) {\n const {\n address,\n toAddress,\n amount,\n note,\n assetIndex,\n rekeyTo,\n closeTo,\n transactionAmount,\n\n // keyreg\n voteKey,\n selectionKey,\n stateProofKey,\n voteFirst,\n voteLast,\n voteKeyDilution,\n isOnlineKeyregTxn,\n\n // acfg\n\n assetTxnType,\n unitName,\n assetName,\n defaultFrozen,\n manager,\n reserve,\n freeze,\n clawback,\n assetURL,\n total,\n decimals\n } = txnForm;\n const {runAsyncProcess} = useAsyncProcess>();\n const assetsRef = useRef>();\n const [isPending, setPendingState] = useState(false);\n const [isDisabled, setDisablingState] = useState(false);\n\n useEffect(() => {\n if (type === \"keyreg\") {\n if (isOnlineKeyregTxn) {\n if (voteKey && selectionKey && stateProofKey && voteFirst && voteLast &&\n voteKeyDilution) {\n setDisablingState(false);\n } else {\n setDisablingState(true);\n }\n } else {\n setDisablingState(false);\n }\n }\n }, [isOnlineKeyregTxn, voteKey, selectionKey, stateProofKey, voteFirst, voteLast, voteKeyDilution, type]);\n\n return (\n {`Create ${type} Transaction`}\n );\n\n async function handleCreateTransaction() {\n try {\n if (type === \"pay\") {\n await createPayTransaction();\n } else if (type === \"axfer\") {\n await createAxferTransaction();\n } else if (type === \"keyreg\") {\n await createKeyregTransaction();\n } else if (type === \"acfg\") {\n await createAcfgTransaction();\n }\n\n onResetForm();\n } catch {\n console.log(\"Failed to create transactions.\");\n }\n }\n\n async function createAcfgTransaction() {\n try {\n const suggestedParams = await apiGetTxnParams(chain);\n let txn: Transaction;\n\n if (assetTxnType === \"create\") {\n txn = algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject({\n defaultFrozen: defaultFrozen || false,\n unitName,\n assetName,\n manager,\n reserve,\n freeze,\n clawback,\n assetURL,\n total: total || 1,\n decimals: decimals || 0,\n from: address,\n suggestedParams\n });\n } else if (assetTxnType === \"modify\") {\n txn = algosdk.makeAssetConfigTxnWithSuggestedParamsFromObject({\n from: address,\n manager,\n freeze,\n clawback,\n reserve,\n assetIndex: Number(assetIndex),\n suggestedParams,\n strictEmptyAddressChecking: false\n })\n } else {\n txn = algosdk.makeAssetDestroyTxnWithSuggestedParamsFromObject({\n from: address,\n suggestedParams,\n assetIndex: Number(assetIndex)\n })\n }\n \n\n onSetTransactions([{txn}]);\n } catch (e) {\n console.log(e);\n }\n }\n\n async function createKeyregTransaction() {\n try {\n const suggestedParams = await apiGetTxnParams(chain);\n let txn: Transaction;\n\n if (isOnlineKeyregTxn) {\n txn = algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject({\n from: address,\n voteKey: voteKey!,\n selectionKey: selectionKey!,\n stateProofKey: stateProofKey!,\n voteFirst: voteFirst!,\n voteLast: voteLast!,\n voteKeyDilution: voteKeyDilution!,\n rekeyTo: isValidAddress(rekeyTo) ? rekeyTo : undefined,\n suggestedParams\n });\n } else {\n txn = algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject({\n from: address,\n rekeyTo: isValidAddress(rekeyTo) ? rekeyTo : undefined,\n suggestedParams\n });\n }\n\n onSetTransactions([{txn}]);\n } catch (error) {\n console.log(error);\n }\n }\n\n async function createPayTransaction() {\n try {\n setPendingState(true);\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: toAddress,\n amount: Number(amount),\n note: new Uint8Array(Buffer.from(note)),\n rekeyTo: isValidAddress(rekeyTo) ? rekeyTo : undefined,\n closeRemainderTo: isValidAddress(closeTo) ? closeTo : undefined,\n suggestedParams\n });\n\n onSetTransactions([{txn}]);\n } catch (error) {\n console.log(error);\n } finally {\n setPendingState(false);\n }\n }\n\n async function createAxferTransaction() {\n try {\n setPendingState(true);\n await fetchAssets();\n\n const suggestedParams = await apiGetTxnParams(chain);\n const txns: SignerTransaction[] = [];\n\n for (let i = 0; i < transactionAmount; i++) {\n const assetId = assetsRef.current!.results[i].asset_id;\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: toAddress,\n amount: 0,\n assetIndex: transactionAmount === 1 ? Number(assetIndex) : assetId,\n note: new Uint8Array(Buffer.from(`Transaction no: ${i + 1}`)),\n rekeyTo: isValidAddress(rekeyTo) ? rekeyTo : undefined,\n closeRemainderTo: isValidAddress(closeTo) ? closeTo : undefined,\n suggestedParams\n });\n\n txns.push({txn});\n }\n\n onSetTransactions(txns);\n } catch (error) {\n console.log(error);\n } finally {\n setPendingState(false);\n }\n }\n\n async function fetchAssets(next?: string) {\n let assetsResponse: ListRequestResponse;\n\n if (next) {\n const nextRequestUrl = new URL(next);\n\n assetsResponse = await runAsyncProcess(\n peraApi.getAssets(getSearchParams(nextRequestUrl.search))\n );\n } else {\n assetsResponse = await runAsyncProcess(peraApi.getAssets());\n }\n\n assetsRef.current = {\n ...assetsResponse,\n results: [...(assetsRef.current?.results || []), ...assetsResponse.results]\n }\n\n if ((assetsRef.current.results.length || 0) < transactionAmount && assetsResponse.next) await fetchAssets(assetsResponse.next)\n }\n}\n\nexport default CreateTxnButton;\n","import {useCallback, useState} from \"react\";\n\nfunction useModalVisibilityState() {\n const [isModalOpen, setModalVisibility] = useState(false);\n\n return {\n isModalOpen,\n setModalVisibility,\n openModal: useCallback(() => {\n setModalVisibility(true);\n }, [setModalVisibility]),\n closeModal: useCallback(() => {\n setModalVisibility(false);\n }, [setModalVisibility])\n };\n}\n\nexport default useModalVisibilityState;\n","var _path;\n\nvar _excluded = [\"title\", \"titleId\"];\n\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from \"react\";\n\nfunction SvgClose(_ref, svgRef) {\n var title = _ref.title,\n titleId = _ref.titleId,\n props = _objectWithoutProperties(_ref, _excluded);\n\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n width: 24,\n height: 24,\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, _path || (_path = /*#__PURE__*/React.createElement(\"path\", {\n d: \"M20 4L4 20M20 20L4 4\",\n stroke: \"#0A0A0A\",\n strokeWidth: 1.5\n })));\n}\n\nvar ForwardRef = /*#__PURE__*/React.forwardRef(SvgClose);\nexport default __webpack_public_path__ + \"static/media/close.950baffa.svg\";\nexport { ForwardRef as ReactComponent };","import \"./_modal.scss\";\n\nimport React, {useEffect} from \"react\";\nimport ReactModal from \"react-modal\";\nimport classNames from \"classnames\";\n\ntype ModalProps = Omit<\n ReactModal.Props,\n \"contentLabel\" | \"onRequestClose\" | \"parentSelector\" | \"className\"\n> & {\n contentLabel: string;\n onClose: ReactModal.Props[\"onRequestClose\"];\n customClassName?: string;\n shouldPreventScrollOnOverlay?: boolean;\n children?: React.ReactNode;\n};\n\nconst MODAL_CLOSE_TIMEOUT =\n parseFloat(\n getComputedStyle(document.documentElement)\n .getPropertyValue(\"--modal-transition-duration\")\n .trim() || \"0.2\"\n\n // eslint-disable-next-line no-magic-numbers\n ) * 2000;\n\nReactModal.defaultStyles = {};\nReactModal.setAppElement(\"#root\");\n\nfunction getParent() {\n return document.querySelector(\"#modal-root\") as HTMLElement;\n}\n\nfunction Modal({\n customClassName,\n children,\n closeTimeoutMS = MODAL_CLOSE_TIMEOUT,\n shouldCloseOnOverlayClick = true,\n shouldCloseOnEsc = false,\n bodyOpenClassName,\n onClose,\n shouldPreventScrollOnOverlay = true,\n isOpen,\n ...otherProps\n}: ModalProps) {\n useEffect(() => {\n if (shouldPreventScrollOnOverlay && isOpen) {\n document.body.style.overflow = \"hidden\";\n }\n\n return () => {\n if (shouldPreventScrollOnOverlay) {\n document.body.style.overflow = \"unset\";\n }\n };\n }, [isOpen, shouldPreventScrollOnOverlay]);\n\n return (\n // This wrapper div and click handler is added to stop any click events from bubbling outside of the modal\n // eslint-disable-next-line\n
event.stopPropagation()}>\n \n {children}\n \n
\n );\n\n function handleRequestClose(\n event: React.MouseEvent | React.KeyboardEvent\n ) {\n if (onClose && (shouldCloseOnOverlayClick || shouldCloseOnEsc)) {\n onClose(event);\n }\n }\n}\n\nexport default Modal;\n","export const TRANSACTION_LIMIT = 1000;\nexport const TRANSACTION_IN_GROUP_LIMIT = 16;\n\nexport const ALGORAND_DEFAULT_TXN_WAIT_ROUNDS = 1000;","/* eslint-disable max-lines */\nimport {ReactComponent as CloseIcon} from \"../../../ui/icon/close.svg\";\n\nimport \"./_create-txn.scss\";\n\nimport {SignerTransaction} from \"@perawallet/connect/dist/util/model/peraWalletModels\";\nimport algosdk from \"algosdk\";\nimport {\n Button,\n Dropdown,\n DropdownOption,\n FormField,\n Input,\n List,\n ListItem,\n Switch,\n Tab,\n TabItem,\n Textarea\n} from \"@hipo/react-ui-toolkit\";\nimport {useState} from \"react\";\nimport {PeraWalletConnect} from \"@perawallet/connect\";\n\nimport Modal from \"../../../component/modal/Modal\";\nimport {ChainType, clientForChain} from \"../../../utils/algod/algod\";\nimport CreateTxnButton from \"./button/CreateTxnButton\";\nimport {separateIntoChunks} from \"../../../utils/array/arrayUtils\";\nimport {ALGORAND_DEFAULT_TXN_WAIT_ROUNDS, TRANSACTION_IN_GROUP_LIMIT} from \"../../../transaction/transactionConstants\";\nimport {AssetTransactionType, PeraTransactionType} from \"../../../transaction/transactionTypes\";\n\ninterface CreateTxnModalProps {\n chain: ChainType;\n address: string;\n isOpen: boolean;\n onClose: VoidFunction;\n peraWallet: PeraWalletConnect;\n}\n\nexport interface TxnForm {\n address: string;\n toAddress: string;\n amount: string;\n note: string;\n assetIndex: string;\n rekeyTo: string;\n closeTo: string;\n transactionAmount: number;\n\n // keyreg\n voteKey?: string;\n selectionKey?: string;\n stateProofKey?: string;\n voteFirst?: number;\n voteLast?: number;\n voteKeyDilution?: number;\n isOnlineKeyregTxn?: boolean;\n\n // acfg\n assetTxnType?: AssetTransactionType;\n unitName?: string;\n assetName?: string;\n defaultFrozen?: boolean;\n manager?: string;\n reserve?: string;\n freeze?: string;\n clawback?: string;\n assetURL?: string;\n total?: number;\n decimals?: number;\n}\n\nconst TXN_DROPDOWN_OPTIONS: DropdownOption[] = [\n {\n id: \"pay\",\n title: \"pay\"\n },\n {\n id: \"axfer\",\n title: \"axfer\"\n },\n {\n id: \"keyreg\",\n title: \"keyreg\"\n },\n {\n id: \"acfg\",\n title: \"acfg\"\n }\n];\n\nconst ASSET_TXN_TABS: TabItem[] = [\n {id: \"create\", content: \"Create\"},\n {id: \"modify\", content: \"Modify\"},\n {id: \"destroy\", content: \"Destroy\"}\n]\n\nfunction CreateTxn({chain, address, isOpen, onClose, peraWallet}: CreateTxnModalProps) {\n const [transactions, setTransactions] = useState([]);\n const [transactionDropdownOption, setTransactionDropdownOption] =\n useState | null>({\n id: \"pay\",\n title: \"pay\"\n });\n const [formState, setFormState] = useState({\n address,\n toAddress: \"\",\n amount: \"\",\n note: \"\",\n assetIndex: \"\",\n rekeyTo: \"\",\n closeTo: \"\",\n transactionAmount: 1,\n assetTxnType: \"create\"\n });\n const [sendBlockchain, setSendBlockchain] = useState(false);\n\n return (\n \n \n\n

{\"Create Transaction\"}

\n\n \n {\n setTransactionDropdownOption(option);\n }}\n hasDeselectOption={false}\n />\n \n\n \n console.log(\"a\")}\n />\n \n\n {renderForm()}\n\n \n \n \n\n {transactions.length > 0 && (\n \n {(item, _a, index) => (\n {`Txn ${(index || 0) + 1} type: ${item.txn.type}`}\n )}\n \n )}\n\n \n\n {`Create Group Txn with created transactions`}\n\n {`Sign ${transactions.length} Transactions`}\n \n );\n\n function renderForm() {\n switch (transactionDropdownOption?.id) {\n case \"pay\":\n return (\n <>\n \n \n setFormState({...formState, toAddress: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, amount: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, rekeyTo: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, closeTo: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, note: e.currentTarget.value})\n }\n />\n \n \n );\n\n case \"axfer\":\n return (\n <>\n \n \n setFormState({...formState, toAddress: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, assetIndex: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, amount: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, rekeyTo: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, closeTo: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, note: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, transactionAmount: Number(e.currentTarget.value)})\n }\n />\n \n \n );\n\n case \"keyreg\":\n return (\n <>\n \n setFormState({...formState, isOnlineKeyregTxn: !formState.isOnlineKeyregTxn})} />\n \n\n \n \n setFormState({...formState, rekeyTo: e.currentTarget.value})\n }\n />\n \n\n {formState.isOnlineKeyregTxn && (\n <>\n \n \n setFormState({...formState, voteKey: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, selectionKey: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, stateProofKey: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, voteFirst: Number(e.currentTarget.value)})\n }\n />\n \n\n \n \n setFormState({...formState, voteLast: Number(e.currentTarget.value)})\n }\n />\n \n\n \n \n setFormState({...formState, voteKeyDilution: Number(e.currentTarget.value)})\n }\n />\n \n \n )}\n \n );\n\n case \"acfg\":\n return (\n <>\n \n {getAssetTransactionForms()}\n \n \n )\n\n default:\n return null;\n }\n }\n\n function handleAssetTabChange(index: number) {\n let txnType: AssetTransactionType = \"create\";\n\n if (index === 0) txnType = \"create\";\n else if (index === 1) txnType = \"modify\";\n else txnType = \"destroy\";\n\n setFormState({...formState, assetTxnType: txnType})\n }\n\n function getAssetTransactionForms() {\n const create = (\n <>\n \n \n setFormState({...formState, unitName: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, assetName: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, manager: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, reserve: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, freeze: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, clawback: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, assetURL: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, total: Number(e.currentTarget.value)})\n }\n />\n \n\n\n \n \n setFormState({...formState, decimals: Number(e.currentTarget.value)})\n }\n />\n \n\n \n setFormState({...formState, defaultFrozen: !formState.defaultFrozen})} />\n \n \n );\n\n const modify = (\n <>\n \n \n setFormState({...formState, assetIndex: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, manager: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, reserve: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, freeze: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, clawback: e.currentTarget.value})\n }\n />\n \n \n );\n\n const destroy = (\n <>\n \n \n setFormState({...formState, assetIndex: e.currentTarget.value})\n }\n />\n \n \n );\n\n return [create, modify, destroy];\n }\n\n function handleSetTransactions(newTxns: SignerTransaction[]) {\n setTransactions([...transactions, ...newTxns]);\n }\n\n function handleGroupTxn() {\n try {\n const transactionChunks = separateIntoChunks(transactions, TRANSACTION_IN_GROUP_LIMIT);\n\n for (const transactionChunk of transactionChunks) {\n algosdk.assignGroupID(transactionChunk.map((toSign) => toSign.txn));\n }\n } catch (error) {\n console.log(error);\n }\n }\n\n async function signTxn() {\n try {\n if (transactions.length === 0) {\n return;\n }\n\n const signedTransactions = await peraWallet.signTransaction([transactions]);\n\n console.log({signedTransactions});\n\n if (sendBlockchain) {\n for (const signedTransaction of signedTransactions) {\n await clientForChain(chain).sendRawTransaction(signedTransaction).do();\n \n await algosdk.waitForConfirmation(\n clientForChain(chain),\n transactions[0].txn.txID(),\n ALGORAND_DEFAULT_TXN_WAIT_ROUNDS\n );\n }\n\n console.log(\"Transactions sent to blockchain\")\n }\n } catch (error) {\n console.log(error);\n }\n }\n\n function handleSendBlockchain() {\n setSendBlockchain(!sendBlockchain);\n }\n\n function resetForm() {\n setFormState({\n ...formState,\n toAddress: \"\",\n amount: \"\",\n note: \"\",\n assetIndex: \"\",\n rekeyTo: \"\",\n closeTo: \"\",\n transactionAmount: 1\n });\n }\n}\n\nexport default CreateTxn;\n","function separateIntoChunks(array: T[], chunkSize: number): T[][] {\n const separatedArray = [];\n const arrayAmount = array.length / chunkSize;\n\n for (let i = 0; i < arrayAmount; i++) {\n separatedArray.push(array.slice(i * chunkSize, (i + 1) * chunkSize));\n }\n\n return separatedArray;\n}\n\nexport {separateIntoChunks};","import {omitKeys} from \"../object/objectUtils\";\n\nexport type AlgorandNumberFormatterOptions = Omit & {\n style?: Intl.NumberFormatPartTypes | \"percent\" | \"shorten-large-numbers\";\n locale?: string;\n};\n\n/**\n * A higher-order function that uses Intl.NumberFormat behind the scenes to format a number\n * @param {Object} providedOptions -\n * @param {string} providedOptions.locale - Passed as first argument to the Intl.NumberFormat. Defaults to one of [navigator.language, \"en-GB\"] or respects provided locale from the call-site\n * @returns {function} Function\n */\n\nexport const DEFAULT_NUMBER_FORMAT_LOCALE_PREFERENCE = \"en-US\";\n\nfunction formatNumber(providedOptions: AlgorandNumberFormatterOptions = {}) {\n const {locale = DEFAULT_NUMBER_FORMAT_LOCALE_PREFERENCE, ...otherOptions} =\n providedOptions;\n let options = otherOptions;\n const isCurrencyFormatting = options.style === \"currency\";\n const shouldShortenLargeNumbers = options.style === \"shorten-large-numbers\";\n\n if (isCurrencyFormatting) {\n options = {\n currency: \"USD\",\n maximumFractionDigits: 5,\n minimumFractionDigits: 2,\n // \"narrowSymbol\" prevents showing explicit currency symbols, such as \"US$\" or \"CA$\"\n currencyDisplay: \"narrowSymbol\",\n ...otherOptions\n };\n } else if (shouldShortenLargeNumbers) {\n options = {\n maximumFractionDigits: 2,\n minimumFractionDigits: 0,\n style: \"decimal\",\n ...omitKeys(otherOptions, \"style\")\n };\n } else {\n options = {\n maximumFractionDigits: 5,\n minimumFractionDigits: 2,\n style: \"decimal\",\n ...otherOptions\n };\n }\n\n let numberFormatter: {\n format: (x: number | bigint) => string;\n };\n\n try {\n numberFormatter = new Intl.NumberFormat(\n locale || [navigator.language, \"en-GB\"],\n options\n );\n } catch (error) {\n numberFormatter = {\n format(x: number | bigint) {\n return x.toLocaleString();\n }\n };\n\n if (isCurrencyFormatting) {\n // currencyDisplay: \"narrowSymbol\" option is not supported by some browsers, try by providing \"symbol\"\n try {\n options.currencyDisplay = \"symbol\";\n numberFormatter = new Intl.NumberFormat(\n locale || [navigator.language, \"en-GB\"],\n options\n );\n } catch (currencyFormattingError) {\n console.error({currencyFormattingError});\n }\n }\n }\n\n return (value: number) => {\n let formattedValue = \"\";\n\n if (!Object.is(value, NaN)) {\n /* eslint-disable no-magic-numbers */\n if (shouldShortenLargeNumbers) {\n if (value >= Math.pow(10, 9)) {\n formattedValue = `${numberFormatter.format(value / Math.pow(10, 9))}b`;\n } else if (value >= Math.pow(10, 6)) {\n formattedValue = `${numberFormatter.format(value / Math.pow(10, 6))}m`;\n } else if (value >= Math.pow(10, 3)) {\n formattedValue = `${numberFormatter.format(value / Math.pow(10, 3))}k`;\n } else {\n formattedValue = numberFormatter.format(value);\n }\n } else {\n formattedValue = numberFormatter.format(value);\n }\n /* eslint-enable no-magic-numbers */\n }\n\n if (formattedValue && options.currency === \"USD\") {\n // in case `narrowSymbol` option was failed, make sure \"US$\" sign appears as just \"$\"\n formattedValue = formattedValue.replace(\"US$\", \"$\");\n }\n\n return formattedValue;\n };\n}\n\nexport {formatNumber};\n","import {microalgosToAlgos} from \"algosdk\";\n\nimport {ChainType, clientForChain} from \"../algod/algod\";\nimport {formatNumber} from \"../number/numberUtils\";\n\nfunction getAccountBalanceText(account: AccountInformationData) {\n return `${formatNumber({minimumFractionDigits: 2})(\n microalgosToAlgos(Number(account.amount))\n )} ALGO`;\n}\n\nfunction getAccountInformation(chain: ChainType, address: string) {\n return new Promise((resolve, reject) => {\n try {\n resolve(\n clientForChain(chain)\n .accountInformation(address)\n .do() as Promise\n );\n } catch (error) {\n reject(error);\n }\n });\n}\n\nexport {getAccountBalanceText, getAccountInformation};\n","export type PeraWalletType = \"pera-wallet\" | \"pera-wallet-web\";\n\nexport interface PeraWalletDetails {\n type: PeraWalletType;\n accounts: string[];\n selectedAccount: string;\n}\n\nconst PERA_WALLET_LOCAL_STORAGE_KEYS = {\n WALLET: \"PeraWallet.Wallet\",\n COMPACT_MODE: \"CompactMode\"\n};\n\nexport {PERA_WALLET_LOCAL_STORAGE_KEYS};\n","import {\n PERA_WALLET_LOCAL_STORAGE_KEYS,\n PeraWalletDetails\n} from \"./pera-wallet/peraWalletTypes\";\n\nfunction getLocalStorage() {\n return typeof localStorage === \"undefined\" ? undefined : localStorage;\n}\n\nfunction getWalletDetailsFromStorage(): PeraWalletDetails | null {\n const storedWalletDetails = getLocalStorage()?.getItem(\n PERA_WALLET_LOCAL_STORAGE_KEYS.WALLET\n );\n\n if (storedWalletDetails) {\n return JSON.parse(storedWalletDetails) as PeraWalletDetails;\n }\n\n return null;\n}\n\nexport {getWalletDetailsFromStorage};\n","import {getAccountBalanceText} from \"../../utils/account/accountUtils\";\nimport {ChainType} from \"../../utils/algod/algod\";\nimport {getWalletDetailsFromStorage} from \"../../utils/storage/storageUtils\";\nimport {truncateAccountAddress} from \"../../utils/string/stringUtils\";\n\nfunction AccountBalance({\n accountInformation,\n chain\n}: {\n accountInformation: AccountInformationData;\n chain: ChainType;\n}) {\n const walletDetails = getWalletDetailsFromStorage();\n\n return (\n
\n
\n {\"Connected to: \"}\n\n {truncateAccountAddress(accountInformation.address)}\n
\n\n
\n {\"Chain: \"}\n\n {chain.toUpperCase()}\n
\n\n
\n {\"Wallet Type: \"}\n\n {walletDetails?.type}\n
\n\n {accountInformation && (\n
\n {\"Balance: \"}\n\n {getAccountBalanceText(accountInformation)}\n
\n )}\n
\n );\n}\n\nexport default AccountBalance;\n","function truncateAccountAddress(stringToTruncate: string) {\n /* eslint-disable no-magic-numbers */\n return `${stringToTruncate.substring(0, 8)}...${stringToTruncate.substring(\n stringToTruncate.length - 4\n )}`;\n /* eslint-enable no-magic-numbers */\n}\n\nexport {truncateAccountAddress};\n","import \"./_pera-toast.scss\";\n\nimport React from \"react\";\nimport classNames from \"classnames\";\n\ninterface PeraToastProps {\n message: React.ReactNode;\n customClassName?: string;\n}\n\nfunction PeraToast({message, customClassName}: PeraToastProps) {\n return (\n
\n
{message}
\n
\n );\n}\n\nexport default PeraToast;\n","import {useToaster} from \"@hipo/react-ui-toolkit\";\nimport {useCallback, useEffect} from \"react\";\n\nimport PeraToast from \"../../component/toast/PeraToast\";\nimport {getAccountInformation} from \"../../utils/account/accountUtils\";\nimport {ChainType} from \"../../utils/algod/algod\";\nimport useAsyncProcess from \"../useAsyncProcess/useAsyncProcess\";\n\nfunction useGetAccountDetailRequest({\n chain,\n accountAddress\n}: {\n chain: ChainType;\n accountAddress: string;\n}) {\n const {\n state: accountInformationState,\n runAsyncProcess: runGetAccountInformationAsyncProcess\n } = useAsyncProcess();\n const {display: displayToast} = useToaster();\n\n const refetchAccountDetail = useCallback(() => {\n if (chain && accountAddress) {\n try {\n runGetAccountInformationAsyncProcess(\n getAccountInformation(chain, accountAddress)\n );\n } catch (error) {\n displayToast({\n render() {\n return ;\n }\n });\n }\n }\n }, [accountAddress, chain, displayToast, runGetAccountInformationAsyncProcess]);\n\n useEffect(() => {\n refetchAccountDetail();\n }, [refetchAccountDetail]);\n\n return {\n accountInformationState,\n refetchAccountDetail\n };\n}\n\nexport default useGetAccountDetailRequest;\n","import \"./_home.scss\";\n\nimport {Button, Dropdown, DropdownOption, Switch, useToaster} from \"@hipo/react-ui-toolkit\";\nimport {useEffect, useState} from \"react\";\nimport {PeraWalletConnect} from \"@perawallet/connect\";\nimport {PeraOnramp} from \"@perawallet/onramp\";\nimport {SignerTransaction} from \"@perawallet/connect/dist/util/model/peraWalletModels\";\n\nimport AccountBalance from \"./account-balance/AccountBalance\";\nimport SignTxn from \"./sign-txn/SignTxn\";\nimport PeraToast from \"../component/toast/PeraToast\";\nimport {ChainType, clientForChain} from \"../utils/algod/algod\";\nimport useGetAccountDetailRequest from \"../hooks/useGetAccountDetailRequest/useGetAccountDetailRequest\";\nimport {createAssetOptInTxn} from \"./sign-txn/util/signTxnUtils\";\nimport peraApiManager from \"../utils/pera/api/peraApiManager\";\nimport {PERA_WALLET_LOCAL_STORAGE_KEYS} from \"../utils/storage/pera-wallet/peraWalletTypes\";\n\nconst isCompactMode = localStorage.getItem(PERA_WALLET_LOCAL_STORAGE_KEYS.COMPACT_MODE);\nlet peraWallet = new PeraWalletConnect({compactMode: isCompactMode === \"true\"});\nconst peraOnRamp = new PeraOnramp({\n optInEnabled: true\n});\n\nfunction Home() {\n const [chainType, setChainType] = useState(ChainType.TestNet);\n const [chainDropdownSelectedOption, setChainDropdownSelectedOption] =\n useState | null>({\n id: \"testnet\",\n title: \"TestNet\"\n });\n const [accountAddress, setAccountAddress] = useState(null);\n const isConnectedToPeraWallet = !!accountAddress;\n const {display: displayToast} = useToaster();\n const {accountInformationState, refetchAccountDetail} = useGetAccountDetailRequest({\n chain: chainType,\n accountAddress: accountAddress || \"\"\n });\n const [isConnectCompactMode, setConnectCompactMode] = useState(peraWallet.compactMode || false);\n\n useEffect(() => {\n peraWallet = new PeraWalletConnect({compactMode: isConnectCompactMode});\n }, [isConnectCompactMode]);\n\n useEffect(() => {\n peraWallet\n .reconnectSession()\n .then((accounts) => {\n if (accounts) {\n setAccountAddress(accounts[0]);\n\n handleSetLog(\"Connected to Pera Wallet\");\n }\n\n peraWallet.connector?.on(\"disconnect\", () => {\n setAccountAddress(null);\n });\n })\n .catch((e) => console.log(e));\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n
\n
\n {\n handleSelectChainType(option);\n }}\n hasDeselectOption={false}\n />\n
\n\n {chainType === ChainType.MainNet && (\n
\n {\n \"You are using MainNet right now. Please be careful when you trying to send transactions.\"\n }\n
\n )}\n\n

\n {\"Pera Wallet\"} {\"Example dApp\"}\n

\n\n {!isConnectedToPeraWallet && (\n
\n

{\"Pera Connect Compact Mode: \"}

\n\n \n
\n )}\n\n {accountInformationState.data && (\n \n )}\n\n {isConnectedToPeraWallet && chainType === \"mainnet\" && (\n \n )}\n\n \n {isConnectedToPeraWallet ? \"Disconnect\" : \"Connect to Pera Wallet\"}\n \n\n {isConnectedToPeraWallet && (\n \n )}\n
\n );\n\n function handleCompactModeSwitch() {\n setConnectCompactMode(!isConnectCompactMode);\n\n localStorage.setItem(PERA_WALLET_LOCAL_STORAGE_KEYS.COMPACT_MODE, localStorage.getItem(PERA_WALLET_LOCAL_STORAGE_KEYS.COMPACT_MODE) === \"true\" ? \"false\" : \"true\");\n }\n\n function handleAddFunds() {\n if (accountAddress) {\n addFunds();\n\n peraOnRamp.on({\n OPT_IN_REQUEST: async ({accountAddress: addr, assetID}) => {\n try {\n const {transaction: txnsToSign} = await createAssetOptInTxn(\n chainType,\n addr,\n Number(assetID)\n );\n\n const transactions: SignerTransaction[] = txnsToSign.reduce(\n (acc, val) => acc.concat(val),\n []\n );\n\n const signedTxn = await peraWallet.signTransaction([transactions]);\n\n await clientForChain(chainType).sendRawTransaction(signedTxn).do();\n\n peraOnRamp.close();\n\n addFunds();\n } catch (error) {\n handleSetLog(`${error}`);\n }\n },\n ADD_FUNDS_COMPLETED: () => {\n handleSetLog(\"Add funds completed\");\n },\n ADD_FUNDS_FAILED: () => {\n handleSetLog(\"Add funds failed\");\n }\n });\n }\n }\n\n function addFunds() {\n if (accountAddress) {\n peraOnRamp\n .addFunds({\n accountAddress\n })\n .then(() => {\n handleSetLog(\"Funds added\");\n })\n .catch((e) => {\n handleSetLog(`${e}`);\n });\n }\n }\n\n async function handleConnectWalletClick() {\n try {\n const newAccounts = await peraWallet.connect();\n \n handleSetLog(\"Connected to Pera Wallet\");\n \n setAccountAddress(newAccounts[0]);\n } catch (e) {\n console.log(e);\n handleSetLog(`${e}`);\n }\n }\n\n function handleDisconnectWalletClick() {\n peraWallet.disconnect();\n\n setAccountAddress(null);\n }\n\n function handleSetLog(log: string) {\n displayToast({\n timeout: 10000,\n render() {\n return ;\n }\n });\n }\n\n function handleSelectChainType(\n option: DropdownOption<\"mainnet\" | \"testnet\", any> | null\n ) {\n if (option?.id === \"testnet\") {\n setChainType(ChainType.TestNet);\n setChainDropdownSelectedOption({\n id: \"testnet\",\n title: \"TestNet\"\n });\n peraApiManager.updateFetcher(ChainType.TestNet);\n } else if (option?.id === \"mainnet\") {\n setChainType(ChainType.MainNet);\n setChainDropdownSelectedOption({\n id: \"mainnet\",\n title: \"MainNet\"\n });\n peraApiManager.updateFetcher(ChainType.MainNet);\n }\n }\n}\n\nexport default Home;\n","import {useEffect, useRef} from \"react\";\n\nconst DEFAULT_DEBOUNCE_TIME = 150;\n\nconst DEFAULT_OPTIONS = {\n /* Discard emitted resize events that take less than the specified time */\n debounceTime: DEFAULT_DEBOUNCE_TIME\n};\n\nfunction useOnWindowResize(callback: VoidFunction, options = DEFAULT_OPTIONS) {\n const timeoutId = useRef(undefined);\n const callbackRef = useRef(callback);\n\n useEffect(() => {\n callbackRef.current = callback;\n }, [callback]);\n\n useEffect(() => {\n window.addEventListener(\"resize\", handleResize);\n\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n clearTimeout(timeoutId.current);\n };\n\n function handleResize() {\n if (!timeoutId.current) {\n timeoutId.current = setTimeout(() => {\n callbackRef.current();\n timeoutId.current = undefined;\n }, options.debounceTime);\n }\n }\n }, [options.debounceTime]);\n}\n\nexport default useOnWindowResize;\n","import {useEffect} from \"react\";\n\nimport useOnWindowResize from \"./useOnWindowResize\";\n\n/**\n * Creates a css variable `--vh` that is the calculated viewport height,\n * and updates it on window resize. This `--vh` value can be used instead of\n * default `vh` value to prevent layout issues on mobile devices\n * See: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/\n */\nfunction useSetDynamicVhValue() {\n useEffect(() => {\n // This useEffect was added to make sure vh is set on mount (even if there is no window resize)\n setVhVariable();\n }, []);\n\n useOnWindowResize(() => {\n setVhVariable();\n });\n\n function setVhVariable() {\n // a vh unit is equal to 1% of the screen height\n // eslint-disable-next-line no-magic-numbers\n document.documentElement.style.setProperty(\"--vh\", `${window.innerHeight * 0.01}px`);\n }\n}\n\nexport default useSetDynamicVhValue;\n","import Home from \"../home/Home\";\nimport useSetDynamicVhValue from \"../hooks/useSetDynamicVh\";\n\nfunction App() {\n useSetDynamicVhValue();\n\n return ;\n}\n\nexport default App;\n","const reportWebVitals = onPerfEntry => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import \"@hipo/react-ui-toolkit/dist/main.css\";\nimport \"./_index.scss\";\n\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport {ToastContextProvider} from \"@hipo/react-ui-toolkit\";\n\nimport App from \"./core/app/App\";\nimport reportWebVitals from \"./reportWebVitals\";\n\nReactDOM.render(\n \n \n \n \n ,\n document.getElementById(\"root\")\n);\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n","/* eslint-disable */\nimport algosdk, {SuggestedParams} from \"algosdk\";\nimport {apiGetTxnParams, ChainType} from \"../../../utils/algod/algod\";\n\nconst testAccounts = [\n algosdk.mnemonicToSecretKey(\n \"cannon scatter chest item way pulp seminar diesel width tooth enforce fire rug mushroom tube sustain glide apple radar chronic ask plastic brown ability badge\"\n ),\n algosdk.mnemonicToSecretKey(\n \"person congress dragon morning road sweet horror famous bomb engine eager silent home slam civil type melt field dry daring wheel monitor custom above term\"\n ),\n algosdk.mnemonicToSecretKey(\n \"faint protect home drink journey humble tube clinic game rough conduct sell violin discover limit lottery anger baby leaf mountain peasant rude scene abstract casual\"\n )\n];\n\nexport function signTxnWithTestAccount(txn: algosdk.Transaction): Uint8Array {\n const sender = algosdk.encodeAddress(txn.from.publicKey);\n\n for (const testAccount of testAccounts) {\n if (testAccount.addr === sender) {\n return txn.signTxn(testAccount.sk);\n }\n }\n\n throw new Error(`Cannot sign transaction from unknown test account: ${sender}`);\n}\n\nexport interface IScenarioTxn {\n txn: algosdk.Transaction;\n signers?: string[];\n authAddr?: string;\n message?: string;\n}\n\nexport type ScenarioReturnType = {\n transaction: IScenarioTxn[][];\n transactionTimeout?: number;\n};\n\nexport type Scenario = (chain: ChainType, address: string) => Promise;\n\nexport enum AssetTransactionType {\n Transfer = \"asset-transfer\",\n OptIn = \"asset-opt-in\",\n Close = \"asset-close\"\n}\n\nfunction getAssetIndex(chain: ChainType, type: AssetTransactionType): number {\n if (chain === ChainType.MainNet) {\n if (type === AssetTransactionType.Transfer) {\n return 604; // IanCoin\n } else if (type === AssetTransactionType.Close) {\n return 672; // RotemCoin\n } else {\n return 312769; // Tether USDt\n }\n }\n\n if (type === AssetTransactionType.Transfer) {\n return 11711; // HipoCoin\n } else if (type === AssetTransactionType.Close) {\n return 180132; // testasset2\n } else {\n return 135270; // Turkish Lira\n }\n}\n\nfunction getAppIndex(chain: ChainType): number {\n if (chain === ChainType.MainNet) {\n return 305162725;\n }\n\n if (chain === ChainType.TestNet) {\n return 22314999;\n }\n\n throw new Error(`App not defined for chain ${chain}`);\n}\n\nconst createAssetOptInTxn = async (\n chain: ChainType,\n address: string,\n assetIndex: number\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singlePayTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singlePayTxnWithClose: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singlePayTxnWithRekey: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singlePayTxnWithRekeyAndClose: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[2].addr,\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singlePayTxnWithInvalidAuthAddress: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [\n {txn, message: \"This is a transaction message\", authAddr: \"INVALID_ADDRESS\"}\n ];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAssetOptInTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAssetOptInTxnToInvalidAsset: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = 100;\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAssetTransferTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAssetTransferTxnWithClose: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleInvalidAssetTransferTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = 100; // Invalid asset id\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppOptIn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationOptInTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppOptInWithAppRekey: Scenario = async (\n chain: ChainType\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationOptInTxnFromObject({\n from: testAccounts[1].addr,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppCall: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppCallNoArgs: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppCallWithRekey: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppCloseOut: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationCloseOutTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppClearState: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationClearStateTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppCreate: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const approvalProgram = Uint8Array.from([4, 129, 1, 67]);\n const clearProgram = Uint8Array.from([3, 129, 1, 67]);\n\n const txn = algosdk.makeApplicationCreateTxnFromObject({\n from: address,\n approvalProgram,\n clearProgram,\n numGlobalInts: 1,\n numGlobalByteSlices: 2,\n numLocalInts: 3,\n numLocalByteSlices: 4,\n onComplete: algosdk.OnApplicationComplete.NoOpOC,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppCreateExtraPage: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const approvalProgram = Uint8Array.from([4, 129, 1, 67]);\n const clearProgram = Uint8Array.from([3, 129, 1, 67]);\n\n const txn = algosdk.makeApplicationCreateTxnFromObject({\n from: address,\n approvalProgram,\n clearProgram,\n numGlobalInts: 1,\n numGlobalByteSlices: 2,\n numLocalInts: 3,\n numLocalByteSlices: 4,\n extraPages: 1,\n onComplete: algosdk.OnApplicationComplete.NoOpOC,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppUpdate: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const approvalProgram = Uint8Array.from([4, 129, 1, 67]);\n const clearProgram = Uint8Array.from([3, 129, 1, 67]);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationUpdateTxnFromObject({\n from: address,\n appIndex,\n approvalProgram,\n clearProgram,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppDelete: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationDeleteTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst sign1FromGroupTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 1000000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn: txn1}, {txn: txn2, signers: []}];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst sign2FromGroupTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 1000000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 500000,\n note: new Uint8Array(Buffer.from(\"this is a payment txn\")),\n suggestedParams\n });\n\n const txnsToSign = [\n {txn: txn1},\n {txn: txn2, signers: []},\n {txn: txn3, message: \"This is a transaction message\"}\n ];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst signGroupWithPayOptinTransfer: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 500000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn: txn1}, {txn: txn2}, {txn: txn3}];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst signGroupWithPayRekey: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 500000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 500000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn: txn1}, {txn: txn2, message: \"This is a transaction message\"}];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst signTxnWithAssetClose: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n const closeAssetIndex = getAssetIndex(chain, AssetTransactionType.Close);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50,\n assetIndex: closeAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn: txn1}, {txn: txn2}];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst signTxnWithRekey: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn: txn1, message: \"This is a transaction message\"}, {txn: txn2}];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst signTxnWithRekeyAndAssetClose: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const closeAssetIndex = getAssetIndex(chain, AssetTransactionType.Close);\n const assetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n assetIndex,\n amount: 10,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 20,\n assetIndex: closeAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 30,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txn4 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 40,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [\n {txn: txn1, message: \"This is a transaction message\"},\n {txn: txn2},\n {txn: txn3},\n {txn: txn4, message: \"This is a transaction message\"}\n ];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst signGroupOf7: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const closeAssetIndex = getAssetIndex(chain, AssetTransactionType.Close);\n\n const optIn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const assetXfer = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const assetClose = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50,\n assetIndex: closeAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const payment = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 500000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const accountClose = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 0,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const accountRekey = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const accountRekeyAndClose = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [\n {txn: optIn},\n {txn: assetXfer},\n {txn: assetClose},\n {txn: payment},\n {txn: accountClose},\n {txn: accountRekey},\n {txn: accountRekeyAndClose}\n ];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst fullTxnGroup: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txnsToSign: Array<{txn: algosdk.Transaction; signers?: [string]}> = [];\n\n for (let i = 0; i < 8; i++) {\n const assetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const optIn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const closeOut = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n txnsToSign.push({txn: optIn});\n txnsToSign.push({txn: closeOut});\n }\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst multipleNonAtomicTxns: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"txn 3\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}];\n\n const group2 = [{txn: txn2, message: \"This is a transaction message\"}];\n\n const group3 = [{txn: txn3}];\n\n return {\n transaction: [group1, group2, group3]\n };\n};\n\nconst multipleNonAtomicTxnsForOnlyAssets: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 10000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 30000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}];\n\n const group2 = [{txn: txn2}];\n\n const group3 = [{txn: txn3, message: \"This is a transaction message\"}];\n\n return {\n transaction: [group1, group2, group3]\n };\n};\n\nconst multipleNonAtomicTxnsMixed: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 10000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}];\n\n const group2 = [{txn: txn2}];\n\n const group3 = [{txn: txn3}];\n\n return {\n transaction: [group1, group2, group3]\n };\n};\n\nconst atomicGroupAndNonAtomicTxnsForOnlyPayment: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"txn 3\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100004,\n note: new Uint8Array(Buffer.from(\"txn 4\")),\n suggestedParams\n });\n\n const group1 = [\n {txn: txn1, message: \"This is a transaction message\"},\n {txn: txn2, message: \"This is a transaction message\"}\n ];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3}];\n\n const group3 = [{txn: txn4}];\n\n return {\n transaction: [group1, group2, group3]\n };\n};\n\nconst atomicGroupAndNonAtomicTxnsMixed: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 10000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100004,\n note: new Uint8Array(Buffer.from(\"txn 4\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3, message: \"This is a transaction message\"}];\n\n const group3 = [{txn: txn4}];\n\n return {\n transaction: [group1, group2, group3]\n };\n};\n\nconst multipleAtomicGroupsForOnlyPayment: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 1\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100004,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 2\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3}, {txn: txn4}];\n algosdk.assignGroupID(group2.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst multipleAtomicGroupsForOnlyAssets: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 10000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 2000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}, {txn: txn2, signers: []}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3}, {txn: txn4, signers: []}];\n algosdk.assignGroupID(group2.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst multipleAtomicGroupsWithInvalidAsset: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const invalidAssetIndex = 100;\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 2000,\n assetIndex: invalidAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 1\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100004,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 2\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3}, {txn: txn4}];\n algosdk.assignGroupID(group2.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst multipleAtomicGroupsMixed1: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 10000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100004,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 2\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}, {txn: txn2, signers: []}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3}, {txn: txn4}];\n algosdk.assignGroupID(group2.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst multipleAtomicGroupsMixed2: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 2000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3, signers: []}, {txn: txn4}];\n algosdk.assignGroupID(group2.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst multipleAtomicGroupSignOnly2: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"txn 3\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100004,\n note: new Uint8Array(Buffer.from(\"txn 4\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1, signers: []}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3, signers: []}, {txn: txn4}];\n algosdk.assignGroupID(group2.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst atomicGroupAndNonAtomicTxnsSignOnly2: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"txn 3\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1, signers: []}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3}];\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst atomicNoSignTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"txn 3\")),\n suggestedParams\n });\n\n const group1 = [\n {txn: txn1, signers: []},\n {txn: txn2, signers: []},\n {txn: txn3, signers: []}\n ];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1]\n };\n};\n\nconst atomicAndSingleNoSignTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"txn 3\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}];\n\n const group2 = [{txn: txn2, message: \"This is a transaction message\"}];\n\n const group3 = [{txn: txn3, signers: []}];\n\n return {\n transaction: [group1, group2, group3]\n };\n};\n\nconst txnWithLargeNote: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"max length note (512)\" + \"!\".repeat(491))),\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst assetCreateTxnMaxInfoAndRekey: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject({\n from: address,\n decimals: 2,\n defaultFrozen: false,\n total: BigInt(\"0xffffffffffffffff\"),\n assetName: \"Example asset\",\n unitName: \"EX\",\n assetURL: \"https://example.com\",\n assetMetadataHash: new Uint8Array(\n Buffer.from(\n \"59fc007607ccc82d96f016857aaa697c545002d18045e49324696f12b7be8f45\",\n \"hex\"\n )\n ),\n manager: address,\n reserve: testAccounts[0].addr,\n clawback: testAccounts[1].addr,\n freeze: testAccounts[2].addr,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst assetCreateTxnMinInfo: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject({\n from: address,\n decimals: 0,\n defaultFrozen: false,\n total: 1,\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst assetReconfigTxnResetAll: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetConfigTxnWithSuggestedParamsFromObject({\n from: address,\n assetIndex: getAssetIndex(chain, AssetTransactionType.Transfer),\n clawback: address,\n freeze: testAccounts[0].addr,\n manager: testAccounts[1].addr,\n reserve: testAccounts[2].addr,\n strictEmptyAddressChecking: true,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst assetReconfigTxnClearAll: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetConfigTxnWithSuggestedParamsFromObject({\n from: address,\n assetIndex: getAssetIndex(chain, AssetTransactionType.Transfer),\n strictEmptyAddressChecking: false,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst assetDeleteTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetDestroyTxnWithSuggestedParamsFromObject({\n from: address,\n assetIndex: getAssetIndex(chain, AssetTransactionType.Transfer),\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst zeroFeeTxnGroup: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"txn with 0 fee\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"txn with double fee\")),\n suggestedParams\n });\n\n txn2.fee += txn1.fee;\n txn1.fee = 0;\n\n const group1 = [{txn: txn1, signers: []}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1]\n };\n};\n\nconst maxNumberOfTxns: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [];\n\n const numGroups = 4; // 64 / 16\n for (let i = 0; i < numGroups; i++) {\n const group: Array<{txn: algosdk.Transaction}> = [];\n for (let j = 0; j < 16; j++) {\n group.push({\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 0,\n note: new Uint8Array(Buffer.from(`No ${i * 16 + j + 1} of 64`)),\n suggestedParams\n })\n });\n }\n\n algosdk.assignGroupID(group.map((toSign) => toSign.txn));\n groups.push(group);\n }\n\n return {\n transaction: groups\n };\n};\n\nconst tooManyTxns: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [];\n\n const numGroups = 4; // 64 / 16\n for (let i = 0; i < numGroups; i++) {\n const group: Array<{txn: algosdk.Transaction}> = [];\n for (let j = 0; j < 16; j++) {\n group.push({\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 0,\n note: new Uint8Array(Buffer.from(`No ${i * 16 + j + 1} of 65`)),\n suggestedParams\n })\n });\n }\n\n algosdk.assignGroupID(group.map((toSign) => toSign.txn));\n groups.push(group);\n }\n\n // one more!\n groups.push([\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 0,\n note: new Uint8Array(Buffer.from(`No 65 of 65`)),\n suggestedParams\n })\n }\n ]);\n\n return {\n transaction: groups\n };\n};\n\nconst fiveHundredTxns: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [];\n\n const numGroups = 32; // 64 / 16\n for (let i = 0; i < numGroups; i++) {\n const group: Array<{txn: algosdk.Transaction}> = [];\n for (let j = 0; j < 16; j++) {\n group.push({\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 0,\n note: new Uint8Array(Buffer.from(`No ${i * 16 + j + 1} of 64`)),\n suggestedParams\n })\n });\n }\n\n algosdk.assignGroupID(group.map((toSign) => toSign.txn));\n groups.push(group);\n }\n\n return {\n transaction: groups\n };\n};\n\nconst futureTransaction: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const minutes = prompt(\"Please enter minutes for future transaction: \");\n const exactDate = new Date().getTime();\n const futureTrxDate = exactDate + Number(minutes) * 60000;\n\n const differenceInSeconds = Math.round((futureTrxDate - exactDate) / 1000);\n const blockRound = Math.abs(Math.round(differenceInSeconds / 4));\n\n const firstRoundFuture = suggestedParams.firstRound + blockRound;\n const lastRoundFuture = firstRoundFuture + 1000;\n\n const newSuggestedParams: SuggestedParams = {\n fee: suggestedParams.fee,\n firstRound: firstRoundFuture,\n lastRound: lastRoundFuture,\n genesisHash: suggestedParams.genesisHash,\n genesisID: suggestedParams.genesisID\n };\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"Example future transaction\")),\n suggestedParams: newSuggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n\n return {\n transaction: [txnsToSign],\n transactionTimeout: differenceInSeconds * 1000\n };\n};\n\nconst invalidGroupingIssue: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn5 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 1000000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn: txn1}, {txn: txn2}, {txn: txn3}, {txn: txn4}, {txn: txn5}];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n txnsToSign.pop();\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst appCallWithBoxes: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [],\n suggestedParams,\n boxes: [{appIndex: appIndex, name: Uint8Array.from([0])}]\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst invalidAuthAddress: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [\n {txn, message: \"This is a transaction message\", authAddr: \"INVALID_ADDRESS\"}\n ];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst validAuthAddress: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [\n {txn, message: \"This is a transaction message\", authAddr: testAccounts[1].addr}\n ];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst invalidSignerAddress: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [\n {txn, message: \"This is a transaction message\", signers: [\"INVALID_ADDRESS\"]}\n ];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst validSignerAddress: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [\n {\n txn,\n message: \"This is a transaction message\",\n signers: [address]\n }\n ];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst swapAlgoToUSDC: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: 31566704,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"NGIHJMECRSFHIEQDHBVTLR54K7DOZWM5M6UM3A5CIOYSP6H3QTGSHHGJCQ\",\n amount: 5000000,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 605929989,\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n })\n }\n ]\n ];\n\n groups[2][0].txn.fee = 2000;\n\n // Assign Group ID\n groups.forEach((txns) => algosdk.assignGroupID(txns.map((toSign) => toSign.txn)));\n\n return {\n transaction: groups\n };\n};\n\nconst swapAlgoToGoETH: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: 386195940,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"6NXX7RGJFLEI3HEQEZXDP73SMQKAPWS4N7CEQJ4IEVONUWYWJLT4NM5QQM\",\n amount: 3000000,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 607660059,\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n })\n }\n ]\n ];\n\n groups[2][0].txn.fee = 2000;\n\n // Assign Group ID\n groups.forEach((txns) => algosdk.assignGroupID(txns.map((toSign) => toSign.txn)));\n\n return {\n transaction: groups\n };\n};\n\nconst depositAlgoFF: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"AV6PFVXWDQ7RVNQYOEXCWXCLXVJ5V57WVMVQZ2TWH4EKTB7GSWKUIAUPXQ\",\n amount: 2000000,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 686498781,\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n })\n }\n ]\n ];\n\n groups[1][0].txn.fee = 3000;\n\n // Assign Group ID\n groups.forEach((txns) => algosdk.assignGroupID(txns.map((toSign) => toSign.txn)));\n\n return {\n transaction: groups\n };\n};\n\nconst poolAlgoUsdcFF: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: 919950894,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"KIW56KLIBX5UMWS5RT346TNA4HRV5H445S2LMQLRCR73SOHRVSM5TZBQ4A\",\n amount: 1160825,\n assetIndex: 31566704,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"KIW56KLIBX5UMWS5RT346TNA4HRV5H445S2LMQLRCR73SOHRVSM5TZBQ4A\",\n amount: 3977452,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_1\"))],\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_2\"))],\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_3\"))],\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_4\"))],\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_5\"))],\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_6\"))],\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_7\"))],\n suggestedParams\n })\n }\n ]\n ];\n\n groups[3][0].txn.fee = 29000;\n\n // Assign Group ID\n groups.forEach((txns) => algosdk.assignGroupID(txns.map((toSign) => toSign.txn)));\n\n return {\n transaction: groups\n };\n};\n\nconst authAlgoGems: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n note: new Uint8Array(Buffer.from(\"challenge/1449301/gems\")),\n suggestedParams\n })\n }\n ]\n ];\n\n return {\n transaction: groups\n };\n};\n\nconst buyNFTAlgogems: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: 886237574,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: \"N4EJ2ZFGWCEL4PVTCJSLD7RC4WVIUNO57V7LW2FQY7DFOP4EEN4XYC5UEM\",\n to: address,\n amount: 1,\n assetIndex: 886237574,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"RJASLRMECMQL66PH2KLMFSCYMOOBOK7KRX3XMAWDKDB2PQ5J3U5FMPAJNE\",\n amount: 3600000,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"VWZBFLBUN6O5A5W6IWHMDUVP5NH2LPV4ZYFMAHP4FQBBYP627MP6WPOEG4\",\n amount: 400000,\n suggestedParams\n })\n }\n ]\n ];\n\n // Assign Group ID\n groups.forEach((txns) => algosdk.assignGroupID(txns.map((toSign) => toSign.txn)));\n\n return {\n transaction: groups\n };\n};\n\nconst buyNFTAlgoxNFT: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: 865021507,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: \"CATN6JYGMBZF4OAQBXZTGALLB3X3XUUU6CQAKXUPNKVOC32VNTRWK25HD4\",\n to: address,\n amount: 1,\n assetIndex: 865021507,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"BSKX6GSPTSY2KKXBO5L367OBY5SJT6GD25FV3RY25VLOGCMORQ6COPCOXY\",\n amount: 196900,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"ANGEL3CMT7TEXSBJR3DCTJTZCQFOF6FJB6PDKU4IOAMTNPXGR7XUYKOU5Y\",\n amount: 18803950,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"XNFT36FUCFRR6CK675FW4BEBCCCOJ4HOSMGCN6J2W6ZMB34KM2ENTNQCP4\",\n amount: 689150,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"CATN6JYGMBZF4OAQBXZTGALLB3X3XUUU6CQAKXUPNKVOC32VNTRWK25HD4\",\n amount: 1000,\n suggestedParams\n })\n }\n ]\n ];\n\n // Assign Group ID\n groups.forEach((txns) => algosdk.assignGroupID(txns.map((toSign) => toSign.txn)));\n\n return {\n transaction: groups\n };\n};\n\nconst singleZoneTransferTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n assetIndex: 444035862,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\n// const notiboyGlobalOptIn: Scenario = async (\n// chain: ChainType,\n// address: string\n// ): Promise => {\n// const indexer = new algosdk.Indexer(\"\", \"https://mainnet-idx.algonode.cloud\", \"\");\n// const notiboy = new Notiboy(clientForChain(chain), indexer);\n// const userGlobalOptin = await notiboy.userContractOptin(address);\n// const transactions: IScenarioTxn[][] = [];\n// userGlobalOptin.map((txn) => {\n// transactions.push([{txn}]);\n// });\n\n// return {\n// transaction: transactions\n// };\n// };\n\n// const notiboyChannelOptIn: Scenario = async (\n// chain: ChainType,\n// address: string\n// ): Promise => {\n// const indexer = new algosdk.Indexer(\"\", \"https://mainnet-idx.algonode.cloud\", \"\");\n// const notiboy = new Notiboy(clientForChain(chain), indexer);\n// const channelOptinTxn = await notiboy.userChannelOptin(address, 1025363595);\n\n// return {\n// transaction: [[{txn: channelOptinTxn}]]\n// };\n// };\n\nexport const mainnetScenarios: Array<{name: string; scenario: Scenario}> = [\n {\n name: \"1. Swap Algo to USDC (algofi)\",\n scenario: swapAlgoToUSDC\n },\n {\n name: \"2. Swap Algo to GoETH (algofi)\",\n scenario: swapAlgoToGoETH\n },\n {\n name: \"3. Deposit Algo (folksfinance)\",\n scenario: depositAlgoFF\n },\n {\n name: \"4. Pool ALGO-USDC (folksfinance)\",\n scenario: poolAlgoUsdcFF\n },\n {\n name: \"5. Auth (algogems)\",\n scenario: authAlgoGems\n },\n {\n name: \"6. Buy NFT (algogems)\",\n scenario: buyNFTAlgogems\n },\n {\n name: \"7. Buy NFT (algoxnft)\",\n scenario: buyNFTAlgoxNFT\n },\n {\n name: \"8. Zone Transfer\",\n scenario: singleZoneTransferTxn\n },\n // {\n // name: \"9. Notiboy Global Optin\",\n // scenario: notiboyGlobalOptIn\n // },\n // {\n // name: \"10. Notiboy Channel Optin\",\n // scenario: notiboyChannelOptIn\n // }\n];\n\nexport const scenarios: Array<{name: string; scenario: Scenario}> = [\n {\n name: \"1. Sign single pay txn\",\n scenario: singlePayTxn\n },\n {\n name: \"2. Sign single pay txn with close\",\n scenario: singlePayTxnWithClose\n },\n {\n name: \"3. Sign single pay txn with rekey\",\n scenario: singlePayTxnWithRekey\n },\n {\n name: \"4. Sign single pay txn with rekey and close\",\n scenario: singlePayTxnWithRekeyAndClose\n },\n {\n name: \"5. Single pay txn with invalid auth address\",\n scenario: singlePayTxnWithInvalidAuthAddress\n },\n {\n name: \"6. Sign single asset opt-in txn\",\n scenario: singleAssetOptInTxn\n },\n {\n name: \"7. Sign single asset opt-in txn with invalid asset id\",\n scenario: singleAssetOptInTxnToInvalidAsset\n },\n {\n name: \"8. Sign single asset transfer txn\",\n scenario: singleAssetTransferTxn\n },\n {\n name: \"9. Sign single asset transfer txn with close\",\n scenario: singleAssetTransferTxnWithClose\n },\n {\n name: \"10. Sign single asset transfer txn with invalid asset id\",\n scenario: singleInvalidAssetTransferTxn\n },\n {\n name: \"11. Sign single app opt-in txn\",\n scenario: singleAppOptIn\n },\n {\n name: \"12. Sign single app call txn\",\n scenario: singleAppCall\n },\n {\n name: \"13. Sign single app call txn with rekey\",\n scenario: singleAppCallWithRekey\n },\n {\n name: \"14. Sign single app close out txn\",\n scenario: singleAppCloseOut\n },\n {\n name: \"15. Sign 1 of 2 txns from a group\",\n scenario: sign1FromGroupTxn\n },\n {\n name: \"16. Sign 2 of 3 txns from a group\",\n scenario: sign2FromGroupTxn\n },\n {\n name: \"17. Sign txn group with pay, asset opt-in, and asset transfer\",\n scenario: signGroupWithPayOptinTransfer\n },\n {\n name: \"18. Sign txn group with pay and rekey\",\n scenario: signGroupWithPayRekey\n },\n {\n name: \"19. Sign txn group with asset close\",\n scenario: signTxnWithAssetClose\n },\n {\n name: \"20. Sign txn group with rekey\",\n scenario: signTxnWithRekey\n },\n {\n name: \"21. Sign txn group with rekey and asset close\",\n scenario: signTxnWithRekeyAndAssetClose\n },\n {\n name: \"22. Sign group of 7\",\n scenario: signGroupOf7\n },\n {\n name: \"23. Full txn group\",\n scenario: fullTxnGroup\n },\n {\n name: \"24. Sign multiple non-atomic txns\",\n scenario: multipleNonAtomicTxns\n },\n {\n name: \"25. Sign multiple non-atomic txns for only assets\",\n scenario: multipleNonAtomicTxnsForOnlyAssets\n },\n {\n name: \"26. Sign mixed multiple non-atomic txns\",\n scenario: multipleNonAtomicTxnsMixed\n },\n {\n name: \"27. Sign atomic txn group and non-atomic txns for only payment\",\n scenario: atomicGroupAndNonAtomicTxnsForOnlyPayment\n },\n {\n name: \"28. Sign mixed atomic txn group and non-atomic txns\",\n scenario: atomicGroupAndNonAtomicTxnsMixed\n },\n {\n name: \"29. Sign multiple atomic txn groups for only payment\",\n scenario: multipleAtomicGroupsForOnlyPayment\n },\n {\n name: \"30. Sign multiple atomic txn groups for only assets\",\n scenario: multipleAtomicGroupsForOnlyAssets\n },\n {\n name: \"31. Sign multiple atomic txn groups with invalid asset\",\n scenario: multipleAtomicGroupsWithInvalidAsset\n },\n {\n name: \"32. Sign first mixed 2 atomic txn groups\",\n scenario: multipleAtomicGroupsMixed1\n },\n {\n name: \"33. Sign second mixed 2 atomic txn groups\",\n scenario: multipleAtomicGroupsMixed2\n },\n {\n name: \"34. Sign only 2 txns in multiple atomic txn groups\",\n scenario: multipleAtomicGroupSignOnly2\n },\n {\n name: \"35. Sign only 2 txns in atomic txn group and non-atomic txns\",\n scenario: atomicGroupAndNonAtomicTxnsSignOnly2\n },\n {\n name: \"36. Atomic group with no sig needed (invalid)\",\n scenario: atomicNoSignTxn\n },\n {\n name: \"37. Atomic group and single txn with no sig needed (invalid)\",\n scenario: atomicAndSingleNoSignTxn\n },\n {\n name: \"38. Txn with large note\",\n scenario: txnWithLargeNote\n },\n {\n name: \"39. Sign single app clear state txn\",\n scenario: singleAppClearState\n },\n {\n name: \"40. Sign single app create txn\",\n scenario: singleAppCreate\n },\n {\n name: \"41. Sign single app update txn\",\n scenario: singleAppUpdate\n },\n {\n name: \"42. Sign single app delete txn\",\n scenario: singleAppDelete\n },\n {\n name: \"43. Sign single app call with no args\",\n scenario: singleAppCallNoArgs\n },\n {\n name: \"44. Sign single app create txn with extra page (not working with ledger app v1.2.15)\",\n scenario: singleAppCreateExtraPage\n },\n {\n name: \"45. Sign asset create + rekey txn\",\n scenario: assetCreateTxnMaxInfoAndRekey\n },\n {\n name: \"46. Sign asset create txn with minimal info\",\n scenario: assetCreateTxnMinInfo\n },\n {\n name: \"47. Sign asset reconfig txn\",\n scenario: assetReconfigTxnResetAll\n },\n {\n name: \"48. Sign asset reconfig txn clear all\",\n scenario: assetReconfigTxnClearAll\n },\n {\n name: \"49. Sign asset delete txn\",\n scenario: assetDeleteTxn\n },\n {\n name: \"50. Sign txn group with 0 fee\",\n scenario: zeroFeeTxnGroup\n },\n {\n name: \"51. Sign 64 transactions\",\n scenario: maxNumberOfTxns\n },\n {\n name: \"52. Sign 65 transactions\",\n scenario: tooManyTxns\n },\n {\n name: \"53. Future transaction\",\n scenario: futureTransaction\n },\n {\n name: \"54. Invalid Grouping issue\",\n scenario: invalidGroupingIssue\n },\n {\n name: \"55. Application txn with boxes\",\n scenario: appCallWithBoxes\n },\n {\n name: \"56. Invalid auth address\",\n scenario: invalidAuthAddress\n },\n {\n name: \"57. Valid auth address\",\n scenario: validAuthAddress\n },\n {\n name: \"58. Invalid signers\",\n scenario: invalidSignerAddress\n },\n {\n name: \"59. Valid signers\",\n scenario: validSignerAddress\n },\n {\n name: \"60. 512 Transactions\",\n scenario: fiveHundredTxns\n },\n {\n name: \"61. Sign single app opt-in with rekey\",\n scenario: singleAppOptInWithAppRekey\n }\n];\n\nexport {createAssetOptInTxn};\n","import {FetcherErrorStatus} from \"./fetcherTypes\";\n\nclass FetcherError extends Error {\n data: any;\n type: FetcherErrorStatus;\n statusCode: number;\n\n constructor(\n options: {\n type: FetcherErrorStatus;\n data: any;\n message: string;\n statusCode: number;\n },\n ...args: any[]\n ) {\n super(...args);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, FetcherError);\n }\n\n this.name = \"FetcherError\";\n this.type = options.type;\n this.data = options.data;\n this.message = options.message;\n this.statusCode = options.statusCode;\n }\n}\n\nexport default FetcherError;\n","function fetchJSONMiddleware(response: globalThis.Response) {\n return response.json().catch((error) => {\n console.error(\"Response may not support `json` conversion, so suppress the error\");\n console.error(error);\n return {};\n });\n}\n\nexport {fetchJSONMiddleware};\n","import {isRecord} from \"../../utils/object/objectUtils\";\nimport {stringifySearchParams} from \"../../utils/url/urlUtils\";\nimport FetcherError from \"./FetcherError\";\nimport {FetcherConfig, FetcherMiddleware} from \"./fetcherTypes\";\nimport {fetchJSONMiddleware} from \"./fetcherUtils\";\n\nclass Fetcher {\n readonly config: FetcherConfig;\n\n constructor(config: FetcherConfig) {\n this.config = {\n responseMiddlewares: [fetchJSONMiddleware],\n rejectMiddlewares: [],\n ...config,\n initOptions: {\n ...(config?.initOptions || {})\n }\n };\n }\n\n run(\n options: Omit & {\n method: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\" | \"OPTIONS\";\n params?: Record;\n responseMiddlewares?: FetcherMiddleware[];\n rejectMiddlewares?: FetcherMiddleware[];\n body?: any;\n bodyParser?: (body: any) => any;\n },\n path: string\n ): Promise {\n const {baseUrl, initOptions, bodyParser: bodyParserFromConfig} = this.config;\n const {\n params,\n responseMiddlewares,\n rejectMiddlewares,\n body,\n bodyParser: bodyParserFromOptions,\n ...otherOptions\n } = options;\n\n const bodyParser = bodyParserFromOptions || bodyParserFromConfig;\n\n const url =\n isRecord(params) && Object.keys(params).length\n ? `${baseUrl}${path}?${stringifySearchParams(params)}`\n : `${baseUrl}${path}`;\n\n const promise = fetch(url, {\n body: bodyParser ? bodyParser(body) : body,\n ...initOptions,\n ...otherOptions\n });\n\n return promise\n .catch((error) => {\n if (error.name === \"AbortError\") {\n return Promise.reject(\n new FetcherError({\n type: \"Cancelled\",\n data: error,\n message: \"Request cancelled\",\n statusCode: NaN\n })\n );\n }\n\n return Promise.reject(\n new FetcherError({\n type: \"ConnectionError\",\n data: error,\n message: \"Network error. Try again later.\",\n statusCode: NaN\n })\n );\n })\n .then((response) => {\n if (response.ok) {\n return Promise.resolve(response);\n }\n\n return Promise.reject(response);\n })\n .then(async (response) => {\n const middlewares = responseMiddlewares || this.config.responseMiddlewares;\n let final = response;\n\n if (middlewares) {\n for (const middleware of middlewares) {\n final = await middleware(final);\n }\n }\n\n return final as unknown as Promise;\n })\n .catch(async (errorResponse) => {\n if (errorResponse.status === \"Cancelled\") {\n return Promise.reject(errorResponse);\n }\n\n const middlewares = rejectMiddlewares || this.config.rejectMiddlewares;\n let finalError;\n\n try {\n const errorResponseJSON = await errorResponse.json();\n\n finalError = new FetcherError({\n statusCode: errorResponse.status,\n type: errorResponseJSON?.type || \"ApiError\",\n data: errorResponseJSON,\n message:\n // TODO: generateErrorMessage(errorResponseJSON) ||\n `${otherOptions.method} ${url} request failed`\n });\n } catch {\n finalError = new FetcherError({\n statusCode: errorResponse.status,\n type: \"ApiError\",\n data: errorResponse,\n message:\n // TODO: generateErrorMessage(errorResponse) ||\n `${otherOptions.method} ${url} request failed`\n });\n }\n\n if (middlewares) {\n for (const middleware of middlewares) {\n finalError = await middleware(finalError);\n }\n }\n\n return Promise.reject(finalError);\n });\n }\n}\n\nexport default Fetcher;\n","import Fetcher from \"../../../network/fetcher/Fetcher\";\nimport {FetcherConfig} from \"../../../network/fetcher/fetcherTypes\";\nimport {ChainType} from \"../../algod/algod\";\n\nconst PERA_API_URLS = {\n mainnet: \"https://mainnet.api.perawallet.app/v1/\",\n testnet: \"https://testnet.api.perawallet.app/v1/\"\n};\n\nconst PERA_API_DEFAULT_OPTIONS: Omit = {\n initOptions: {\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n }\n },\n bodyParser: JSON.stringify\n};\n\nfunction getPeraApiBaseURLForNetwork(network: ChainType) {\n return network === ChainType.MainNet ? PERA_API_URLS.mainnet : PERA_API_URLS.testnet;\n}\n\nclass PeraApiManager {\n fetcher: Fetcher;\n\n constructor(network: ChainType) {\n this.fetcher = new Fetcher({\n baseUrl: getPeraApiBaseURLForNetwork(network),\n ...PERA_API_DEFAULT_OPTIONS\n });\n }\n\n updateFetcher(network: ChainType) {\n this.fetcher = new Fetcher({\n baseUrl: getPeraApiBaseURLForNetwork(network),\n ...PERA_API_DEFAULT_OPTIONS\n });\n }\n}\n\nconst peraApiManager = new PeraApiManager(ChainType.TestNet);\n\nexport default peraApiManager;\n","/**\n * Omits provided fields from main object\n * @param obj Target object\n * @param keys Keys to omit from obj\n */\nfunction omitKeys(obj: T, ...keys: K[]) {\n const newObj: {[x: string]: any} = {};\n\n Object.keys(obj).forEach((key) => {\n // @ts-ignore 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.\n // couldn't solve this issue\n if (!keys.includes(key)) {\n newObj[key as string] = obj[key];\n }\n });\n\n return newObj as Omit;\n}\n\n/**\n * Checks the given value if the value is object and not an array or null.\n * @param {unknown} x The value to check.\n * @returns {boolean} Returns `true` if `value` is an object and not an array or null, else returns `false`.\n * @example\n *\n * isRecord({})\n * // => true\n *\n * isRecord({a: \"1\"})\n * // => true\n *\n * isRecord(new Foo);\n * // => true\n *\n * isRecord([1, 2, 3])\n * // => false\n *\n * isRecord(Function)\n * // => false\n *\n * isRecord(null)\n * // => false\n */\nfunction isRecord(x: unknown): x is Record {\n return typeof x === \"object\" && Boolean(x) && !Array.isArray(x);\n}\n\nexport {omitKeys, isRecord};\n","/**\n * Initiates URLSearchParams with the provided params object and stringifies it\n * @param {object} params A params object.\n * @returns {string} Stringified search string\n * @example\n *\n * stringifySearchParams({a: \"123\"})\n * // => \"a=123\"\n *\n * stringifySearchParams({a: 1, b: \"test\", c: true})\n * // => \"a=1&b=test&c=true\"\n */\nfunction stringifySearchParams>(params: Params) {\n return new URLSearchParams(params).toString();\n}\n\n/**\n * Converts query string into a params object (all values of the object are strings).\n * @param {string} search Url query string\n * @return {object} Query params object\n */\nfunction getSearchParams>(search: string) {\n return Object.fromEntries(new URLSearchParams(search).entries()) as unknown as T;\n}\n\nexport {stringifySearchParams, getSearchParams};\n","import {useLayoutEffect} from \"react\";\n\nfunction useOnUnmount(callback?: VoidFunction) {\n useLayoutEffect(() => {\n return () => {\n if (callback) {\n callback();\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n\nexport default useOnUnmount;\n","import {useCallback, useEffect, useRef, useState} from \"react\";\n\nimport useOnUnmount from \"../useOnUnmount/useOnUnmount\";\n\nconst DEFAULT_INITIAL_ASYNC_PROCESS_STATE: AsyncProcessState = {\n isPending: false,\n isFetched: false,\n data: null,\n error: null\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint\nfunction useAsyncProcess(options?: UseAsyncProcessOptions) {\n const {initialState, shouldResetDataWhenPending = true} = options || {};\n const [asyncState, setAsyncState] = useState>(\n initialState || DEFAULT_INITIAL_ASYNC_PROCESS_STATE\n );\n const latestDataRef = useRef(asyncState.data);\n const isUnmountedRef = useRef(false);\n const asyncStateSetter = useCallback>(\n (state) => (isUnmountedRef.current ? () => undefined : setAsyncState(state)),\n []\n );\n\n const runAsyncProcess: AsyncProcessCallBack = useCallback(\n (promise, responseSerializer) => {\n asyncStateSetter({\n isPending: true,\n isFetched: false,\n data: shouldResetDataWhenPending ? null : latestDataRef.current,\n error: null\n });\n\n promise\n .then((response) => {\n asyncStateSetter({\n isPending: false,\n isFetched: true,\n data: responseSerializer ? responseSerializer(response) : response,\n error: null\n });\n })\n .catch((error) => {\n asyncStateSetter({\n isPending: false,\n isFetched: true,\n data: null,\n error\n });\n });\n\n return promise;\n },\n [asyncStateSetter, shouldResetDataWhenPending]\n );\n\n useEffect(() => {\n latestDataRef.current = asyncState.data;\n }, [asyncState.data]);\n\n useOnUnmount(() => {\n isUnmountedRef.current = true;\n });\n\n return {\n state: asyncState,\n setState: asyncStateSetter,\n runAsyncProcess\n };\n}\n\nexport {DEFAULT_INITIAL_ASYNC_PROCESS_STATE};\nexport default useAsyncProcess;\n","import peraApiManager from \"./peraApiManager\";\n\nconst PERA_API_PAGINATED_RESPONSE_LIMIT = 50;\n\nexport interface Asset {\n asset_id: number;\n name: string;\n unit_name: string;\n}\n\nconst peraApi = {\n getAssets(params?: ListRequestParams, options?: {signal: AbortSignal}) {\n return peraApiManager.fetcher.run>(\n {method: \"GET\", params, signal: options?.signal},\n \"assets/\"\n );\n }\n};\n\nexport default peraApi;\nexport {PERA_API_PAGINATED_RESPONSE_LIMIT};\n"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/main.8957c232.chunk.js b/static/js/main.8957c232.chunk.js new file mode 100644 index 0000000..c47dc77 --- /dev/null +++ b/static/js/main.8957c232.chunk.js @@ -0,0 +1,2 @@ +(this["webpackJsonppera-demo-dapp"]=this["webpackJsonppera-demo-dapp"]||[]).push([[0],{11:function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"c",(function(){return i})),n.d(t,"b",(function(){return m}));var a,r=n(0),s=n(7),o=n(6);!function(e){e.MainNet="mainnet",e.TestNet="testnet"}(a||(a={}));var c=new o.default.Algodv2("","https://mainnet-api.algonode.cloud",""),u=new o.default.Algodv2("","https://testnet-api.algonode.cloud","");function i(e){switch(e){case a.MainNet:return c;case a.TestNet:return u;default:throw new Error("Unknown chain type: ".concat(e))}}function m(e){return d.apply(this,arguments)}function d(){return(d=Object(s.a)(Object(r.a)().mark((function e(t){var n;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i(t).getTransactionParams().do();case 2:return n=e.sent,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},121:function(e,t,n){"use strict";(function(e){var a=n(0),r=n(7),s=n(17),o=n(12),c=n(10),u=n(6),i=n(49),m=n(11),d=n(124),f=n(123),l=n(8);t.a=function(t){var n=t.accountAddress,p=t.peraWallet,b=t.handleSetLog,g=t.chain,x=t.refecthAccountDetail,j=Object(o.useState)(!1),O=Object(s.a)(j,2),h=O[0],v=O[1],y=Object(f.a)(),T=y.isModalOpen,P=y.openModal,w=y.closeModal;return Object(l.jsxs)(l.Fragment,{children:[Object(l.jsx)(c.Button,{customClassName:"app__button--connect",onClick:P,children:"Create Transaction"}),Object(l.jsx)(d.a,{chain:g,peraWallet:p,address:n,isOpen:T,onClose:w}),Object(l.jsxs)("div",{style:{marginTop:"45px"},children:[Object(l.jsx)("h3",{children:"Mainnet only, do not sign!"}),g===m.a.TestNet&&Object(l.jsx)("small",{children:"Switch to MainNet to see txns"}),Object(l.jsx)(c.List,{items:i.b,customClassName:"app__actions",children:function(e){return Object(l.jsx)(c.ListItem,{children:Object(l.jsx)(c.Button,{customClassName:"app__button",onClick:function(){return I(e.scenario,e.name)},shouldDisplaySpinner:h,isDisabled:h,children:h?"Loading...":e.name})})}})]}),Object(l.jsxs)("div",{style:{marginTop:"45px"},children:[Object(l.jsx)("h3",{children:"Both Networks"}),Object(l.jsx)(c.List,{items:i.c,customClassName:"app__actions",children:function(e){return Object(l.jsx)(c.ListItem,{children:Object(l.jsx)(c.Button,{customClassName:"app__button",onClick:function(){return I(e.scenario,e.name)},shouldDisplaySpinner:h,isDisabled:h,children:h?"Loading...":e.name})})}}),Object(l.jsxs)("div",{style:{display:"flex",gap:"20px"},children:[Object(l.jsx)(c.Button,{customClassName:"app__button",style:{width:"160px"},onClick:function(){return A.apply(this,arguments)},shouldDisplaySpinner:h,isDisabled:h,children:h?"Loading...":"Sign Single Arbitrary Data"}),Object(l.jsx)(c.Button,{customClassName:"app__button",style:{width:"160px"},onClick:function(){return k.apply(this,arguments)},shouldDisplaySpinner:h,isDisabled:h,children:h?"Loading...":"Sign Multiple Arbitrary Data"})]})]})]});function A(){return(A=Object(r.a)(Object(a.a)().mark((function t(){var n;return Object(a.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=[{data:new Uint8Array(e.from("timestamp//".concat(Date.now()))),message:"Timestamp confirmation"}],t.next=3,F(n);case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function k(){return(k=Object(r.a)(Object(a.a)().mark((function t(){var n;return Object(a.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=[{data:new Uint8Array(e.from("timestamp//".concat(Date.now()))),message:"Timestamp confirmation"},{data:new Uint8Array(e.from("agent//".concat(navigator.userAgent))),message:"User agent confirmation"}],t.next=3,F(n);case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function F(e){return S.apply(this,arguments)}function S(){return(S=Object(r.a)(Object(a.a)().mark((function e(t){var r;return Object(a.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,p.signData(t,n);case 3:r=e.sent,t.forEach((function(e,t){var a=u.default.verifyBytes(e.data,r[t],n);console.log({data:e,signedData:r[t],isVerified:a}),a||b("Arbitrary data did not match with signed data!")})),console.log({signedData:r}),b("Data signed successfully"),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(0),console.log(e.t0),b("".concat(e.t0));case 13:case"end":return e.stop()}}),e,null,[[0,9]])})))).apply(this,arguments)}function I(e,t){return U.apply(this,arguments)}function U(){return(U=Object(r.a)(Object(a.a)().mark((function e(t,s){var o,c,u,i,d,f;return Object(a.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return v(!0),e.prev=1,e.next=4,t(g,n);case 4:return o=e.sent,c=o.transaction,u=o.transactionTimeout,i=c.reduce((function(e,t){return e.concat(t)}),[]),e.next=10,p.signTransaction([i]);case 10:if(d=e.sent,console.log({transactions:i,signedTransactions:d}),b("Transaction signed successfully: ".concat(s)),!u){e.next=17;break}setTimeout(Object(r.a)(Object(a.a)().mark((function e(){return Object(a.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(m.c)(g).sendRawTransaction(d).do();case 2:b("Transaction sended network: ".concat(s));case 3:case"end":return e.stop()}}),e)}))),u),e.next=25;break;case 17:f=0;case 18:if(!(f=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function p(e,t){var n=e.title,r=e.titleId,s=l(e,d);return m.createElement("svg",f({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:t,"aria-labelledby":r},s),n?m.createElement("title",{id:r},n):null,a||(a=m.createElement("path",{d:"M20 4L4 20M20 20L4 4",stroke:"#0A0A0A",strokeWidth:1.5})))}var b=m.forwardRef(p),g=(n.p,n(178),n(6)),x=n(10),j=n(41),O=(n(179),n(61)),h=n.n(O),v=n(18),y=n.n(v),T=n(8),P=["customClassName","children","closeTimeoutMS","shouldCloseOnOverlayClick","shouldCloseOnEsc","bodyOpenClassName","onClose","shouldPreventScrollOnOverlay","isOpen"],w=2e3*parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--modal-transition-duration").trim()||"0.2");function A(){return document.querySelector("#modal-root")}h.a.defaultStyles={},h.a.setAppElement("#root");var k=function(e){var t=e.customClassName,n=e.children,a=e.closeTimeoutMS,r=void 0===a?w:a,s=e.shouldCloseOnOverlayClick,o=void 0===s||s,c=e.shouldCloseOnEsc,i=void 0!==c&&c,d=e.bodyOpenClassName,f=e.onClose,l=e.shouldPreventScrollOnOverlay,p=void 0===l||l,b=e.isOpen,g=Object(j.a)(e,P);return Object(m.useEffect)((function(){return p&&b&&(document.body.style.overflow="hidden"),function(){p&&(document.body.style.overflow="unset")}}),[b,p]),Object(T.jsx)("div",{style:{position:"absolute"},onClick:function(e){return e.stopPropagation()},children:Object(T.jsx)(h.a,Object(u.a)(Object(u.a)({parentSelector:A,isOpen:b,className:y()("modal",t),onRequestClose:function(e){f&&(o||i)&&f(e)},closeTimeoutMS:r,bodyOpenClassName:y()("ReactModal__Body--open",d),shouldCloseOnOverlayClick:o,shouldCloseOnEsc:i},g),{},{children:n}))})},F=n(11),S=n(122);var I=[{id:"pay",title:"pay"},{id:"axfer",title:"axfer"},{id:"keyreg",title:"keyreg"},{id:"acfg",title:"acfg"}],U=[{id:"create",content:"Create"},{id:"modify",content:"Modify"},{id:"destroy",content:"Destroy"}];t.a=function(e){var t=e.chain,n=e.address,a=e.isOpen,d=e.onClose,f=e.peraWallet,l=Object(m.useState)([]),p=Object(i.a)(l,2),j=p[0],O=p[1],h=Object(m.useState)({id:"pay",title:"pay"}),v=Object(i.a)(h,2),y=v[0],P=v[1],w=Object(m.useState)({address:n,toAddress:"",amount:"",note:"",assetIndex:"",rekeyTo:"",closeTo:"",transactionAmount:1,assetTxnType:"create"}),A=Object(i.a)(w,2),C=A[0],W=A[1],N=Object(m.useState)(!1),D=Object(i.a)(N,2),M=D[0],_=D[1];return Object(T.jsxs)(k,{customClassName:"create-txn",contentLabel:"Create Txn Modal",isOpen:a,onClose:d,children:[Object(T.jsx)(b,{onClick:d,className:"modal__close",width:24,height:24}),Object(T.jsx)("h3",{style:{marginBottom:"10px"},children:"Create Transaction"}),Object(T.jsx)(x.FormField,{label:"Transaction Type",children:Object(T.jsx)(x.Dropdown,{customClassName:"app__header__chain-select-dropdown",role:"menu",options:I,selectedOption:y,onSelect:function(e){P(e)},hasDeselectOption:!1})}),Object(T.jsx)(x.FormField,{label:"From Address",children:Object(T.jsx)(x.Input,{value:n,name:"from",isDisabled:!0,onChange:function(){return console.log("a")}})}),function(){switch(null===y||void 0===y?void 0:y.id){case"pay":return Object(T.jsxs)(T.Fragment,{children:[Object(T.jsx)(x.FormField,{label:"To Address",children:Object(T.jsx)(x.Input,{value:C.toAddress,name:"to",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{toAddress:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Amount (on microAlgos)",children:Object(T.jsx)(x.Input,{value:C.amount,name:"amount",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{amount:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Rekey To",children:Object(T.jsx)(x.Input,{value:C.rekeyTo,name:"rekeyto",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{rekeyTo:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Close To",children:Object(T.jsx)(x.Input,{value:C.closeTo,name:"closeTo",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{closeTo:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Note",children:Object(T.jsx)(x.Textarea,{value:C.note,name:"note",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{note:e.currentTarget.value}))}})})]});case"axfer":return Object(T.jsxs)(T.Fragment,{children:[Object(T.jsx)(x.FormField,{label:"To Address",children:Object(T.jsx)(x.Input,{value:C.toAddress,name:"to",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{toAddress:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Asset Index",children:Object(T.jsx)(x.Input,{value:C.assetIndex,name:"assetIndex",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{assetIndex:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Amount (on microAlgos)",children:Object(T.jsx)(x.Input,{value:C.amount,name:"amount",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{amount:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Rekey To",children:Object(T.jsx)(x.Input,{value:C.rekeyTo,name:"rekeyto",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{rekeyTo:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Close To",children:Object(T.jsx)(x.Input,{value:C.closeTo,name:"closeTo",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{closeTo:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Note",children:Object(T.jsx)(x.Textarea,{value:C.note,name:"note",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{note:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Transaction Amount (optional)",children:Object(T.jsx)(x.Input,{value:C.transactionAmount,name:"transactionAmount",type:"number",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{transactionAmount:Number(e.currentTarget.value)}))}})})]});case"keyreg":return Object(T.jsxs)(T.Fragment,{children:[Object(T.jsx)(x.FormField,{label:"".concat(C.isOnlineKeyregTxn?"Online":"Offline"," Keyreg Transaction"),children:Object(T.jsx)(x.Switch,{isToggledOn:C.isOnlineKeyregTxn||!1,onToggle:function(){return W(Object(u.a)(Object(u.a)({},C),{},{isOnlineKeyregTxn:!C.isOnlineKeyregTxn}))}})}),Object(T.jsx)(x.FormField,{label:"Rekey To (optional)",children:Object(T.jsx)(x.Input,{value:C.rekeyTo,name:"rekeyto",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{rekeyTo:e.currentTarget.value}))}})}),C.isOnlineKeyregTxn&&Object(T.jsxs)(T.Fragment,{children:[Object(T.jsx)(x.FormField,{label:"Vote Key",children:Object(T.jsx)(x.Input,{value:C.voteKey,name:"voteKey",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{voteKey:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Selection Key",children:Object(T.jsx)(x.Input,{value:C.selectionKey,name:"selectionKey",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{selectionKey:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"State Proof Key",children:Object(T.jsx)(x.Input,{value:C.stateProofKey,name:"stateProofKey",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{stateProofKey:e.currentTarget.value}))}})}),Object(T.jsx)(x.FormField,{label:"Vote First",children:Object(T.jsx)(x.Input,{value:C.voteFirst,name:"voteFirst",type:"number",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{voteFirst:Number(e.currentTarget.value)}))}})}),Object(T.jsx)(x.FormField,{label:"Vote Last",children:Object(T.jsx)(x.Input,{value:C.voteLast,name:"voteLast",type:"number",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{voteLast:Number(e.currentTarget.value)}))}})}),Object(T.jsx)(x.FormField,{label:"Vote Key Dilution",children:Object(T.jsx)(x.Input,{value:C.voteKeyDilution,name:"voteKeyDilution",type:"number",onChange:function(e){return W(Object(u.a)(Object(u.a)({},C),{},{voteKeyDilution:Number(e.currentTarget.value)}))}})})]})]});case"acfg":return Object(T.jsx)(T.Fragment,{children:Object(T.jsx)(x.Tab,{items:U,initialActiveTabIndex:0,customClassName:"create-txn__asset-tab",onTabChange:E,children:R()})});default:return null}}(),Object(T.jsx)(x.FormField,{label:"Send Blockchain",children:Object(T.jsx)(x.Switch,{onToggle:function(){_(!M)},isToggledOn:M})}),j.length>0&&Object(T.jsx)(x.List,{items:j,children:function(e,t,n){return Object(T.jsx)(x.ListItem,{children:"Txn ".concat((n||0)+1," type: ").concat(e.txn.type)})}}),Object(T.jsx)(S.a,{txnForm:C,type:y.id,chain:t,onResetForm:function(){W(Object(u.a)(Object(u.a)({},C),{},{toAddress:"",amount:"",note:"",assetIndex:"",rekeyTo:"",closeTo:"",transactionAmount:1}))},onSetTransactions:function(e){O([].concat(Object(c.a)(j),Object(c.a)(e)))}}),Object(T.jsx)(x.Button,{onClick:function(){try{var e,t=function(e,t){for(var n=[],a=e.length/t,r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=t.locale,a=void 0===n?O:n,r=Object(g.a)(t,j),s=r,o="currency"===s.style,c="shorten-large-numbers"===s.style;s=o?Object(b.a)({currency:"USD",maximumFractionDigits:5,minimumFractionDigits:2,currencyDisplay:"narrowSymbol"},r):c?Object(b.a)({maximumFractionDigits:2,minimumFractionDigits:0,style:"decimal"},Object(x.b)(r,"style")):Object(b.a)({maximumFractionDigits:5,minimumFractionDigits:2,style:"decimal"},r);try{e=new Intl.NumberFormat(a||[navigator.language,"en-GB"],s)}catch(u){if(e={format:function(e){return e.toLocaleString()}},o)try{s.currencyDisplay="symbol",e=new Intl.NumberFormat(a||[navigator.language,"en-GB"],s)}catch(i){console.error({currencyFormattingError:i})}}return function(t){var n="";return Object.is(t,NaN)||(n=c?t>=Math.pow(10,9)?"".concat(e.format(t/Math.pow(10,9)),"b"):t>=Math.pow(10,6)?"".concat(e.format(t/Math.pow(10,6)),"m"):t>=Math.pow(10,3)?"".concat(e.format(t/Math.pow(10,3)),"k"):e.format(t):e.format(t)),n&&"USD"===s.currency&&(n=n.replace("US$","$")),n}}({minimumFractionDigits:2})(Object(l.microalgosToAlgos)(Number(e.amount)))," ALGO")}var v="PeraWallet.Wallet",y="CompactMode";function T(){var e,t=null===(e="undefined"===typeof localStorage?void 0:localStorage)||void 0===e?void 0:e.getItem(v);return t?JSON.parse(t):null}var P=n(8);var w=function(e){var t,n=e.accountInformation,a=e.chain,r=T();return Object(P.jsxs)("div",{children:[Object(P.jsxs)("div",{className:"app__account-address",children:[Object(P.jsx)("b",{className:"app__text-purple",children:"Connected to: "}),(t=n.address,"".concat(t.substring(0,8),"...").concat(t.substring(t.length-4)))]}),Object(P.jsxs)("div",{className:"app__account-address",children:[Object(P.jsx)("b",{className:"app__text-purple",children:"Chain: "}),a.toUpperCase()]}),Object(P.jsxs)("div",{className:"app__account-address",children:[Object(P.jsx)("b",{className:"app__text-purple",children:"Wallet Type: "}),null===r||void 0===r?void 0:r.type]}),n&&Object(P.jsxs)("div",{className:"app__account-address",children:[Object(P.jsx)("b",{className:"app__text-purple",children:"Balance: "}),h(n)]})]})},A=n(121),k=(n(191),n(18)),F=n.n(k);var S=function(e){var t=e.message,n=e.customClassName;return Object(P.jsx)("div",{className:F()("pera-toast",n),children:Object(P.jsx)("div",{children:t})})},I=n(60);var U=function(e){var t=e.chain,n=e.accountAddress,r=Object(I.a)(),s=r.state,o=r.runAsyncProcess,u=Object(c.useToaster)().display,i=Object(a.useCallback)((function(){if(t&&n)try{o(function(e,t){return new Promise((function(n,a){try{n(Object(p.c)(e).accountInformation(t).do())}catch(r){a(r)}}))}(t,n))}catch(e){u({render:function(){return Object(P.jsx)(S,{message:e})}})}}),[n,t,u,o]);return Object(a.useEffect)((function(){i()}),[i]),{accountInformationState:s,refetchAccountDetail:i}},C=n(49),W=n(50),N=localStorage.getItem(y),D=new d.PeraWalletConnect({compactMode:"true"===N}),M=new f.a({optInEnabled:!0});var _=function(){var e=Object(a.useState)(p.a.TestNet),t=Object(m.a)(e,2),n=t[0],r=t[1],s=Object(a.useState)({id:"testnet",title:"TestNet"}),o=Object(m.a)(s,2),f=o[0],l=o[1],b=Object(a.useState)(null),g=Object(m.a)(b,2),x=g[0],j=g[1],O=!!x,h=Object(c.useToaster)().display,v=U({chain:n,accountAddress:x||""}),T=v.accountInformationState,k=v.refetchAccountDetail,F=Object(a.useState)(D.compactMode||!1),I=Object(m.a)(F,2),N=I[0],_=I[1];return Object(a.useEffect)((function(){D=new d.PeraWalletConnect({compactMode:N})}),[N]),Object(a.useEffect)((function(){D.reconnectSession().then((function(e){var t;e&&(j(e[0]),L("Connected to Pera Wallet")),null===(t=D.connector)||void 0===t||t.on("disconnect",(function(){j(null)}))})).catch((function(e){return console.log(e)}))}),[]),Object(P.jsxs)("div",{className:"app ".concat(O?"app--connected":""),children:[Object(P.jsx)("div",{className:"app__header",children:Object(P.jsx)(c.Dropdown,{customClassName:"app__header__chain-select-dropdown",role:"menu",options:[{id:"testnet",title:"TestNet"},{id:"mainnet",title:"MainNet"}],selectedOption:f,onSelect:function(e){!function(e){"testnet"===(null===e||void 0===e?void 0:e.id)?(r(p.a.TestNet),l({id:"testnet",title:"TestNet"}),W.a.updateFetcher(p.a.TestNet)):"mainnet"===(null===e||void 0===e?void 0:e.id)&&(r(p.a.MainNet),l({id:"mainnet",title:"MainNet"}),W.a.updateFetcher(p.a.MainNet))}(e)},hasDeselectOption:!1})}),n===p.a.MainNet&&Object(P.jsx)("div",{className:"app__chain-message",children:"You are using MainNet right now. Please be careful when you trying to send transactions."}),Object(P.jsxs)("h1",{className:"app__title",children:["Pera Wallet"," ",Object(P.jsx)("small",{children:"Example dApp"})]}),!O&&Object(P.jsxs)("div",{className:"app__compact-mode-switch",children:[Object(P.jsx)("p",{children:"Pera Connect Compact Mode: "}),Object(P.jsx)(c.Switch,{onToggle:function(){_(!N),localStorage.setItem(y,"true"===localStorage.getItem(y)?"false":"true")},isToggledOn:N})]}),T.data&&Object(P.jsx)(w,{accountInformation:T.data,chain:n}),O&&"mainnet"===n&&Object(P.jsx)(c.Button,{customClassName:"app__button--connect",onClick:function(){x&&(E(),M.on({OPT_IN_REQUEST:function(){var e=Object(i.a)(Object(u.a)().mark((function e(t){var a,r,s,o,c,i;return Object(u.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.accountAddress,r=t.assetID,e.prev=1,e.next=4,Object(C.a)(n,a,Number(r));case 4:return s=e.sent,o=s.transaction,c=o.reduce((function(e,t){return e.concat(t)}),[]),e.next=9,D.signTransaction([c]);case 9:return i=e.sent,e.next=12,Object(p.c)(n).sendRawTransaction(i).do();case 12:M.close(),E(),e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),L("".concat(e.t0));case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),ADD_FUNDS_COMPLETED:function(){L("Add funds completed")},ADD_FUNDS_FAILED:function(){L("Add funds failed")}}))},children:"Add funds"}),Object(P.jsx)(c.Button,{customClassName:"app__button--connect",onClick:O?function(){D.disconnect(),j(null)}:function(){return R.apply(this,arguments)},children:O?"Disconnect":"Connect to Pera Wallet"}),O&&Object(P.jsx)(A.a,{accountAddress:x,peraWallet:D,handleSetLog:L,chain:n,refecthAccountDetail:k})]});function E(){x&&M.addFunds({accountAddress:x}).then((function(){L("Funds added")})).catch((function(e){L("".concat(e))}))}function R(){return(R=Object(i.a)(Object(u.a)().mark((function e(){var t;return Object(u.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,D.connect();case 3:t=e.sent,L("Connected to Pera Wallet"),j(t[0]),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),console.log(e.t0),L("".concat(e.t0));case 12:case"end":return e.stop()}}),e,null,[[0,8]])})))).apply(this,arguments)}function L(e){h({timeout:1e4,render:function(){return Object(P.jsx)(S,{message:e})}})}},E={debounceTime:150};var R=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:E,n=Object(a.useRef)(void 0),r=Object(a.useRef)(e);Object(a.useEffect)((function(){r.current=e}),[e]),Object(a.useEffect)((function(){return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e),clearTimeout(n.current)};function e(){n.current||(n.current=setTimeout((function(){r.current(),n.current=void 0}),t.debounceTime))}}),[t.debounceTime])};var L=function(){function e(){document.documentElement.style.setProperty("--vh","".concat(.01*window.innerHeight,"px"))}Object(a.useEffect)((function(){e()}),[]),R((function(){e()}))};var G=function(){return L(),Object(P.jsx)(_,{})},K=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,193)).then((function(t){var n=t.getCLS,a=t.getFID,r=t.getFCP,s=t.getLCP,o=t.getTTFB;n(e),a(e),r(e),s(e),o(e)}))};o.a.render(Object(P.jsx)(r.a.StrictMode,{children:Object(P.jsx)(c.ToastContextProvider,{children:Object(P.jsx)(G,{})})}),document.getElementById("root")),K()},49:function(e,t,n){"use strict";(function(e){n.d(t,"b",(function(){return ke})),n.d(t,"c",(function(){return Fe})),n.d(t,"a",(function(){return d}));var a,r=n(0),s=n(7),o=(n(15),n(6)),c=n(11),u=[o.default.mnemonicToSecretKey("cannon scatter chest item way pulp seminar diesel width tooth enforce fire rug mushroom tube sustain glide apple radar chronic ask plastic brown ability badge"),o.default.mnemonicToSecretKey("person congress dragon morning road sweet horror famous bomb engine eager silent home slam civil type melt field dry daring wheel monitor custom above term"),o.default.mnemonicToSecretKey("faint protect home drink journey humble tube clinic game rough conduct sell violin discover limit lottery anger baby leaf mountain peasant rude scene abstract casual")];function i(e,t){return e===c.a.MainNet?t===a.Transfer?604:t===a.Close?672:312769:t===a.Transfer?11711:t===a.Close?180132:135270}function m(e){if(e===c.a.MainNet)return 305162725;if(e===c.a.TestNet)return 22314999;throw new Error("App not defined for chain ".concat(e))}!function(e){e.Transfer="asset-transfer",e.OptIn="asset-opt-in",e.Close="asset-close"}(a||(a={}));var d=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a,s){var u,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return u=t.sent,i=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,amount:0,assetIndex:s,note:new Uint8Array(e.from("example note value")),suggestedParams:u}),m=[{txn:i}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n,a){return t.apply(this,arguments)}}(),f=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message"}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),l=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:s}),m=[{txn:i}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),p=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),rekeyTo:u[2].addr,suggestedParams:s}),m=[{txn:i}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),b=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),rekeyTo:u[2].addr,closeRemainderTo:u[1].addr,suggestedParams:s}),m=[{txn:i}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),g=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message",authAddr:"INVALID_ADDRESS"}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),x=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var u,m,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return u=t.sent,m=i(n,a.OptIn),d=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:m,note:new Uint8Array(e.from("example note value")),suggestedParams:u}),f=[{txn:d}],t.abrupt("return",{transaction:[f]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),j=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,100,u=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,amount:0,assetIndex:100,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),i=[{txn:u}],t.abrupt("return",{transaction:[i]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),O=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:1e6,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),l=[{txn:f}],t.abrupt("return",{transaction:[l]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),h=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:1e6,assetIndex:d,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:m}),l=[{txn:f,message:"This is a transaction message"}],t.abrupt("return",{transaction:[l]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),v=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,100,i=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e6,assetIndex:100,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i}],t.abrupt("return",{transaction:[m]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),y=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationOptInTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),T=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n){var a,s,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return a=t.sent,s=m(n),i=o.default.makeApplicationOptInTxnFromObject({from:u[1].addr,appIndex:s,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],rekeyTo:u[2].addr,suggestedParams:a}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),P=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),w=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[],suggestedParams:s}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),A=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=m(n),d=o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:i,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],rekeyTo:u[2].addr,suggestedParams:s}),f=[{txn:d}],t.abrupt("return",{transaction:[f]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),k=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationCloseOutTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:i,message:"This is a transaction message"}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),F=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationClearStateTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),S=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,m,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=Uint8Array.from([4,129,1,67]),i=Uint8Array.from([3,129,1,67]),m=o.default.makeApplicationCreateTxnFromObject({from:a,approvalProgram:u,clearProgram:i,numGlobalInts:1,numGlobalByteSlices:2,numLocalInts:3,numLocalByteSlices:4,onComplete:o.default.OnApplicationComplete.NoOpOC,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:m}],t.abrupt("return",{transaction:[d]});case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),I=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,m,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=Uint8Array.from([4,129,1,67]),i=Uint8Array.from([3,129,1,67]),m=o.default.makeApplicationCreateTxnFromObject({from:a,approvalProgram:u,clearProgram:i,numGlobalInts:1,numGlobalByteSlices:2,numLocalInts:3,numLocalByteSlices:4,extraPages:1,onComplete:o.default.OnApplicationComplete.NoOpOC,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:m}],t.abrupt("return",{transaction:[d]});case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),U=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d,f,l;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=Uint8Array.from([4,129,1,67]),i=Uint8Array.from([3,129,1,67]),d=m(n),f=o.default.makeApplicationUpdateTxnFromObject({from:a,appIndex:d,approvalProgram:u,clearProgram:i,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),l=[{txn:f}],t.abrupt("return",{transaction:[l]});case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),C=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationDeleteTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:s}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),W=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=i(n,a.OptIn),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:1e6,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=[{txn:l},{txn:p,signers:[]}],o.default.assignGroupID(b.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[b]});case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),N=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=i(n,a.OptIn),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:1e6,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:5e5,note:new Uint8Array(e.from("this is a payment txn")),suggestedParams:m}),g=[{txn:l},{txn:p,signers:[]},{txn:b,message:"This is a transaction message"}],o.default.assignGroupID(g.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[g]});case 11:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),D=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=i(n,a.OptIn),l=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:5e5,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:1e6,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=[{txn:l},{txn:p},{txn:b}],o.default.assignGroupID(g.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[g]});case 11:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),M=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:5e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:5e5,note:new Uint8Array(e.from("example note value")),rekeyTo:u[2].addr,suggestedParams:s}),d=[{txn:i},{txn:m,message:"This is a transaction message"}],o.default.assignGroupID(d.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[d]});case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),_=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=i(n,a.Close),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:50,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:50,assetIndex:f,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:m}),b=[{txn:l},{txn:p}],o.default.assignGroupID(b.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[b]});case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),E=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:50,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:50,assetIndex:d,note:new Uint8Array(e.from("example note value")),rekeyTo:u[2].addr,suggestedParams:m}),p=[{txn:f,message:"This is a transaction message"},{txn:l}],o.default.assignGroupID(p.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[p]});case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),R=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Close),f=i(n,a.Transfer),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,assetIndex:f,amount:10,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:20,assetIndex:d,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:30,assetIndex:f,note:new Uint8Array(e.from("example note value")),rekeyTo:u[2].addr,suggestedParams:m}),g=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:40,assetIndex:f,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,rekeyTo:u[2].addr,suggestedParams:m}),x=[{txn:l,message:"This is a transaction message"},{txn:p},{txn:b},{txn:g,message:"This is a transaction message"}],o.default.assignGroupID(x.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[x]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),L=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j,O,h,v;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.Transfer),f=i(n,a.OptIn),l=i(n,a.Close),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:50,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:50,assetIndex:l,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:m}),x=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:5e5,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),j=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:0,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:m}),O=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:1e3,note:new Uint8Array(e.from("example note value")),rekeyTo:u[2].addr,suggestedParams:m}),h=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:5e4,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,rekeyTo:u[2].addr,suggestedParams:m}),v=[{txn:p},{txn:b},{txn:g},{txn:x},{txn:j},{txn:O},{txn:h}],o.default.assignGroupID(v.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[v]});case 16:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),G=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:for(m=t.sent,d=[],f=0;f<8;f++)l=i(n,a.Transfer),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:l,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:l,note:new Uint8Array(e.from("example note value")),closeRemainderTo:u[1].addr,suggestedParams:m}),d.push({txn:p}),d.push({txn:b});return o.default.assignGroupID(d.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),K=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100003,note:new Uint8Array(e.from("txn 3")),suggestedParams:s}),f=[{txn:i}],l=[{txn:m,message:"This is a transaction message"}],p=[{txn:d}],t.abrupt("return",{transaction:[f,l,p]});case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),B=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.OptIn),f=i(n,a.Transfer),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:1e4,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:3e4,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=[{txn:l}],x=[{txn:p}],j=[{txn:b,message:"This is a transaction message"}],t.abrupt("return",{transaction:[g,x,j]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),V=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.OptIn),f=i(n,a.Transfer),l=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("txn 1")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:1e4,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=[{txn:l}],x=[{txn:p}],j=[{txn:b}],t.abrupt("return",{transaction:[g,x,j]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),X=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p,b;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("atomic group 2 txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100003,note:new Uint8Array(e.from("txn 3")),suggestedParams:s}),f=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100004,note:new Uint8Array(e.from("txn 4")),suggestedParams:s}),l=[{txn:i,message:"This is a transaction message"},{txn:m,message:"This is a transaction message"}],o.default.assignGroupID(l.map((function(e){return e.txn}))),p=[{txn:d}],b=[{txn:f}],t.abrupt("return",{transaction:[l,p,b]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Q=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j,O;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.OptIn),f=i(n,a.Transfer),l=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:1e4,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100004,note:new Uint8Array(e.from("txn 4")),suggestedParams:m}),x=[{txn:l},{txn:p}],o.default.assignGroupID(x.map((function(e){return e.txn}))),j=[{txn:b,message:"This is a transaction message"}],O=[{txn:g}],t.abrupt("return",{transaction:[x,j,O]});case 14:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),H=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("atomic group 1 txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100003,note:new Uint8Array(e.from("atomic group 2 txn 1")),suggestedParams:s}),f=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100004,note:new Uint8Array(e.from("atomic group 2 txn 2")),suggestedParams:s}),l=[{txn:i},{txn:m}],o.default.assignGroupID(l.map((function(e){return e.txn}))),p=[{txn:d},{txn:f}],o.default.assignGroupID(p.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[l,p]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),z=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.OptIn),f=i(n,a.Transfer),l=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:1e4,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:2e3,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),x=[{txn:l},{txn:p,signers:[]}],o.default.assignGroupID(x.map((function(e){return e.txn}))),j=[{txn:b},{txn:g,signers:[]}],o.default.assignGroupID(j.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[x,j]});case 14:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),J=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,100,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:s}),m=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:2e3,assetIndex:100,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100003,note:new Uint8Array(e.from("atomic group 2 txn 1")),suggestedParams:s}),f=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100004,note:new Uint8Array(e.from("atomic group 2 txn 2")),suggestedParams:s}),l=[{txn:i},{txn:m}],o.default.assignGroupID(l.map((function(e){return e.txn}))),p=[{txn:d},{txn:f}],o.default.assignGroupID(p.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[l,p]});case 13:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Y=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.OptIn),f=i(n,a.Transfer),l=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:m}),p=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:1e4,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100004,note:new Uint8Array(e.from("atomic group 2 txn 2")),suggestedParams:m}),x=[{txn:l},{txn:p,signers:[]}],o.default.assignGroupID(x.map((function(e){return e.txn}))),j=[{txn:b},{txn:g}],o.default.assignGroupID(j.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[x,j]});case 14:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Z=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f,l,p,b,g,x,j;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=i(n,a.OptIn),f=i(n,a.Transfer),l=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:m}),p=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("atomic group 1 txn 2")),suggestedParams:m}),b=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u[0].addr,to:s,amount:2e3,assetIndex:f,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),g=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:s,to:s,amount:0,assetIndex:d,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),x=[{txn:l},{txn:p}],o.default.assignGroupID(x.map((function(e){return e.txn}))),j=[{txn:b,signers:[]},{txn:g}],o.default.assignGroupID(j.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[x,j]});case 14:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),q=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("atomic group 2 txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100003,note:new Uint8Array(e.from("txn 3")),suggestedParams:s}),f=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100004,note:new Uint8Array(e.from("txn 4")),suggestedParams:s}),l=[{txn:i,signers:[]},{txn:m}],o.default.assignGroupID(l.map((function(e){return e.txn}))),p=[{txn:d,signers:[]},{txn:f}],o.default.assignGroupID(p.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[l,p]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),$=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100001,note:new Uint8Array(e.from("atomic group 1 txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("atomic group 2 txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100003,note:new Uint8Array(e.from("txn 3")),suggestedParams:s}),f=[{txn:i,signers:[]},{txn:m}],o.default.assignGroupID(f.map((function(e){return e.txn}))),l=[{txn:d}],t.abrupt("return",{transaction:[f,l]});case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ee=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100001,note:new Uint8Array(e.from("txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100002,note:new Uint8Array(e.from("txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100003,note:new Uint8Array(e.from("txn 3")),suggestedParams:s}),f=[{txn:i,signers:[]},{txn:m,signers:[]},{txn:d,signers:[]}],o.default.assignGroupID(f.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[f]});case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),te=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("txn 1")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100002,note:new Uint8Array(e.from("txn 2")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100003,note:new Uint8Array(e.from("txn 3")),suggestedParams:s}),f=[{txn:i}],l=[{txn:m,message:"This is a transaction message"}],p=[{txn:d,signers:[]}],t.abrupt("return",{transaction:[f,l,p]});case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ne=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("max length note (512)"+"!".repeat(491))),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message"}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ae=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:a,decimals:2,defaultFrozen:!1,total:BigInt("0xffffffffffffffff"),assetName:"Example asset",unitName:"EX",assetURL:"https://example.com",assetMetadataHash:new Uint8Array(e.from("59fc007607ccc82d96f016857aaa697c545002d18045e49324696f12b7be8f45","hex")),manager:a,reserve:u[0].addr,clawback:u[1].addr,freeze:u[2].addr,note:new Uint8Array(e.from("example note value")),rekeyTo:u[1].addr,suggestedParams:s}),m=[{txn:i,message:"This is a transaction message"}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),re=function(){var e=Object(s.a)(Object(r.a)().mark((function e(t,n){var a,s,u;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(c.b)(t);case 2:return a=e.sent,s=o.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:n,decimals:0,defaultFrozen:!1,total:1,suggestedParams:a}),u=[{txn:s,message:"This is a transaction message"}],e.abrupt("return",{transaction:[u]});case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),se=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var m,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return m=t.sent,d=o.default.makeAssetConfigTxnWithSuggestedParamsFromObject({from:s,assetIndex:i(n,a.Transfer),clawback:s,freeze:u[0].addr,manager:u[1].addr,reserve:u[2].addr,strictEmptyAddressChecking:!0,note:new Uint8Array(e.from("example note value")),suggestedParams:m}),f=[{txn:d,message:"This is a transaction message"}],t.abrupt("return",{transaction:[f]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),oe=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var u,m,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return u=t.sent,m=o.default.makeAssetConfigTxnWithSuggestedParamsFromObject({from:s,assetIndex:i(n,a.Transfer),strictEmptyAddressChecking:!1,note:new Uint8Array(e.from("example note value")),suggestedParams:u}),d=[{txn:m,message:"This is a transaction message"}],t.abrupt("return",{transaction:[d]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ce=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,s){var u,m,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return u=t.sent,m=o.default.makeAssetDestroyTxnWithSuggestedParamsFromObject({from:s,assetIndex:i(n,a.Transfer),note:new Uint8Array(e.from("example note value")),suggestedParams:u}),d=[{txn:m,message:"This is a transaction message"}],t.abrupt("return",{transaction:[d]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ue=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:100001,note:new Uint8Array(e.from("txn with 0 fee")),suggestedParams:s}),(m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:100001,note:new Uint8Array(e.from("txn with double fee")),suggestedParams:s})).fee+=i.fee,i.fee=0,d=[{txn:i,signers:[]},{txn:m}],o.default.assignGroupID(d.map((function(e){return e.txn}))),t.abrupt("return",{transaction:[d]});case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ie=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:for(s=t.sent,i=[],4,m=0;m<4;m++){for(d=[],f=0;f<16;f++)d.push({txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:0,note:new Uint8Array(e.from("No ".concat(16*m+f+1," of 64"))),suggestedParams:s})});o.default.assignGroupID(d.map((function(e){return e.txn}))),i.push(d)}return t.abrupt("return",{transaction:i});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),me=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:for(s=t.sent,i=[],4,m=0;m<4;m++){for(d=[],f=0;f<16;f++)d.push({txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:0,note:new Uint8Array(e.from("No ".concat(16*m+f+1," of 65"))),suggestedParams:s})});o.default.assignGroupID(d.map((function(e){return e.txn}))),i.push(d)}return i.push([{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:0,note:new Uint8Array(e.from("No 65 of 65")),suggestedParams:s})}]),t.abrupt("return",{transaction:i});case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),de=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:for(s=t.sent,i=[],32,m=0;m<32;m++){for(d=[],f=0;f<16;f++)d.push({txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:0,note:new Uint8Array(e.from("No ".concat(16*m+f+1," of 64"))),suggestedParams:s})});o.default.assignGroupID(d.map((function(e){return e.txn}))),i.push(d)}return t.abrupt("return",{transaction:i});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),fe=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p,b,g,x,j;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=prompt("Please enter minutes for future transaction: "),m=(new Date).getTime(),d=m+6e4*Number(i),f=Math.round((d-m)/1e3),l=Math.abs(Math.round(f/4)),p=s.firstRound+l,b=p+1e3,g={fee:s.fee,firstRound:p,lastRound:b,genesisHash:s.genesisHash,genesisID:s.genesisID},x=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("Example future transaction")),suggestedParams:g}),j=[{txn:x,message:"This is a transaction message"}],t.abrupt("return",{transaction:[j],transactionTimeout:1e3*f});case 14:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),le=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m,d,f,l,p;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e6,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e6,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),d=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e6,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),f=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e6,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),l=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:u[0].addr,to:a,amount:1e6,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),p=[{txn:i},{txn:m},{txn:d},{txn:f},{txn:l}],o.default.assignGroupID(p.map((function(e){return e.txn}))),p.pop(),t.abrupt("return",{transaction:[p]});case 12:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),pe=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u,i,d;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=m(n),i=o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:u,note:new Uint8Array(e.from("example note value")),appArgs:[],suggestedParams:s,boxes:[{appIndex:u,name:Uint8Array.from([0])}]}),d=[{txn:i}],t.abrupt("return",{transaction:[d]});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),be=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message",authAddr:"INVALID_ADDRESS"}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ge=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message",authAddr:u[1].addr}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),xe=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message",signers:["INVALID_ADDRESS"]}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),je=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e5,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i,message:"This is a transaction message",signers:[a]}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Oe=function(){var e=Object(s.a)(Object(r.a)().mark((function e(t,n){var a,s;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(c.b)(t);case 2:return a=e.sent,(s=[[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:n,to:n,amount:0,assetIndex:31566704,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"NGIHJMECRSFHIEQDHBVTLR54K7DOZWM5M6UM3A5CIOYSP6H3QTGSHHGJCQ",amount:5e6,suggestedParams:a})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:n,appIndex:605929989,appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:a})}]])[2][0].txn.fee=2e3,s.forEach((function(e){return o.default.assignGroupID(e.map((function(e){return e.txn})))})),e.abrupt("return",{transaction:s});case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),he=function(){var e=Object(s.a)(Object(r.a)().mark((function e(t,n){var a,s;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(c.b)(t);case 2:return a=e.sent,(s=[[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:n,to:n,amount:0,assetIndex:386195940,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"6NXX7RGJFLEI3HEQEZXDP73SMQKAPWS4N7CEQJ4IEVONUWYWJLT4NM5QQM",amount:3e6,suggestedParams:a})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:n,appIndex:607660059,appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:a})}]])[2][0].txn.fee=2e3,s.forEach((function(e){return o.default.assignGroupID(e.map((function(e){return e.txn})))})),e.abrupt("return",{transaction:s});case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),ve=function(){var e=Object(s.a)(Object(r.a)().mark((function e(t,n){var a,s;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(c.b)(t);case 2:return a=e.sent,(s=[[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"AV6PFVXWDQ7RVNQYOEXCWXCLXVJ5V57WVMVQZ2TWH4EKTB7GSWKUIAUPXQ",amount:2e6,suggestedParams:a})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:n,appIndex:686498781,appArgs:[Uint8Array.from([0]),Uint8Array.from([0,1])],suggestedParams:a})}]])[1][0].txn.fee=3e3,s.forEach((function(e){return o.default.assignGroupID(e.map((function(e){return e.txn})))})),e.abrupt("return",{transaction:s});case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),ye=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,(u=[[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,amount:0,assetIndex:919950894,suggestedParams:s})}],[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:"KIW56KLIBX5UMWS5RT346TNA4HRV5H445S2LMQLRCR73SOHRVSM5TZBQ4A",amount:1160825,assetIndex:31566704,suggestedParams:s})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:"KIW56KLIBX5UMWS5RT346TNA4HRV5H445S2LMQLRCR73SOHRVSM5TZBQ4A",amount:3977452,suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_1"))],suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_2"))],suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_3"))],suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_4"))],suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_5"))],suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_6"))],suggestedParams:s})}],[{txn:o.default.makeApplicationNoOpTxnFromObject({from:a,appIndex:919954173,appArgs:[new Uint8Array(e.from("pool_step_7"))],suggestedParams:s})}]])[3][0].txn.fee=29e3,u.forEach((function(e){return o.default.assignGroupID(e.map((function(e){return e.txn})))})),t.abrupt("return",{transaction:u});case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Te=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,u;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,u=[[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:a,amount:0,note:new Uint8Array(e.from("challenge/1449301/gems")),suggestedParams:s})}]],t.abrupt("return",{transaction:u});case 5:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),Pe=function(){var e=Object(s.a)(Object(r.a)().mark((function e(t,n){var a,s;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(c.b)(t);case 2:return a=e.sent,(s=[[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:n,to:n,amount:0,assetIndex:886237574,suggestedParams:a})}],[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:"N4EJ2ZFGWCEL4PVTCJSLD7RC4WVIUNO57V7LW2FQY7DFOP4EEN4XYC5UEM",to:n,amount:1,assetIndex:886237574,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"RJASLRMECMQL66PH2KLMFSCYMOOBOK7KRX3XMAWDKDB2PQ5J3U5FMPAJNE",amount:36e5,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"VWZBFLBUN6O5A5W6IWHMDUVP5NH2LPV4ZYFMAHP4FQBBYP627MP6WPOEG4",amount:4e5,suggestedParams:a})}]]).forEach((function(e){return o.default.assignGroupID(e.map((function(e){return e.txn})))})),e.abrupt("return",{transaction:s});case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),we=function(){var e=Object(s.a)(Object(r.a)().mark((function e(t,n){var a,s;return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(c.b)(t);case 2:return a=e.sent,(s=[[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:n,to:n,amount:0,assetIndex:865021507,suggestedParams:a})}],[{txn:o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:"CATN6JYGMBZF4OAQBXZTGALLB3X3XUUU6CQAKXUPNKVOC32VNTRWK25HD4",to:n,amount:1,assetIndex:865021507,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"BSKX6GSPTSY2KKXBO5L367OBY5SJT6GD25FV3RY25VLOGCMORQ6COPCOXY",amount:196900,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"ANGEL3CMT7TEXSBJR3DCTJTZCQFOF6FJB6PDKU4IOAMTNPXGR7XUYKOU5Y",amount:18803950,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"XNFT36FUCFRR6CK675FW4BEBCCCOJ4HOSMGCN6J2W6ZMB34KM2ENTNQCP4",amount:689150,suggestedParams:a})}],[{txn:o.default.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:"CATN6JYGMBZF4OAQBXZTGALLB3X3XUUU6CQAKXUPNKVOC32VNTRWK25HD4",amount:1e3,suggestedParams:a})}]]).forEach((function(e){return o.default.assignGroupID(e.map((function(e){return e.txn})))})),e.abrupt("return",{transaction:s});case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Ae=function(){var t=Object(s.a)(Object(r.a)().mark((function t(n,a){var s,i,m;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(c.b)(n);case 2:return s=t.sent,i=o.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:u[0].addr,amount:1e6,assetIndex:444035862,note:new Uint8Array(e.from("example note value")),suggestedParams:s}),m=[{txn:i}],t.abrupt("return",{transaction:[m]});case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ke=[{name:"1. Swap Algo to USDC (algofi)",scenario:Oe},{name:"2. Swap Algo to GoETH (algofi)",scenario:he},{name:"3. Deposit Algo (folksfinance)",scenario:ve},{name:"4. Pool ALGO-USDC (folksfinance)",scenario:ye},{name:"5. Auth (algogems)",scenario:Te},{name:"6. Buy NFT (algogems)",scenario:Pe},{name:"7. Buy NFT (algoxnft)",scenario:we},{name:"8. Zone Transfer",scenario:Ae}],Fe=[{name:"1. Sign single pay txn",scenario:f},{name:"2. Sign single pay txn with close",scenario:l},{name:"3. Sign single pay txn with rekey",scenario:p},{name:"4. Sign single pay txn with rekey and close",scenario:b},{name:"5. Single pay txn with invalid auth address",scenario:g},{name:"6. Sign single asset opt-in txn",scenario:x},{name:"7. Sign single asset opt-in txn with invalid asset id",scenario:j},{name:"8. Sign single asset transfer txn",scenario:O},{name:"9. Sign single asset transfer txn with close",scenario:h},{name:"10. Sign single asset transfer txn with invalid asset id",scenario:v},{name:"11. Sign single app opt-in txn",scenario:y},{name:"12. Sign single app call txn",scenario:P},{name:"13. Sign single app call txn with rekey",scenario:A},{name:"14. Sign single app close out txn",scenario:k},{name:"15. Sign 1 of 2 txns from a group",scenario:W},{name:"16. Sign 2 of 3 txns from a group",scenario:N},{name:"17. Sign txn group with pay, asset opt-in, and asset transfer",scenario:D},{name:"18. Sign txn group with pay and rekey",scenario:M},{name:"19. Sign txn group with asset close",scenario:_},{name:"20. Sign txn group with rekey",scenario:E},{name:"21. Sign txn group with rekey and asset close",scenario:R},{name:"22. Sign group of 7",scenario:L},{name:"23. Full txn group",scenario:G},{name:"24. Sign multiple non-atomic txns",scenario:K},{name:"25. Sign multiple non-atomic txns for only assets",scenario:B},{name:"26. Sign mixed multiple non-atomic txns",scenario:V},{name:"27. Sign atomic txn group and non-atomic txns for only payment",scenario:X},{name:"28. Sign mixed atomic txn group and non-atomic txns",scenario:Q},{name:"29. Sign multiple atomic txn groups for only payment",scenario:H},{name:"30. Sign multiple atomic txn groups for only assets",scenario:z},{name:"31. Sign multiple atomic txn groups with invalid asset",scenario:J},{name:"32. Sign first mixed 2 atomic txn groups",scenario:Y},{name:"33. Sign second mixed 2 atomic txn groups",scenario:Z},{name:"34. Sign only 2 txns in multiple atomic txn groups",scenario:q},{name:"35. Sign only 2 txns in atomic txn group and non-atomic txns",scenario:$},{name:"36. Atomic group with no sig needed (invalid)",scenario:ee},{name:"37. Atomic group and single txn with no sig needed (invalid)",scenario:te},{name:"38. Txn with large note",scenario:ne},{name:"39. Sign single app clear state txn",scenario:F},{name:"40. Sign single app create txn",scenario:S},{name:"41. Sign single app update txn",scenario:U},{name:"42. Sign single app delete txn",scenario:C},{name:"43. Sign single app call with no args",scenario:w},{name:"44. Sign single app create txn with extra page (not working with ledger app v1.2.15)",scenario:I},{name:"45. Sign asset create + rekey txn",scenario:ae},{name:"46. Sign asset create txn with minimal info",scenario:re},{name:"47. Sign asset reconfig txn",scenario:se},{name:"48. Sign asset reconfig txn clear all",scenario:oe},{name:"49. Sign asset delete txn",scenario:ce},{name:"50. Sign txn group with 0 fee",scenario:ue},{name:"51. Sign 64 transactions",scenario:ie},{name:"52. Sign 65 transactions",scenario:me},{name:"53. Future transaction",scenario:fe},{name:"54. Invalid Grouping issue",scenario:le},{name:"55. Application txn with boxes",scenario:pe},{name:"56. Invalid auth address",scenario:be},{name:"57. Valid auth address",scenario:ge},{name:"58. Invalid signers",scenario:xe},{name:"59. Valid signers",scenario:je},{name:"60. 512 Transactions",scenario:de},{name:"61. Sign single app opt-in with rekey",scenario:T}]}).call(this,n(5).Buffer)},50:function(e,t,n){"use strict";var a=n(9),r=n(2),s=n(1),o=n(0),c=n(15),u=n(7),i=n(41),m=n(58),d=n(59),f=n(40),l=n(3),p=n(4),b=n(37),g=function(e){Object(l.a)(n,e);var t=Object(p.a)(n);function n(e){var a;Object(r.a)(this,n);for(var s=arguments.length,o=new Array(s>1?s-1:0),c=1;c1?t-1:0),a=1;a {\n const params = await clientForChain(chain).getTransactionParams().do();\n\n return params;\n}\n\nexport {clientForChain, apiGetTxnParams};\n","import {useState} from \"react\";\nimport {Button, List, ListItem} from \"@hipo/react-ui-toolkit\";\nimport {PeraWalletConnect} from \"@perawallet/connect\";\nimport {PeraWalletArbitraryData, SignerTransaction} from \"@perawallet/connect/dist/util/model/peraWalletModels\";\nimport algosdk from \"algosdk\";\n\nimport {mainnetScenarios, Scenario, scenarios} from \"./util/signTxnUtils\";\nimport {ChainType, clientForChain} from \"../../utils/algod/algod\";\nimport CreateTxn from \"./create/CreateTxn\";\nimport useModalVisibilityState from \"../../hooks/useModalVisibilityState\";\n\ninterface SignTxnProps {\n accountAddress: string;\n peraWallet: PeraWalletConnect;\n handleSetLog: (log: string) => void;\n chain: ChainType;\n refecthAccountDetail: () => void;\n}\n\nfunction SignTxn({\n accountAddress,\n peraWallet,\n handleSetLog,\n chain,\n refecthAccountDetail\n}: SignTxnProps) {\n const [isRequestPending, setIsRequestPending] = useState(false);\n const {isModalOpen, openModal, closeModal} = useModalVisibilityState();\n\n return (\n <>\n \n\n \n\n
\n

{\"Mainnet only, do not sign!\"}

\n {chain === ChainType.TestNet && {\"Switch to MainNet to see txns\"}}\n\n \n {(item) => (\n \n signTransaction(item.scenario, item.name)}\n shouldDisplaySpinner={isRequestPending}\n isDisabled={isRequestPending}>\n {isRequestPending ? \"Loading...\" : item.name}\n \n \n )}\n \n
\n\n
\n

{\"Both Networks\"}

\n\n \n {(item) => (\n \n signTransaction(item.scenario, item.name)}\n shouldDisplaySpinner={isRequestPending}\n isDisabled={isRequestPending}>\n {isRequestPending ? \"Loading...\" : item.name}\n \n \n )}\n \n\n
\n \n {isRequestPending ? \"Loading...\" : \"Sign Single Arbitrary Data\"}\n \n\n \n {isRequestPending ? \"Loading...\" : \"Sign Multiple Arbitrary Data\"}\n \n
\n
\n \n );\n\n async function signSingleArbitraryData() {\n const unsignedData = [\n {\n data: new Uint8Array(Buffer.from(`timestamp//${Date.now()}`)),\n message: \"Timestamp confirmation\"\n }];\n\n await signArbitraryData(unsignedData);\n }\n\n async function signMultipleArbitraryData() {\n const unsignedData = [\n {\n data: new Uint8Array(Buffer.from(`timestamp//${Date.now()}`)),\n message: \"Timestamp confirmation\"\n },\n {\n data: new Uint8Array(Buffer.from(`agent//${navigator.userAgent}`)),\n message: \"User agent confirmation\"\n }\n ];\n\n await signArbitraryData(unsignedData);\n }\n\n async function signArbitraryData(arbitraryData: PeraWalletArbitraryData[]) {\n try {\n const signedData: Uint8Array[] = await peraWallet.signData(\n arbitraryData,\n accountAddress\n );\n\n arbitraryData.forEach((data, index) => {\n const isVerified = algosdk.verifyBytes(data.data, signedData[index], accountAddress)\n\n console.log({data, signedData: signedData[index], isVerified});\n\n if (!isVerified) {\n handleSetLog(`Arbitrary data did not match with signed data!`);\n }\n });\n\n console.log({signedData});\n handleSetLog(\"Data signed successfully\");\n } catch (error) {\n console.log(error)\n handleSetLog(`${error}`);\n }\n }\n\n async function signTransaction(scenario: Scenario, name: string) {\n setIsRequestPending(true);\n\n try {\n const {transaction: txnsToSign, transactionTimeout} = await scenario(\n chain,\n accountAddress\n );\n\n const transactions: SignerTransaction[] = txnsToSign.reduce(\n (acc, val) => acc.concat(val),\n []\n );\n\n const signedTransactions = await peraWallet.signTransaction([transactions]);\n\n console.log({transactions, signedTransactions});\n\n handleSetLog(`Transaction signed successfully: ${name}`);\n\n if (transactionTimeout) {\n setTimeout(async () => {\n await clientForChain(chain).sendRawTransaction(signedTransactions).do();\n handleSetLog(`Transaction sended network: ${name}`);\n }, transactionTimeout);\n } else {\n for (let i = 0; i < txnsToSign.length; i++) {\n await clientForChain(chain)\n // eslint-disable-next-line no-magic-numbers\n .sendRawTransaction(signedTransactions.slice(i * 16, (i + 1) * 16))\n .do();\n }\n\n handleSetLog(`Transaction sended network: ${name}`);\n }\n } catch (error) {\n handleSetLog(`${error}`);\n console.log(error);\n } finally {\n setIsRequestPending(false);\n refecthAccountDetail();\n }\n }\n}\n\nexport default SignTxn;\n","import {useEffect, useRef, useState} from \"react\";\nimport {Button} from \"@hipo/react-ui-toolkit\";\nimport algosdk, {Transaction, isValidAddress} from \"algosdk\";\nimport {SignerTransaction} from \"@perawallet/connect/dist/util/model/peraWalletModels\";\n\nimport useAsyncProcess from \"../../../../hooks/useAsyncProcess/useAsyncProcess\";\nimport peraApi, {Asset} from \"../../../../utils/pera/api/peraApi\";\nimport {getSearchParams} from \"../../../../utils/url/urlUtils\";\nimport {TxnForm} from \"../CreateTxn\";\nimport {ChainType, apiGetTxnParams} from \"../../../../utils/algod/algod\";\nimport {PeraTransactionType} from \"../../../../transaction/transactionTypes\";\n\nfunction CreateTxnButton({\n txnForm,\n type,\n chain,\n onResetForm,\n onSetTransactions\n}: {\n txnForm: TxnForm;\n type: PeraTransactionType;\n chain: ChainType;\n onResetForm: VoidFunction;\n onSetTransactions: (txns: SignerTransaction[]) => void;\n}) {\n const {\n address,\n toAddress,\n amount,\n note,\n assetIndex,\n rekeyTo,\n closeTo,\n transactionAmount,\n\n // keyreg\n voteKey,\n selectionKey,\n stateProofKey,\n voteFirst,\n voteLast,\n voteKeyDilution,\n isOnlineKeyregTxn,\n\n // acfg\n\n assetTxnType,\n unitName,\n assetName,\n defaultFrozen,\n manager,\n reserve,\n freeze,\n clawback,\n assetURL,\n total,\n decimals\n } = txnForm;\n const {runAsyncProcess} = useAsyncProcess>();\n const assetsRef = useRef>();\n const [isPending, setPendingState] = useState(false);\n const [isDisabled, setDisablingState] = useState(false);\n\n useEffect(() => {\n if (type === \"keyreg\") {\n if (isOnlineKeyregTxn) {\n if (voteKey && selectionKey && stateProofKey && voteFirst && voteLast &&\n voteKeyDilution) {\n setDisablingState(false);\n } else {\n setDisablingState(true);\n }\n } else {\n setDisablingState(false);\n }\n }\n }, [isOnlineKeyregTxn, voteKey, selectionKey, stateProofKey, voteFirst, voteLast, voteKeyDilution, type]);\n\n return (\n {`Create ${type} Transaction`}\n );\n\n async function handleCreateTransaction() {\n try {\n if (type === \"pay\") {\n await createPayTransaction();\n } else if (type === \"axfer\") {\n await createAxferTransaction();\n } else if (type === \"keyreg\") {\n await createKeyregTransaction();\n } else if (type === \"acfg\") {\n await createAcfgTransaction();\n }\n\n onResetForm();\n } catch {\n console.log(\"Failed to create transactions.\");\n }\n }\n\n async function createAcfgTransaction() {\n try {\n const suggestedParams = await apiGetTxnParams(chain);\n let txn: Transaction;\n\n if (assetTxnType === \"create\") {\n txn = algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject({\n defaultFrozen: defaultFrozen || false,\n unitName,\n assetName,\n manager,\n reserve,\n freeze,\n clawback,\n assetURL,\n total: total || 1,\n decimals: decimals || 0,\n from: address,\n suggestedParams\n });\n } else if (assetTxnType === \"modify\") {\n txn = algosdk.makeAssetConfigTxnWithSuggestedParamsFromObject({\n from: address,\n manager,\n freeze,\n clawback,\n reserve,\n assetIndex: Number(assetIndex),\n suggestedParams,\n strictEmptyAddressChecking: false\n })\n } else {\n txn = algosdk.makeAssetDestroyTxnWithSuggestedParamsFromObject({\n from: address,\n suggestedParams,\n assetIndex: Number(assetIndex)\n })\n }\n \n\n onSetTransactions([{txn}]);\n } catch (e) {\n console.log(e);\n }\n }\n\n async function createKeyregTransaction() {\n try {\n const suggestedParams = await apiGetTxnParams(chain);\n let txn: Transaction;\n\n if (isOnlineKeyregTxn) {\n txn = algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject({\n from: address,\n voteKey: voteKey!,\n selectionKey: selectionKey!,\n stateProofKey: stateProofKey!,\n voteFirst: suggestedParams.firstRound,\n voteLast: suggestedParams.lastRound,\n voteKeyDilution: voteKeyDilution!,\n rekeyTo: isValidAddress(rekeyTo) ? rekeyTo : undefined,\n suggestedParams\n });\n } else {\n txn = algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject({\n from: address,\n rekeyTo: isValidAddress(rekeyTo) ? rekeyTo : undefined,\n suggestedParams\n });\n }\n\n onSetTransactions([{txn}]);\n } catch (error) {\n console.log(error);\n }\n }\n\n async function createPayTransaction() {\n try {\n setPendingState(true);\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: toAddress,\n amount: Number(amount),\n note: new Uint8Array(Buffer.from(note)),\n rekeyTo: isValidAddress(rekeyTo) ? rekeyTo : undefined,\n closeRemainderTo: isValidAddress(closeTo) ? closeTo : undefined,\n suggestedParams\n });\n\n onSetTransactions([{txn}]);\n } catch (error) {\n console.log(error);\n } finally {\n setPendingState(false);\n }\n }\n\n async function createAxferTransaction() {\n try {\n setPendingState(true);\n await fetchAssets();\n\n const suggestedParams = await apiGetTxnParams(chain);\n const txns: SignerTransaction[] = [];\n\n for (let i = 0; i < transactionAmount; i++) {\n const assetId = assetsRef.current!.results[i].asset_id;\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: toAddress,\n amount: 0,\n assetIndex: transactionAmount === 1 ? Number(assetIndex) : assetId,\n note: new Uint8Array(Buffer.from(`Transaction no: ${i + 1}`)),\n rekeyTo: isValidAddress(rekeyTo) ? rekeyTo : undefined,\n closeRemainderTo: isValidAddress(closeTo) ? closeTo : undefined,\n suggestedParams\n });\n\n txns.push({txn});\n }\n\n onSetTransactions(txns);\n } catch (error) {\n console.log(error);\n } finally {\n setPendingState(false);\n }\n }\n\n async function fetchAssets(next?: string) {\n let assetsResponse: ListRequestResponse;\n\n if (next) {\n const nextRequestUrl = new URL(next);\n\n assetsResponse = await runAsyncProcess(\n peraApi.getAssets(getSearchParams(nextRequestUrl.search))\n );\n } else {\n assetsResponse = await runAsyncProcess(peraApi.getAssets());\n }\n\n assetsRef.current = {\n ...assetsResponse,\n results: [...(assetsRef.current?.results || []), ...assetsResponse.results]\n }\n\n if ((assetsRef.current.results.length || 0) < transactionAmount && assetsResponse.next) await fetchAssets(assetsResponse.next)\n }\n}\n\nexport default CreateTxnButton;\n","import {useCallback, useState} from \"react\";\n\nfunction useModalVisibilityState() {\n const [isModalOpen, setModalVisibility] = useState(false);\n\n return {\n isModalOpen,\n setModalVisibility,\n openModal: useCallback(() => {\n setModalVisibility(true);\n }, [setModalVisibility]),\n closeModal: useCallback(() => {\n setModalVisibility(false);\n }, [setModalVisibility])\n };\n}\n\nexport default useModalVisibilityState;\n","var _path;\n\nvar _excluded = [\"title\", \"titleId\"];\n\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from \"react\";\n\nfunction SvgClose(_ref, svgRef) {\n var title = _ref.title,\n titleId = _ref.titleId,\n props = _objectWithoutProperties(_ref, _excluded);\n\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n width: 24,\n height: 24,\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, _path || (_path = /*#__PURE__*/React.createElement(\"path\", {\n d: \"M20 4L4 20M20 20L4 4\",\n stroke: \"#0A0A0A\",\n strokeWidth: 1.5\n })));\n}\n\nvar ForwardRef = /*#__PURE__*/React.forwardRef(SvgClose);\nexport default __webpack_public_path__ + \"static/media/close.950baffa.svg\";\nexport { ForwardRef as ReactComponent };","import \"./_modal.scss\";\n\nimport React, {useEffect} from \"react\";\nimport ReactModal from \"react-modal\";\nimport classNames from \"classnames\";\n\ntype ModalProps = Omit<\n ReactModal.Props,\n \"contentLabel\" | \"onRequestClose\" | \"parentSelector\" | \"className\"\n> & {\n contentLabel: string;\n onClose: ReactModal.Props[\"onRequestClose\"];\n customClassName?: string;\n shouldPreventScrollOnOverlay?: boolean;\n children?: React.ReactNode;\n};\n\nconst MODAL_CLOSE_TIMEOUT =\n parseFloat(\n getComputedStyle(document.documentElement)\n .getPropertyValue(\"--modal-transition-duration\")\n .trim() || \"0.2\"\n\n // eslint-disable-next-line no-magic-numbers\n ) * 2000;\n\nReactModal.defaultStyles = {};\nReactModal.setAppElement(\"#root\");\n\nfunction getParent() {\n return document.querySelector(\"#modal-root\") as HTMLElement;\n}\n\nfunction Modal({\n customClassName,\n children,\n closeTimeoutMS = MODAL_CLOSE_TIMEOUT,\n shouldCloseOnOverlayClick = true,\n shouldCloseOnEsc = false,\n bodyOpenClassName,\n onClose,\n shouldPreventScrollOnOverlay = true,\n isOpen,\n ...otherProps\n}: ModalProps) {\n useEffect(() => {\n if (shouldPreventScrollOnOverlay && isOpen) {\n document.body.style.overflow = \"hidden\";\n }\n\n return () => {\n if (shouldPreventScrollOnOverlay) {\n document.body.style.overflow = \"unset\";\n }\n };\n }, [isOpen, shouldPreventScrollOnOverlay]);\n\n return (\n // This wrapper div and click handler is added to stop any click events from bubbling outside of the modal\n // eslint-disable-next-line\n
event.stopPropagation()}>\n \n {children}\n \n
\n );\n\n function handleRequestClose(\n event: React.MouseEvent | React.KeyboardEvent\n ) {\n if (onClose && (shouldCloseOnOverlayClick || shouldCloseOnEsc)) {\n onClose(event);\n }\n }\n}\n\nexport default Modal;\n","export const TRANSACTION_LIMIT = 1000;\nexport const TRANSACTION_IN_GROUP_LIMIT = 16;\n\nexport const ALGORAND_DEFAULT_TXN_WAIT_ROUNDS = 1000;","/* eslint-disable max-lines */\nimport {ReactComponent as CloseIcon} from \"../../../ui/icon/close.svg\";\n\nimport \"./_create-txn.scss\";\n\nimport {SignerTransaction} from \"@perawallet/connect/dist/util/model/peraWalletModels\";\nimport algosdk from \"algosdk\";\nimport {\n Button,\n Dropdown,\n DropdownOption,\n FormField,\n Input,\n List,\n ListItem,\n Switch,\n Tab,\n TabItem,\n Textarea\n} from \"@hipo/react-ui-toolkit\";\nimport {useState} from \"react\";\nimport {PeraWalletConnect} from \"@perawallet/connect\";\n\nimport Modal from \"../../../component/modal/Modal\";\nimport {ChainType, clientForChain} from \"../../../utils/algod/algod\";\nimport CreateTxnButton from \"./button/CreateTxnButton\";\nimport {separateIntoChunks} from \"../../../utils/array/arrayUtils\";\nimport {ALGORAND_DEFAULT_TXN_WAIT_ROUNDS, TRANSACTION_IN_GROUP_LIMIT} from \"../../../transaction/transactionConstants\";\nimport {AssetTransactionType, PeraTransactionType} from \"../../../transaction/transactionTypes\";\n\ninterface CreateTxnModalProps {\n chain: ChainType;\n address: string;\n isOpen: boolean;\n onClose: VoidFunction;\n peraWallet: PeraWalletConnect;\n}\n\nexport interface TxnForm {\n address: string;\n toAddress: string;\n amount: string;\n note: string;\n assetIndex: string;\n rekeyTo: string;\n closeTo: string;\n transactionAmount: number;\n\n // keyreg\n voteKey?: string;\n selectionKey?: string;\n stateProofKey?: string;\n voteFirst?: number;\n voteLast?: number;\n voteKeyDilution?: number;\n isOnlineKeyregTxn?: boolean;\n\n // acfg\n assetTxnType?: AssetTransactionType;\n unitName?: string;\n assetName?: string;\n defaultFrozen?: boolean;\n manager?: string;\n reserve?: string;\n freeze?: string;\n clawback?: string;\n assetURL?: string;\n total?: number;\n decimals?: number;\n}\n\nconst TXN_DROPDOWN_OPTIONS: DropdownOption[] = [\n {\n id: \"pay\",\n title: \"pay\"\n },\n {\n id: \"axfer\",\n title: \"axfer\"\n },\n {\n id: \"keyreg\",\n title: \"keyreg\"\n },\n {\n id: \"acfg\",\n title: \"acfg\"\n }\n];\n\nconst ASSET_TXN_TABS: TabItem[] = [\n {id: \"create\", content: \"Create\"},\n {id: \"modify\", content: \"Modify\"},\n {id: \"destroy\", content: \"Destroy\"}\n]\n\nfunction CreateTxn({chain, address, isOpen, onClose, peraWallet}: CreateTxnModalProps) {\n const [transactions, setTransactions] = useState([]);\n const [transactionDropdownOption, setTransactionDropdownOption] =\n useState | null>({\n id: \"pay\",\n title: \"pay\"\n });\n const [formState, setFormState] = useState({\n address,\n toAddress: \"\",\n amount: \"\",\n note: \"\",\n assetIndex: \"\",\n rekeyTo: \"\",\n closeTo: \"\",\n transactionAmount: 1,\n assetTxnType: \"create\"\n });\n const [sendBlockchain, setSendBlockchain] = useState(false);\n\n return (\n \n \n\n

{\"Create Transaction\"}

\n\n \n {\n setTransactionDropdownOption(option);\n }}\n hasDeselectOption={false}\n />\n \n\n \n console.log(\"a\")}\n />\n \n\n {renderForm()}\n\n \n \n \n\n {transactions.length > 0 && (\n \n {(item, _a, index) => (\n {`Txn ${(index || 0) + 1} type: ${item.txn.type}`}\n )}\n \n )}\n\n \n\n {`Create Group Txn with created transactions`}\n\n {`Sign ${transactions.length} Transactions`}\n \n );\n\n function renderForm() {\n switch (transactionDropdownOption?.id) {\n case \"pay\":\n return (\n <>\n \n \n setFormState({...formState, toAddress: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, amount: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, rekeyTo: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, closeTo: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, note: e.currentTarget.value})\n }\n />\n \n \n );\n\n case \"axfer\":\n return (\n <>\n \n \n setFormState({...formState, toAddress: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, assetIndex: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, amount: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, rekeyTo: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, closeTo: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, note: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, transactionAmount: Number(e.currentTarget.value)})\n }\n />\n \n \n );\n\n case \"keyreg\":\n return (\n <>\n \n setFormState({...formState, isOnlineKeyregTxn: !formState.isOnlineKeyregTxn})} />\n \n\n \n \n setFormState({...formState, rekeyTo: e.currentTarget.value})\n }\n />\n \n\n {formState.isOnlineKeyregTxn && (\n <>\n \n \n setFormState({...formState, voteKey: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, selectionKey: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, stateProofKey: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, voteFirst: Number(e.currentTarget.value)})\n }\n />\n \n\n \n \n setFormState({...formState, voteLast: Number(e.currentTarget.value)})\n }\n />\n \n\n \n \n setFormState({...formState, voteKeyDilution: Number(e.currentTarget.value)})\n }\n />\n \n \n )}\n \n );\n\n case \"acfg\":\n return (\n <>\n \n {getAssetTransactionForms()}\n \n \n )\n\n default:\n return null;\n }\n }\n\n function handleAssetTabChange(index: number) {\n let txnType: AssetTransactionType = \"create\";\n\n if (index === 0) txnType = \"create\";\n else if (index === 1) txnType = \"modify\";\n else txnType = \"destroy\";\n\n setFormState({...formState, assetTxnType: txnType})\n }\n\n function getAssetTransactionForms() {\n const create = (\n <>\n \n \n setFormState({...formState, unitName: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, assetName: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, manager: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, reserve: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, freeze: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, clawback: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, assetURL: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, total: Number(e.currentTarget.value)})\n }\n />\n \n\n\n \n \n setFormState({...formState, decimals: Number(e.currentTarget.value)})\n }\n />\n \n\n \n setFormState({...formState, defaultFrozen: !formState.defaultFrozen})} />\n \n \n );\n\n const modify = (\n <>\n \n \n setFormState({...formState, assetIndex: e.currentTarget.value})\n }\n />\n \n\n \n \n setFormState({...formState, manager: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, reserve: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, freeze: e.currentTarget.value})\n }\n />\n \n\n\n \n \n setFormState({...formState, clawback: e.currentTarget.value})\n }\n />\n \n \n );\n\n const destroy = (\n <>\n \n \n setFormState({...formState, assetIndex: e.currentTarget.value})\n }\n />\n \n \n );\n\n return [create, modify, destroy];\n }\n\n function handleSetTransactions(newTxns: SignerTransaction[]) {\n setTransactions([...transactions, ...newTxns]);\n }\n\n function handleGroupTxn() {\n try {\n const transactionChunks = separateIntoChunks(transactions, TRANSACTION_IN_GROUP_LIMIT);\n\n for (const transactionChunk of transactionChunks) {\n algosdk.assignGroupID(transactionChunk.map((toSign) => toSign.txn));\n }\n } catch (error) {\n console.log(error);\n }\n }\n\n async function signTxn() {\n try {\n if (transactions.length === 0) {\n return;\n }\n\n const signedTransactions = await peraWallet.signTransaction([transactions]);\n\n console.log({signedTransactions});\n\n if (sendBlockchain) {\n for (const signedTransaction of signedTransactions) {\n await clientForChain(chain).sendRawTransaction(signedTransaction).do();\n \n await algosdk.waitForConfirmation(\n clientForChain(chain),\n transactions[0].txn.txID(),\n ALGORAND_DEFAULT_TXN_WAIT_ROUNDS\n );\n }\n\n console.log(\"Transactions sent to blockchain\")\n }\n } catch (error) {\n console.log(error);\n }\n }\n\n function handleSendBlockchain() {\n setSendBlockchain(!sendBlockchain);\n }\n\n function resetForm() {\n setFormState({\n ...formState,\n toAddress: \"\",\n amount: \"\",\n note: \"\",\n assetIndex: \"\",\n rekeyTo: \"\",\n closeTo: \"\",\n transactionAmount: 1\n });\n }\n}\n\nexport default CreateTxn;\n","function separateIntoChunks(array: T[], chunkSize: number): T[][] {\n const separatedArray = [];\n const arrayAmount = array.length / chunkSize;\n\n for (let i = 0; i < arrayAmount; i++) {\n separatedArray.push(array.slice(i * chunkSize, (i + 1) * chunkSize));\n }\n\n return separatedArray;\n}\n\nexport {separateIntoChunks};","import {omitKeys} from \"../object/objectUtils\";\n\nexport type AlgorandNumberFormatterOptions = Omit & {\n style?: Intl.NumberFormatPartTypes | \"percent\" | \"shorten-large-numbers\";\n locale?: string;\n};\n\n/**\n * A higher-order function that uses Intl.NumberFormat behind the scenes to format a number\n * @param {Object} providedOptions -\n * @param {string} providedOptions.locale - Passed as first argument to the Intl.NumberFormat. Defaults to one of [navigator.language, \"en-GB\"] or respects provided locale from the call-site\n * @returns {function} Function\n */\n\nexport const DEFAULT_NUMBER_FORMAT_LOCALE_PREFERENCE = \"en-US\";\n\nfunction formatNumber(providedOptions: AlgorandNumberFormatterOptions = {}) {\n const {locale = DEFAULT_NUMBER_FORMAT_LOCALE_PREFERENCE, ...otherOptions} =\n providedOptions;\n let options = otherOptions;\n const isCurrencyFormatting = options.style === \"currency\";\n const shouldShortenLargeNumbers = options.style === \"shorten-large-numbers\";\n\n if (isCurrencyFormatting) {\n options = {\n currency: \"USD\",\n maximumFractionDigits: 5,\n minimumFractionDigits: 2,\n // \"narrowSymbol\" prevents showing explicit currency symbols, such as \"US$\" or \"CA$\"\n currencyDisplay: \"narrowSymbol\",\n ...otherOptions\n };\n } else if (shouldShortenLargeNumbers) {\n options = {\n maximumFractionDigits: 2,\n minimumFractionDigits: 0,\n style: \"decimal\",\n ...omitKeys(otherOptions, \"style\")\n };\n } else {\n options = {\n maximumFractionDigits: 5,\n minimumFractionDigits: 2,\n style: \"decimal\",\n ...otherOptions\n };\n }\n\n let numberFormatter: {\n format: (x: number | bigint) => string;\n };\n\n try {\n numberFormatter = new Intl.NumberFormat(\n locale || [navigator.language, \"en-GB\"],\n options\n );\n } catch (error) {\n numberFormatter = {\n format(x: number | bigint) {\n return x.toLocaleString();\n }\n };\n\n if (isCurrencyFormatting) {\n // currencyDisplay: \"narrowSymbol\" option is not supported by some browsers, try by providing \"symbol\"\n try {\n options.currencyDisplay = \"symbol\";\n numberFormatter = new Intl.NumberFormat(\n locale || [navigator.language, \"en-GB\"],\n options\n );\n } catch (currencyFormattingError) {\n console.error({currencyFormattingError});\n }\n }\n }\n\n return (value: number) => {\n let formattedValue = \"\";\n\n if (!Object.is(value, NaN)) {\n /* eslint-disable no-magic-numbers */\n if (shouldShortenLargeNumbers) {\n if (value >= Math.pow(10, 9)) {\n formattedValue = `${numberFormatter.format(value / Math.pow(10, 9))}b`;\n } else if (value >= Math.pow(10, 6)) {\n formattedValue = `${numberFormatter.format(value / Math.pow(10, 6))}m`;\n } else if (value >= Math.pow(10, 3)) {\n formattedValue = `${numberFormatter.format(value / Math.pow(10, 3))}k`;\n } else {\n formattedValue = numberFormatter.format(value);\n }\n } else {\n formattedValue = numberFormatter.format(value);\n }\n /* eslint-enable no-magic-numbers */\n }\n\n if (formattedValue && options.currency === \"USD\") {\n // in case `narrowSymbol` option was failed, make sure \"US$\" sign appears as just \"$\"\n formattedValue = formattedValue.replace(\"US$\", \"$\");\n }\n\n return formattedValue;\n };\n}\n\nexport {formatNumber};\n","import {microalgosToAlgos} from \"algosdk\";\n\nimport {ChainType, clientForChain} from \"../algod/algod\";\nimport {formatNumber} from \"../number/numberUtils\";\n\nfunction getAccountBalanceText(account: AccountInformationData) {\n return `${formatNumber({minimumFractionDigits: 2})(\n microalgosToAlgos(Number(account.amount))\n )} ALGO`;\n}\n\nfunction getAccountInformation(chain: ChainType, address: string) {\n return new Promise((resolve, reject) => {\n try {\n resolve(\n clientForChain(chain)\n .accountInformation(address)\n .do() as Promise\n );\n } catch (error) {\n reject(error);\n }\n });\n}\n\nexport {getAccountBalanceText, getAccountInformation};\n","export type PeraWalletType = \"pera-wallet\" | \"pera-wallet-web\";\n\nexport interface PeraWalletDetails {\n type: PeraWalletType;\n accounts: string[];\n selectedAccount: string;\n}\n\nconst PERA_WALLET_LOCAL_STORAGE_KEYS = {\n WALLET: \"PeraWallet.Wallet\",\n COMPACT_MODE: \"CompactMode\"\n};\n\nexport {PERA_WALLET_LOCAL_STORAGE_KEYS};\n","import {\n PERA_WALLET_LOCAL_STORAGE_KEYS,\n PeraWalletDetails\n} from \"./pera-wallet/peraWalletTypes\";\n\nfunction getLocalStorage() {\n return typeof localStorage === \"undefined\" ? undefined : localStorage;\n}\n\nfunction getWalletDetailsFromStorage(): PeraWalletDetails | null {\n const storedWalletDetails = getLocalStorage()?.getItem(\n PERA_WALLET_LOCAL_STORAGE_KEYS.WALLET\n );\n\n if (storedWalletDetails) {\n return JSON.parse(storedWalletDetails) as PeraWalletDetails;\n }\n\n return null;\n}\n\nexport {getWalletDetailsFromStorage};\n","import {getAccountBalanceText} from \"../../utils/account/accountUtils\";\nimport {ChainType} from \"../../utils/algod/algod\";\nimport {getWalletDetailsFromStorage} from \"../../utils/storage/storageUtils\";\nimport {truncateAccountAddress} from \"../../utils/string/stringUtils\";\n\nfunction AccountBalance({\n accountInformation,\n chain\n}: {\n accountInformation: AccountInformationData;\n chain: ChainType;\n}) {\n const walletDetails = getWalletDetailsFromStorage();\n\n return (\n
\n
\n {\"Connected to: \"}\n\n {truncateAccountAddress(accountInformation.address)}\n
\n\n
\n {\"Chain: \"}\n\n {chain.toUpperCase()}\n
\n\n
\n {\"Wallet Type: \"}\n\n {walletDetails?.type}\n
\n\n {accountInformation && (\n
\n {\"Balance: \"}\n\n {getAccountBalanceText(accountInformation)}\n
\n )}\n
\n );\n}\n\nexport default AccountBalance;\n","function truncateAccountAddress(stringToTruncate: string) {\n /* eslint-disable no-magic-numbers */\n return `${stringToTruncate.substring(0, 8)}...${stringToTruncate.substring(\n stringToTruncate.length - 4\n )}`;\n /* eslint-enable no-magic-numbers */\n}\n\nexport {truncateAccountAddress};\n","import \"./_pera-toast.scss\";\n\nimport React from \"react\";\nimport classNames from \"classnames\";\n\ninterface PeraToastProps {\n message: React.ReactNode;\n customClassName?: string;\n}\n\nfunction PeraToast({message, customClassName}: PeraToastProps) {\n return (\n
\n
{message}
\n
\n );\n}\n\nexport default PeraToast;\n","import {useToaster} from \"@hipo/react-ui-toolkit\";\nimport {useCallback, useEffect} from \"react\";\n\nimport PeraToast from \"../../component/toast/PeraToast\";\nimport {getAccountInformation} from \"../../utils/account/accountUtils\";\nimport {ChainType} from \"../../utils/algod/algod\";\nimport useAsyncProcess from \"../useAsyncProcess/useAsyncProcess\";\n\nfunction useGetAccountDetailRequest({\n chain,\n accountAddress\n}: {\n chain: ChainType;\n accountAddress: string;\n}) {\n const {\n state: accountInformationState,\n runAsyncProcess: runGetAccountInformationAsyncProcess\n } = useAsyncProcess();\n const {display: displayToast} = useToaster();\n\n const refetchAccountDetail = useCallback(() => {\n if (chain && accountAddress) {\n try {\n runGetAccountInformationAsyncProcess(\n getAccountInformation(chain, accountAddress)\n );\n } catch (error) {\n displayToast({\n render() {\n return ;\n }\n });\n }\n }\n }, [accountAddress, chain, displayToast, runGetAccountInformationAsyncProcess]);\n\n useEffect(() => {\n refetchAccountDetail();\n }, [refetchAccountDetail]);\n\n return {\n accountInformationState,\n refetchAccountDetail\n };\n}\n\nexport default useGetAccountDetailRequest;\n","import \"./_home.scss\";\n\nimport {Button, Dropdown, DropdownOption, Switch, useToaster} from \"@hipo/react-ui-toolkit\";\nimport {useEffect, useState} from \"react\";\nimport {PeraWalletConnect} from \"@perawallet/connect\";\nimport {PeraOnramp} from \"@perawallet/onramp\";\nimport {SignerTransaction} from \"@perawallet/connect/dist/util/model/peraWalletModels\";\n\nimport AccountBalance from \"./account-balance/AccountBalance\";\nimport SignTxn from \"./sign-txn/SignTxn\";\nimport PeraToast from \"../component/toast/PeraToast\";\nimport {ChainType, clientForChain} from \"../utils/algod/algod\";\nimport useGetAccountDetailRequest from \"../hooks/useGetAccountDetailRequest/useGetAccountDetailRequest\";\nimport {createAssetOptInTxn} from \"./sign-txn/util/signTxnUtils\";\nimport peraApiManager from \"../utils/pera/api/peraApiManager\";\nimport {PERA_WALLET_LOCAL_STORAGE_KEYS} from \"../utils/storage/pera-wallet/peraWalletTypes\";\n\nconst isCompactMode = localStorage.getItem(PERA_WALLET_LOCAL_STORAGE_KEYS.COMPACT_MODE);\nlet peraWallet = new PeraWalletConnect({compactMode: isCompactMode === \"true\"});\nconst peraOnRamp = new PeraOnramp({\n optInEnabled: true\n});\n\nfunction Home() {\n const [chainType, setChainType] = useState(ChainType.TestNet);\n const [chainDropdownSelectedOption, setChainDropdownSelectedOption] =\n useState | null>({\n id: \"testnet\",\n title: \"TestNet\"\n });\n const [accountAddress, setAccountAddress] = useState(null);\n const isConnectedToPeraWallet = !!accountAddress;\n const {display: displayToast} = useToaster();\n const {accountInformationState, refetchAccountDetail} = useGetAccountDetailRequest({\n chain: chainType,\n accountAddress: accountAddress || \"\"\n });\n const [isConnectCompactMode, setConnectCompactMode] = useState(peraWallet.compactMode || false);\n\n useEffect(() => {\n peraWallet = new PeraWalletConnect({compactMode: isConnectCompactMode});\n }, [isConnectCompactMode]);\n\n useEffect(() => {\n peraWallet\n .reconnectSession()\n .then((accounts) => {\n if (accounts) {\n setAccountAddress(accounts[0]);\n\n handleSetLog(\"Connected to Pera Wallet\");\n }\n\n peraWallet.connector?.on(\"disconnect\", () => {\n setAccountAddress(null);\n });\n })\n .catch((e) => console.log(e));\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n
\n
\n {\n handleSelectChainType(option);\n }}\n hasDeselectOption={false}\n />\n
\n\n {chainType === ChainType.MainNet && (\n
\n {\n \"You are using MainNet right now. Please be careful when you trying to send transactions.\"\n }\n
\n )}\n\n

\n {\"Pera Wallet\"} {\"Example dApp\"}\n

\n\n {!isConnectedToPeraWallet && (\n
\n

{\"Pera Connect Compact Mode: \"}

\n\n \n
\n )}\n\n {accountInformationState.data && (\n \n )}\n\n {isConnectedToPeraWallet && chainType === \"mainnet\" && (\n \n )}\n\n \n {isConnectedToPeraWallet ? \"Disconnect\" : \"Connect to Pera Wallet\"}\n \n\n {isConnectedToPeraWallet && (\n \n )}\n
\n );\n\n function handleCompactModeSwitch() {\n setConnectCompactMode(!isConnectCompactMode);\n\n localStorage.setItem(PERA_WALLET_LOCAL_STORAGE_KEYS.COMPACT_MODE, localStorage.getItem(PERA_WALLET_LOCAL_STORAGE_KEYS.COMPACT_MODE) === \"true\" ? \"false\" : \"true\");\n }\n\n function handleAddFunds() {\n if (accountAddress) {\n addFunds();\n\n peraOnRamp.on({\n OPT_IN_REQUEST: async ({accountAddress: addr, assetID}) => {\n try {\n const {transaction: txnsToSign} = await createAssetOptInTxn(\n chainType,\n addr,\n Number(assetID)\n );\n\n const transactions: SignerTransaction[] = txnsToSign.reduce(\n (acc, val) => acc.concat(val),\n []\n );\n\n const signedTxn = await peraWallet.signTransaction([transactions]);\n\n await clientForChain(chainType).sendRawTransaction(signedTxn).do();\n\n peraOnRamp.close();\n\n addFunds();\n } catch (error) {\n handleSetLog(`${error}`);\n }\n },\n ADD_FUNDS_COMPLETED: () => {\n handleSetLog(\"Add funds completed\");\n },\n ADD_FUNDS_FAILED: () => {\n handleSetLog(\"Add funds failed\");\n }\n });\n }\n }\n\n function addFunds() {\n if (accountAddress) {\n peraOnRamp\n .addFunds({\n accountAddress\n })\n .then(() => {\n handleSetLog(\"Funds added\");\n })\n .catch((e) => {\n handleSetLog(`${e}`);\n });\n }\n }\n\n async function handleConnectWalletClick() {\n try {\n const newAccounts = await peraWallet.connect();\n \n handleSetLog(\"Connected to Pera Wallet\");\n \n setAccountAddress(newAccounts[0]);\n } catch (e) {\n console.log(e);\n handleSetLog(`${e}`);\n }\n }\n\n function handleDisconnectWalletClick() {\n peraWallet.disconnect();\n\n setAccountAddress(null);\n }\n\n function handleSetLog(log: string) {\n displayToast({\n timeout: 10000,\n render() {\n return ;\n }\n });\n }\n\n function handleSelectChainType(\n option: DropdownOption<\"mainnet\" | \"testnet\", any> | null\n ) {\n if (option?.id === \"testnet\") {\n setChainType(ChainType.TestNet);\n setChainDropdownSelectedOption({\n id: \"testnet\",\n title: \"TestNet\"\n });\n peraApiManager.updateFetcher(ChainType.TestNet);\n } else if (option?.id === \"mainnet\") {\n setChainType(ChainType.MainNet);\n setChainDropdownSelectedOption({\n id: \"mainnet\",\n title: \"MainNet\"\n });\n peraApiManager.updateFetcher(ChainType.MainNet);\n }\n }\n}\n\nexport default Home;\n","import {useEffect, useRef} from \"react\";\n\nconst DEFAULT_DEBOUNCE_TIME = 150;\n\nconst DEFAULT_OPTIONS = {\n /* Discard emitted resize events that take less than the specified time */\n debounceTime: DEFAULT_DEBOUNCE_TIME\n};\n\nfunction useOnWindowResize(callback: VoidFunction, options = DEFAULT_OPTIONS) {\n const timeoutId = useRef(undefined);\n const callbackRef = useRef(callback);\n\n useEffect(() => {\n callbackRef.current = callback;\n }, [callback]);\n\n useEffect(() => {\n window.addEventListener(\"resize\", handleResize);\n\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n clearTimeout(timeoutId.current);\n };\n\n function handleResize() {\n if (!timeoutId.current) {\n timeoutId.current = setTimeout(() => {\n callbackRef.current();\n timeoutId.current = undefined;\n }, options.debounceTime);\n }\n }\n }, [options.debounceTime]);\n}\n\nexport default useOnWindowResize;\n","import {useEffect} from \"react\";\n\nimport useOnWindowResize from \"./useOnWindowResize\";\n\n/**\n * Creates a css variable `--vh` that is the calculated viewport height,\n * and updates it on window resize. This `--vh` value can be used instead of\n * default `vh` value to prevent layout issues on mobile devices\n * See: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/\n */\nfunction useSetDynamicVhValue() {\n useEffect(() => {\n // This useEffect was added to make sure vh is set on mount (even if there is no window resize)\n setVhVariable();\n }, []);\n\n useOnWindowResize(() => {\n setVhVariable();\n });\n\n function setVhVariable() {\n // a vh unit is equal to 1% of the screen height\n // eslint-disable-next-line no-magic-numbers\n document.documentElement.style.setProperty(\"--vh\", `${window.innerHeight * 0.01}px`);\n }\n}\n\nexport default useSetDynamicVhValue;\n","import Home from \"../home/Home\";\nimport useSetDynamicVhValue from \"../hooks/useSetDynamicVh\";\n\nfunction App() {\n useSetDynamicVhValue();\n\n return ;\n}\n\nexport default App;\n","const reportWebVitals = onPerfEntry => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import \"@hipo/react-ui-toolkit/dist/main.css\";\nimport \"./_index.scss\";\n\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport {ToastContextProvider} from \"@hipo/react-ui-toolkit\";\n\nimport App from \"./core/app/App\";\nimport reportWebVitals from \"./reportWebVitals\";\n\nReactDOM.render(\n \n \n \n \n ,\n document.getElementById(\"root\")\n);\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n","/* eslint-disable */\nimport algosdk, {SuggestedParams} from \"algosdk\";\nimport {apiGetTxnParams, ChainType} from \"../../../utils/algod/algod\";\n\nconst testAccounts = [\n algosdk.mnemonicToSecretKey(\n \"cannon scatter chest item way pulp seminar diesel width tooth enforce fire rug mushroom tube sustain glide apple radar chronic ask plastic brown ability badge\"\n ),\n algosdk.mnemonicToSecretKey(\n \"person congress dragon morning road sweet horror famous bomb engine eager silent home slam civil type melt field dry daring wheel monitor custom above term\"\n ),\n algosdk.mnemonicToSecretKey(\n \"faint protect home drink journey humble tube clinic game rough conduct sell violin discover limit lottery anger baby leaf mountain peasant rude scene abstract casual\"\n )\n];\n\nexport function signTxnWithTestAccount(txn: algosdk.Transaction): Uint8Array {\n const sender = algosdk.encodeAddress(txn.from.publicKey);\n\n for (const testAccount of testAccounts) {\n if (testAccount.addr === sender) {\n return txn.signTxn(testAccount.sk);\n }\n }\n\n throw new Error(`Cannot sign transaction from unknown test account: ${sender}`);\n}\n\nexport interface IScenarioTxn {\n txn: algosdk.Transaction;\n signers?: string[];\n authAddr?: string;\n message?: string;\n}\n\nexport type ScenarioReturnType = {\n transaction: IScenarioTxn[][];\n transactionTimeout?: number;\n};\n\nexport type Scenario = (chain: ChainType, address: string) => Promise;\n\nexport enum AssetTransactionType {\n Transfer = \"asset-transfer\",\n OptIn = \"asset-opt-in\",\n Close = \"asset-close\"\n}\n\nfunction getAssetIndex(chain: ChainType, type: AssetTransactionType): number {\n if (chain === ChainType.MainNet) {\n if (type === AssetTransactionType.Transfer) {\n return 604; // IanCoin\n } else if (type === AssetTransactionType.Close) {\n return 672; // RotemCoin\n } else {\n return 312769; // Tether USDt\n }\n }\n\n if (type === AssetTransactionType.Transfer) {\n return 11711; // HipoCoin\n } else if (type === AssetTransactionType.Close) {\n return 180132; // testasset2\n } else {\n return 135270; // Turkish Lira\n }\n}\n\nfunction getAppIndex(chain: ChainType): number {\n if (chain === ChainType.MainNet) {\n return 305162725;\n }\n\n if (chain === ChainType.TestNet) {\n return 22314999;\n }\n\n throw new Error(`App not defined for chain ${chain}`);\n}\n\nconst createAssetOptInTxn = async (\n chain: ChainType,\n address: string,\n assetIndex: number\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singlePayTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singlePayTxnWithClose: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singlePayTxnWithRekey: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singlePayTxnWithRekeyAndClose: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[2].addr,\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singlePayTxnWithInvalidAuthAddress: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [\n {txn, message: \"This is a transaction message\", authAddr: \"INVALID_ADDRESS\"}\n ];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAssetOptInTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAssetOptInTxnToInvalidAsset: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = 100;\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAssetTransferTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAssetTransferTxnWithClose: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleInvalidAssetTransferTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = 100; // Invalid asset id\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppOptIn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationOptInTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppOptInWithAppRekey: Scenario = async (\n chain: ChainType\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationOptInTxnFromObject({\n from: testAccounts[1].addr,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppCall: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppCallNoArgs: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppCallWithRekey: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppCloseOut: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationCloseOutTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppClearState: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationClearStateTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppCreate: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const approvalProgram = Uint8Array.from([4, 129, 1, 67]);\n const clearProgram = Uint8Array.from([3, 129, 1, 67]);\n\n const txn = algosdk.makeApplicationCreateTxnFromObject({\n from: address,\n approvalProgram,\n clearProgram,\n numGlobalInts: 1,\n numGlobalByteSlices: 2,\n numLocalInts: 3,\n numLocalByteSlices: 4,\n onComplete: algosdk.OnApplicationComplete.NoOpOC,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppCreateExtraPage: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const approvalProgram = Uint8Array.from([4, 129, 1, 67]);\n const clearProgram = Uint8Array.from([3, 129, 1, 67]);\n\n const txn = algosdk.makeApplicationCreateTxnFromObject({\n from: address,\n approvalProgram,\n clearProgram,\n numGlobalInts: 1,\n numGlobalByteSlices: 2,\n numLocalInts: 3,\n numLocalByteSlices: 4,\n extraPages: 1,\n onComplete: algosdk.OnApplicationComplete.NoOpOC,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppUpdate: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const approvalProgram = Uint8Array.from([4, 129, 1, 67]);\n const clearProgram = Uint8Array.from([3, 129, 1, 67]);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationUpdateTxnFromObject({\n from: address,\n appIndex,\n approvalProgram,\n clearProgram,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst singleAppDelete: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationDeleteTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst sign1FromGroupTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 1000000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn: txn1}, {txn: txn2, signers: []}];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst sign2FromGroupTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 1000000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 500000,\n note: new Uint8Array(Buffer.from(\"this is a payment txn\")),\n suggestedParams\n });\n\n const txnsToSign = [\n {txn: txn1},\n {txn: txn2, signers: []},\n {txn: txn3, message: \"This is a transaction message\"}\n ];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst signGroupWithPayOptinTransfer: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 500000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn: txn1}, {txn: txn2}, {txn: txn3}];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst signGroupWithPayRekey: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 500000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 500000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn: txn1}, {txn: txn2, message: \"This is a transaction message\"}];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst signTxnWithAssetClose: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n const closeAssetIndex = getAssetIndex(chain, AssetTransactionType.Close);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50,\n assetIndex: closeAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn: txn1}, {txn: txn2}];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst signTxnWithRekey: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const assetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn: txn1, message: \"This is a transaction message\"}, {txn: txn2}];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst signTxnWithRekeyAndAssetClose: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const closeAssetIndex = getAssetIndex(chain, AssetTransactionType.Close);\n const assetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n assetIndex,\n amount: 10,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 20,\n assetIndex: closeAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 30,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txn4 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 40,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [\n {txn: txn1, message: \"This is a transaction message\"},\n {txn: txn2},\n {txn: txn3},\n {txn: txn4, message: \"This is a transaction message\"}\n ];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst signGroupOf7: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const closeAssetIndex = getAssetIndex(chain, AssetTransactionType.Close);\n\n const optIn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const assetXfer = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const assetClose = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50,\n assetIndex: closeAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const payment = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 500000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const accountClose = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 0,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const accountRekey = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const accountRekeyAndClose = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 50000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n rekeyTo: testAccounts[2].addr,\n suggestedParams\n });\n\n const txnsToSign = [\n {txn: optIn},\n {txn: assetXfer},\n {txn: assetClose},\n {txn: payment},\n {txn: accountClose},\n {txn: accountRekey},\n {txn: accountRekeyAndClose}\n ];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst fullTxnGroup: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txnsToSign: Array<{txn: algosdk.Transaction; signers?: [string]}> = [];\n\n for (let i = 0; i < 8; i++) {\n const assetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const optIn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const closeOut = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n closeRemainderTo: testAccounts[1].addr,\n suggestedParams\n });\n\n txnsToSign.push({txn: optIn});\n txnsToSign.push({txn: closeOut});\n }\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst multipleNonAtomicTxns: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"txn 3\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}];\n\n const group2 = [{txn: txn2, message: \"This is a transaction message\"}];\n\n const group3 = [{txn: txn3}];\n\n return {\n transaction: [group1, group2, group3]\n };\n};\n\nconst multipleNonAtomicTxnsForOnlyAssets: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 10000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 30000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}];\n\n const group2 = [{txn: txn2}];\n\n const group3 = [{txn: txn3, message: \"This is a transaction message\"}];\n\n return {\n transaction: [group1, group2, group3]\n };\n};\n\nconst multipleNonAtomicTxnsMixed: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 10000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}];\n\n const group2 = [{txn: txn2}];\n\n const group3 = [{txn: txn3}];\n\n return {\n transaction: [group1, group2, group3]\n };\n};\n\nconst atomicGroupAndNonAtomicTxnsForOnlyPayment: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"txn 3\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100004,\n note: new Uint8Array(Buffer.from(\"txn 4\")),\n suggestedParams\n });\n\n const group1 = [\n {txn: txn1, message: \"This is a transaction message\"},\n {txn: txn2, message: \"This is a transaction message\"}\n ];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3}];\n\n const group3 = [{txn: txn4}];\n\n return {\n transaction: [group1, group2, group3]\n };\n};\n\nconst atomicGroupAndNonAtomicTxnsMixed: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 10000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100004,\n note: new Uint8Array(Buffer.from(\"txn 4\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3, message: \"This is a transaction message\"}];\n\n const group3 = [{txn: txn4}];\n\n return {\n transaction: [group1, group2, group3]\n };\n};\n\nconst multipleAtomicGroupsForOnlyPayment: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 1\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100004,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 2\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3}, {txn: txn4}];\n algosdk.assignGroupID(group2.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst multipleAtomicGroupsForOnlyAssets: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 10000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 2000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}, {txn: txn2, signers: []}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3}, {txn: txn4, signers: []}];\n algosdk.assignGroupID(group2.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst multipleAtomicGroupsWithInvalidAsset: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const invalidAssetIndex = 100;\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 2000,\n assetIndex: invalidAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 1\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100004,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 2\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3}, {txn: txn4}];\n algosdk.assignGroupID(group2.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst multipleAtomicGroupsMixed1: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 10000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100004,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 2\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}, {txn: txn2, signers: []}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3}, {txn: txn4}];\n algosdk.assignGroupID(group2.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst multipleAtomicGroupsMixed2: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n const optInAssetIndex = getAssetIndex(chain, AssetTransactionType.OptIn);\n const transferAssetIndex = getAssetIndex(chain, AssetTransactionType.Transfer);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 2000,\n assetIndex: transferAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: optInAssetIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3, signers: []}, {txn: txn4}];\n algosdk.assignGroupID(group2.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst multipleAtomicGroupSignOnly2: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"txn 3\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100004,\n note: new Uint8Array(Buffer.from(\"txn 4\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1, signers: []}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3, signers: []}, {txn: txn4}];\n algosdk.assignGroupID(group2.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst atomicGroupAndNonAtomicTxnsSignOnly2: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"atomic group 1 txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"atomic group 2 txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"txn 3\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1, signers: []}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n const group2 = [{txn: txn3}];\n\n return {\n transaction: [group1, group2]\n };\n};\n\nconst atomicNoSignTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"txn 3\")),\n suggestedParams\n });\n\n const group1 = [\n {txn: txn1, signers: []},\n {txn: txn2, signers: []},\n {txn: txn3, signers: []}\n ];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1]\n };\n};\n\nconst atomicAndSingleNoSignTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"txn 1\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100002,\n note: new Uint8Array(Buffer.from(\"txn 2\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100003,\n note: new Uint8Array(Buffer.from(\"txn 3\")),\n suggestedParams\n });\n\n const group1 = [{txn: txn1}];\n\n const group2 = [{txn: txn2, message: \"This is a transaction message\"}];\n\n const group3 = [{txn: txn3, signers: []}];\n\n return {\n transaction: [group1, group2, group3]\n };\n};\n\nconst txnWithLargeNote: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"max length note (512)\" + \"!\".repeat(491))),\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst assetCreateTxnMaxInfoAndRekey: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject({\n from: address,\n decimals: 2,\n defaultFrozen: false,\n total: BigInt(\"0xffffffffffffffff\"),\n assetName: \"Example asset\",\n unitName: \"EX\",\n assetURL: \"https://example.com\",\n assetMetadataHash: new Uint8Array(\n Buffer.from(\n \"59fc007607ccc82d96f016857aaa697c545002d18045e49324696f12b7be8f45\",\n \"hex\"\n )\n ),\n manager: address,\n reserve: testAccounts[0].addr,\n clawback: testAccounts[1].addr,\n freeze: testAccounts[2].addr,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n rekeyTo: testAccounts[1].addr,\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst assetCreateTxnMinInfo: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject({\n from: address,\n decimals: 0,\n defaultFrozen: false,\n total: 1,\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst assetReconfigTxnResetAll: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetConfigTxnWithSuggestedParamsFromObject({\n from: address,\n assetIndex: getAssetIndex(chain, AssetTransactionType.Transfer),\n clawback: address,\n freeze: testAccounts[0].addr,\n manager: testAccounts[1].addr,\n reserve: testAccounts[2].addr,\n strictEmptyAddressChecking: true,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst assetReconfigTxnClearAll: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetConfigTxnWithSuggestedParamsFromObject({\n from: address,\n assetIndex: getAssetIndex(chain, AssetTransactionType.Transfer),\n strictEmptyAddressChecking: false,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst assetDeleteTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetDestroyTxnWithSuggestedParamsFromObject({\n from: address,\n assetIndex: getAssetIndex(chain, AssetTransactionType.Transfer),\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst zeroFeeTxnGroup: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"txn with 0 fee\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100001,\n note: new Uint8Array(Buffer.from(\"txn with double fee\")),\n suggestedParams\n });\n\n txn2.fee += txn1.fee;\n txn1.fee = 0;\n\n const group1 = [{txn: txn1, signers: []}, {txn: txn2}];\n algosdk.assignGroupID(group1.map((toSign) => toSign.txn));\n\n return {\n transaction: [group1]\n };\n};\n\nconst maxNumberOfTxns: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [];\n\n const numGroups = 4; // 64 / 16\n for (let i = 0; i < numGroups; i++) {\n const group: Array<{txn: algosdk.Transaction}> = [];\n for (let j = 0; j < 16; j++) {\n group.push({\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 0,\n note: new Uint8Array(Buffer.from(`No ${i * 16 + j + 1} of 64`)),\n suggestedParams\n })\n });\n }\n\n algosdk.assignGroupID(group.map((toSign) => toSign.txn));\n groups.push(group);\n }\n\n return {\n transaction: groups\n };\n};\n\nconst tooManyTxns: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [];\n\n const numGroups = 4; // 64 / 16\n for (let i = 0; i < numGroups; i++) {\n const group: Array<{txn: algosdk.Transaction}> = [];\n for (let j = 0; j < 16; j++) {\n group.push({\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 0,\n note: new Uint8Array(Buffer.from(`No ${i * 16 + j + 1} of 65`)),\n suggestedParams\n })\n });\n }\n\n algosdk.assignGroupID(group.map((toSign) => toSign.txn));\n groups.push(group);\n }\n\n // one more!\n groups.push([\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 0,\n note: new Uint8Array(Buffer.from(`No 65 of 65`)),\n suggestedParams\n })\n }\n ]);\n\n return {\n transaction: groups\n };\n};\n\nconst fiveHundredTxns: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [];\n\n const numGroups = 32; // 64 / 16\n for (let i = 0; i < numGroups; i++) {\n const group: Array<{txn: algosdk.Transaction}> = [];\n for (let j = 0; j < 16; j++) {\n group.push({\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 0,\n note: new Uint8Array(Buffer.from(`No ${i * 16 + j + 1} of 64`)),\n suggestedParams\n })\n });\n }\n\n algosdk.assignGroupID(group.map((toSign) => toSign.txn));\n groups.push(group);\n }\n\n return {\n transaction: groups\n };\n};\n\nconst futureTransaction: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const minutes = prompt(\"Please enter minutes for future transaction: \");\n const exactDate = new Date().getTime();\n const futureTrxDate = exactDate + Number(minutes) * 60000;\n\n const differenceInSeconds = Math.round((futureTrxDate - exactDate) / 1000);\n const blockRound = Math.abs(Math.round(differenceInSeconds / 4));\n\n const firstRoundFuture = suggestedParams.firstRound + blockRound;\n const lastRoundFuture = firstRoundFuture + 1000;\n\n const newSuggestedParams: SuggestedParams = {\n fee: suggestedParams.fee,\n firstRound: firstRoundFuture,\n lastRound: lastRoundFuture,\n genesisHash: suggestedParams.genesisHash,\n genesisID: suggestedParams.genesisID\n };\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"Example future transaction\")),\n suggestedParams: newSuggestedParams\n });\n\n const txnsToSign = [{txn, message: \"This is a transaction message\"}];\n\n return {\n transaction: [txnsToSign],\n transactionTimeout: differenceInSeconds * 1000\n };\n};\n\nconst invalidGroupingIssue: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn3 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn4 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txn5 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: testAccounts[0].addr,\n to: address,\n amount: 1000000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn: txn1}, {txn: txn2}, {txn: txn3}, {txn: txn4}, {txn: txn5}];\n\n algosdk.assignGroupID(txnsToSign.map((toSign) => toSign.txn));\n\n txnsToSign.pop();\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst appCallWithBoxes: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const appIndex = getAppIndex(chain);\n\n const txn = algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n appArgs: [],\n suggestedParams,\n boxes: [{appIndex: appIndex, name: Uint8Array.from([0])}]\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst invalidAuthAddress: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [\n {txn, message: \"This is a transaction message\", authAddr: \"INVALID_ADDRESS\"}\n ];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst validAuthAddress: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [\n {txn, message: \"This is a transaction message\", authAddr: testAccounts[1].addr}\n ];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst invalidSignerAddress: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [\n {txn, message: \"This is a transaction message\", signers: [\"INVALID_ADDRESS\"]}\n ];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst validSignerAddress: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 100000,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [\n {\n txn,\n message: \"This is a transaction message\",\n signers: [address]\n }\n ];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\nconst swapAlgoToUSDC: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: 31566704,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"NGIHJMECRSFHIEQDHBVTLR54K7DOZWM5M6UM3A5CIOYSP6H3QTGSHHGJCQ\",\n amount: 5000000,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 605929989,\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n })\n }\n ]\n ];\n\n groups[2][0].txn.fee = 2000;\n\n // Assign Group ID\n groups.forEach((txns) => algosdk.assignGroupID(txns.map((toSign) => toSign.txn)));\n\n return {\n transaction: groups\n };\n};\n\nconst swapAlgoToGoETH: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: 386195940,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"6NXX7RGJFLEI3HEQEZXDP73SMQKAPWS4N7CEQJ4IEVONUWYWJLT4NM5QQM\",\n amount: 3000000,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 607660059,\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n })\n }\n ]\n ];\n\n groups[2][0].txn.fee = 2000;\n\n // Assign Group ID\n groups.forEach((txns) => algosdk.assignGroupID(txns.map((toSign) => toSign.txn)));\n\n return {\n transaction: groups\n };\n};\n\nconst depositAlgoFF: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"AV6PFVXWDQ7RVNQYOEXCWXCLXVJ5V57WVMVQZ2TWH4EKTB7GSWKUIAUPXQ\",\n amount: 2000000,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 686498781,\n appArgs: [Uint8Array.from([0]), Uint8Array.from([0, 1])],\n suggestedParams\n })\n }\n ]\n ];\n\n groups[1][0].txn.fee = 3000;\n\n // Assign Group ID\n groups.forEach((txns) => algosdk.assignGroupID(txns.map((toSign) => toSign.txn)));\n\n return {\n transaction: groups\n };\n};\n\nconst poolAlgoUsdcFF: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: 919950894,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"KIW56KLIBX5UMWS5RT346TNA4HRV5H445S2LMQLRCR73SOHRVSM5TZBQ4A\",\n amount: 1160825,\n assetIndex: 31566704,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"KIW56KLIBX5UMWS5RT346TNA4HRV5H445S2LMQLRCR73SOHRVSM5TZBQ4A\",\n amount: 3977452,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_1\"))],\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_2\"))],\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_3\"))],\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_4\"))],\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_5\"))],\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_6\"))],\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeApplicationNoOpTxnFromObject({\n from: address,\n appIndex: 919954173,\n appArgs: [new Uint8Array(Buffer.from(\"pool_step_7\"))],\n suggestedParams\n })\n }\n ]\n ];\n\n groups[3][0].txn.fee = 29000;\n\n // Assign Group ID\n groups.forEach((txns) => algosdk.assignGroupID(txns.map((toSign) => toSign.txn)));\n\n return {\n transaction: groups\n };\n};\n\nconst authAlgoGems: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n note: new Uint8Array(Buffer.from(\"challenge/1449301/gems\")),\n suggestedParams\n })\n }\n ]\n ];\n\n return {\n transaction: groups\n };\n};\n\nconst buyNFTAlgogems: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: 886237574,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: \"N4EJ2ZFGWCEL4PVTCJSLD7RC4WVIUNO57V7LW2FQY7DFOP4EEN4XYC5UEM\",\n to: address,\n amount: 1,\n assetIndex: 886237574,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"RJASLRMECMQL66PH2KLMFSCYMOOBOK7KRX3XMAWDKDB2PQ5J3U5FMPAJNE\",\n amount: 3600000,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"VWZBFLBUN6O5A5W6IWHMDUVP5NH2LPV4ZYFMAHP4FQBBYP627MP6WPOEG4\",\n amount: 400000,\n suggestedParams\n })\n }\n ]\n ];\n\n // Assign Group ID\n groups.forEach((txns) => algosdk.assignGroupID(txns.map((toSign) => toSign.txn)));\n\n return {\n transaction: groups\n };\n};\n\nconst buyNFTAlgoxNFT: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const groups: Array> = [\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: address,\n amount: 0,\n assetIndex: 865021507,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: \"CATN6JYGMBZF4OAQBXZTGALLB3X3XUUU6CQAKXUPNKVOC32VNTRWK25HD4\",\n to: address,\n amount: 1,\n assetIndex: 865021507,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"BSKX6GSPTSY2KKXBO5L367OBY5SJT6GD25FV3RY25VLOGCMORQ6COPCOXY\",\n amount: 196900,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"ANGEL3CMT7TEXSBJR3DCTJTZCQFOF6FJB6PDKU4IOAMTNPXGR7XUYKOU5Y\",\n amount: 18803950,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"XNFT36FUCFRR6CK675FW4BEBCCCOJ4HOSMGCN6J2W6ZMB34KM2ENTNQCP4\",\n amount: 689150,\n suggestedParams\n })\n }\n ],\n [\n {\n txn: algosdk.makePaymentTxnWithSuggestedParamsFromObject({\n from: address,\n to: \"CATN6JYGMBZF4OAQBXZTGALLB3X3XUUU6CQAKXUPNKVOC32VNTRWK25HD4\",\n amount: 1000,\n suggestedParams\n })\n }\n ]\n ];\n\n // Assign Group ID\n groups.forEach((txns) => algosdk.assignGroupID(txns.map((toSign) => toSign.txn)));\n\n return {\n transaction: groups\n };\n};\n\nconst singleZoneTransferTxn: Scenario = async (\n chain: ChainType,\n address: string\n): Promise => {\n const suggestedParams = await apiGetTxnParams(chain);\n\n const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({\n from: address,\n to: testAccounts[0].addr,\n amount: 1000000,\n assetIndex: 444035862,\n note: new Uint8Array(Buffer.from(\"example note value\")),\n suggestedParams\n });\n\n const txnsToSign = [{txn}];\n\n return {\n transaction: [txnsToSign]\n };\n};\n\n// const notiboyGlobalOptIn: Scenario = async (\n// chain: ChainType,\n// address: string\n// ): Promise => {\n// const indexer = new algosdk.Indexer(\"\", \"https://mainnet-idx.algonode.cloud\", \"\");\n// const notiboy = new Notiboy(clientForChain(chain), indexer);\n// const userGlobalOptin = await notiboy.userContractOptin(address);\n// const transactions: IScenarioTxn[][] = [];\n// userGlobalOptin.map((txn) => {\n// transactions.push([{txn}]);\n// });\n\n// return {\n// transaction: transactions\n// };\n// };\n\n// const notiboyChannelOptIn: Scenario = async (\n// chain: ChainType,\n// address: string\n// ): Promise => {\n// const indexer = new algosdk.Indexer(\"\", \"https://mainnet-idx.algonode.cloud\", \"\");\n// const notiboy = new Notiboy(clientForChain(chain), indexer);\n// const channelOptinTxn = await notiboy.userChannelOptin(address, 1025363595);\n\n// return {\n// transaction: [[{txn: channelOptinTxn}]]\n// };\n// };\n\nexport const mainnetScenarios: Array<{name: string; scenario: Scenario}> = [\n {\n name: \"1. Swap Algo to USDC (algofi)\",\n scenario: swapAlgoToUSDC\n },\n {\n name: \"2. Swap Algo to GoETH (algofi)\",\n scenario: swapAlgoToGoETH\n },\n {\n name: \"3. Deposit Algo (folksfinance)\",\n scenario: depositAlgoFF\n },\n {\n name: \"4. Pool ALGO-USDC (folksfinance)\",\n scenario: poolAlgoUsdcFF\n },\n {\n name: \"5. Auth (algogems)\",\n scenario: authAlgoGems\n },\n {\n name: \"6. Buy NFT (algogems)\",\n scenario: buyNFTAlgogems\n },\n {\n name: \"7. Buy NFT (algoxnft)\",\n scenario: buyNFTAlgoxNFT\n },\n {\n name: \"8. Zone Transfer\",\n scenario: singleZoneTransferTxn\n },\n // {\n // name: \"9. Notiboy Global Optin\",\n // scenario: notiboyGlobalOptIn\n // },\n // {\n // name: \"10. Notiboy Channel Optin\",\n // scenario: notiboyChannelOptIn\n // }\n];\n\nexport const scenarios: Array<{name: string; scenario: Scenario}> = [\n {\n name: \"1. Sign single pay txn\",\n scenario: singlePayTxn\n },\n {\n name: \"2. Sign single pay txn with close\",\n scenario: singlePayTxnWithClose\n },\n {\n name: \"3. Sign single pay txn with rekey\",\n scenario: singlePayTxnWithRekey\n },\n {\n name: \"4. Sign single pay txn with rekey and close\",\n scenario: singlePayTxnWithRekeyAndClose\n },\n {\n name: \"5. Single pay txn with invalid auth address\",\n scenario: singlePayTxnWithInvalidAuthAddress\n },\n {\n name: \"6. Sign single asset opt-in txn\",\n scenario: singleAssetOptInTxn\n },\n {\n name: \"7. Sign single asset opt-in txn with invalid asset id\",\n scenario: singleAssetOptInTxnToInvalidAsset\n },\n {\n name: \"8. Sign single asset transfer txn\",\n scenario: singleAssetTransferTxn\n },\n {\n name: \"9. Sign single asset transfer txn with close\",\n scenario: singleAssetTransferTxnWithClose\n },\n {\n name: \"10. Sign single asset transfer txn with invalid asset id\",\n scenario: singleInvalidAssetTransferTxn\n },\n {\n name: \"11. Sign single app opt-in txn\",\n scenario: singleAppOptIn\n },\n {\n name: \"12. Sign single app call txn\",\n scenario: singleAppCall\n },\n {\n name: \"13. Sign single app call txn with rekey\",\n scenario: singleAppCallWithRekey\n },\n {\n name: \"14. Sign single app close out txn\",\n scenario: singleAppCloseOut\n },\n {\n name: \"15. Sign 1 of 2 txns from a group\",\n scenario: sign1FromGroupTxn\n },\n {\n name: \"16. Sign 2 of 3 txns from a group\",\n scenario: sign2FromGroupTxn\n },\n {\n name: \"17. Sign txn group with pay, asset opt-in, and asset transfer\",\n scenario: signGroupWithPayOptinTransfer\n },\n {\n name: \"18. Sign txn group with pay and rekey\",\n scenario: signGroupWithPayRekey\n },\n {\n name: \"19. Sign txn group with asset close\",\n scenario: signTxnWithAssetClose\n },\n {\n name: \"20. Sign txn group with rekey\",\n scenario: signTxnWithRekey\n },\n {\n name: \"21. Sign txn group with rekey and asset close\",\n scenario: signTxnWithRekeyAndAssetClose\n },\n {\n name: \"22. Sign group of 7\",\n scenario: signGroupOf7\n },\n {\n name: \"23. Full txn group\",\n scenario: fullTxnGroup\n },\n {\n name: \"24. Sign multiple non-atomic txns\",\n scenario: multipleNonAtomicTxns\n },\n {\n name: \"25. Sign multiple non-atomic txns for only assets\",\n scenario: multipleNonAtomicTxnsForOnlyAssets\n },\n {\n name: \"26. Sign mixed multiple non-atomic txns\",\n scenario: multipleNonAtomicTxnsMixed\n },\n {\n name: \"27. Sign atomic txn group and non-atomic txns for only payment\",\n scenario: atomicGroupAndNonAtomicTxnsForOnlyPayment\n },\n {\n name: \"28. Sign mixed atomic txn group and non-atomic txns\",\n scenario: atomicGroupAndNonAtomicTxnsMixed\n },\n {\n name: \"29. Sign multiple atomic txn groups for only payment\",\n scenario: multipleAtomicGroupsForOnlyPayment\n },\n {\n name: \"30. Sign multiple atomic txn groups for only assets\",\n scenario: multipleAtomicGroupsForOnlyAssets\n },\n {\n name: \"31. Sign multiple atomic txn groups with invalid asset\",\n scenario: multipleAtomicGroupsWithInvalidAsset\n },\n {\n name: \"32. Sign first mixed 2 atomic txn groups\",\n scenario: multipleAtomicGroupsMixed1\n },\n {\n name: \"33. Sign second mixed 2 atomic txn groups\",\n scenario: multipleAtomicGroupsMixed2\n },\n {\n name: \"34. Sign only 2 txns in multiple atomic txn groups\",\n scenario: multipleAtomicGroupSignOnly2\n },\n {\n name: \"35. Sign only 2 txns in atomic txn group and non-atomic txns\",\n scenario: atomicGroupAndNonAtomicTxnsSignOnly2\n },\n {\n name: \"36. Atomic group with no sig needed (invalid)\",\n scenario: atomicNoSignTxn\n },\n {\n name: \"37. Atomic group and single txn with no sig needed (invalid)\",\n scenario: atomicAndSingleNoSignTxn\n },\n {\n name: \"38. Txn with large note\",\n scenario: txnWithLargeNote\n },\n {\n name: \"39. Sign single app clear state txn\",\n scenario: singleAppClearState\n },\n {\n name: \"40. Sign single app create txn\",\n scenario: singleAppCreate\n },\n {\n name: \"41. Sign single app update txn\",\n scenario: singleAppUpdate\n },\n {\n name: \"42. Sign single app delete txn\",\n scenario: singleAppDelete\n },\n {\n name: \"43. Sign single app call with no args\",\n scenario: singleAppCallNoArgs\n },\n {\n name: \"44. Sign single app create txn with extra page (not working with ledger app v1.2.15)\",\n scenario: singleAppCreateExtraPage\n },\n {\n name: \"45. Sign asset create + rekey txn\",\n scenario: assetCreateTxnMaxInfoAndRekey\n },\n {\n name: \"46. Sign asset create txn with minimal info\",\n scenario: assetCreateTxnMinInfo\n },\n {\n name: \"47. Sign asset reconfig txn\",\n scenario: assetReconfigTxnResetAll\n },\n {\n name: \"48. Sign asset reconfig txn clear all\",\n scenario: assetReconfigTxnClearAll\n },\n {\n name: \"49. Sign asset delete txn\",\n scenario: assetDeleteTxn\n },\n {\n name: \"50. Sign txn group with 0 fee\",\n scenario: zeroFeeTxnGroup\n },\n {\n name: \"51. Sign 64 transactions\",\n scenario: maxNumberOfTxns\n },\n {\n name: \"52. Sign 65 transactions\",\n scenario: tooManyTxns\n },\n {\n name: \"53. Future transaction\",\n scenario: futureTransaction\n },\n {\n name: \"54. Invalid Grouping issue\",\n scenario: invalidGroupingIssue\n },\n {\n name: \"55. Application txn with boxes\",\n scenario: appCallWithBoxes\n },\n {\n name: \"56. Invalid auth address\",\n scenario: invalidAuthAddress\n },\n {\n name: \"57. Valid auth address\",\n scenario: validAuthAddress\n },\n {\n name: \"58. Invalid signers\",\n scenario: invalidSignerAddress\n },\n {\n name: \"59. Valid signers\",\n scenario: validSignerAddress\n },\n {\n name: \"60. 512 Transactions\",\n scenario: fiveHundredTxns\n },\n {\n name: \"61. Sign single app opt-in with rekey\",\n scenario: singleAppOptInWithAppRekey\n }\n];\n\nexport {createAssetOptInTxn};\n","import {FetcherErrorStatus} from \"./fetcherTypes\";\n\nclass FetcherError extends Error {\n data: any;\n type: FetcherErrorStatus;\n statusCode: number;\n\n constructor(\n options: {\n type: FetcherErrorStatus;\n data: any;\n message: string;\n statusCode: number;\n },\n ...args: any[]\n ) {\n super(...args);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, FetcherError);\n }\n\n this.name = \"FetcherError\";\n this.type = options.type;\n this.data = options.data;\n this.message = options.message;\n this.statusCode = options.statusCode;\n }\n}\n\nexport default FetcherError;\n","function fetchJSONMiddleware(response: globalThis.Response) {\n return response.json().catch((error) => {\n console.error(\"Response may not support `json` conversion, so suppress the error\");\n console.error(error);\n return {};\n });\n}\n\nexport {fetchJSONMiddleware};\n","import {isRecord} from \"../../utils/object/objectUtils\";\nimport {stringifySearchParams} from \"../../utils/url/urlUtils\";\nimport FetcherError from \"./FetcherError\";\nimport {FetcherConfig, FetcherMiddleware} from \"./fetcherTypes\";\nimport {fetchJSONMiddleware} from \"./fetcherUtils\";\n\nclass Fetcher {\n readonly config: FetcherConfig;\n\n constructor(config: FetcherConfig) {\n this.config = {\n responseMiddlewares: [fetchJSONMiddleware],\n rejectMiddlewares: [],\n ...config,\n initOptions: {\n ...(config?.initOptions || {})\n }\n };\n }\n\n run(\n options: Omit & {\n method: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\" | \"OPTIONS\";\n params?: Record;\n responseMiddlewares?: FetcherMiddleware[];\n rejectMiddlewares?: FetcherMiddleware[];\n body?: any;\n bodyParser?: (body: any) => any;\n },\n path: string\n ): Promise {\n const {baseUrl, initOptions, bodyParser: bodyParserFromConfig} = this.config;\n const {\n params,\n responseMiddlewares,\n rejectMiddlewares,\n body,\n bodyParser: bodyParserFromOptions,\n ...otherOptions\n } = options;\n\n const bodyParser = bodyParserFromOptions || bodyParserFromConfig;\n\n const url =\n isRecord(params) && Object.keys(params).length\n ? `${baseUrl}${path}?${stringifySearchParams(params)}`\n : `${baseUrl}${path}`;\n\n const promise = fetch(url, {\n body: bodyParser ? bodyParser(body) : body,\n ...initOptions,\n ...otherOptions\n });\n\n return promise\n .catch((error) => {\n if (error.name === \"AbortError\") {\n return Promise.reject(\n new FetcherError({\n type: \"Cancelled\",\n data: error,\n message: \"Request cancelled\",\n statusCode: NaN\n })\n );\n }\n\n return Promise.reject(\n new FetcherError({\n type: \"ConnectionError\",\n data: error,\n message: \"Network error. Try again later.\",\n statusCode: NaN\n })\n );\n })\n .then((response) => {\n if (response.ok) {\n return Promise.resolve(response);\n }\n\n return Promise.reject(response);\n })\n .then(async (response) => {\n const middlewares = responseMiddlewares || this.config.responseMiddlewares;\n let final = response;\n\n if (middlewares) {\n for (const middleware of middlewares) {\n final = await middleware(final);\n }\n }\n\n return final as unknown as Promise;\n })\n .catch(async (errorResponse) => {\n if (errorResponse.status === \"Cancelled\") {\n return Promise.reject(errorResponse);\n }\n\n const middlewares = rejectMiddlewares || this.config.rejectMiddlewares;\n let finalError;\n\n try {\n const errorResponseJSON = await errorResponse.json();\n\n finalError = new FetcherError({\n statusCode: errorResponse.status,\n type: errorResponseJSON?.type || \"ApiError\",\n data: errorResponseJSON,\n message:\n // TODO: generateErrorMessage(errorResponseJSON) ||\n `${otherOptions.method} ${url} request failed`\n });\n } catch {\n finalError = new FetcherError({\n statusCode: errorResponse.status,\n type: \"ApiError\",\n data: errorResponse,\n message:\n // TODO: generateErrorMessage(errorResponse) ||\n `${otherOptions.method} ${url} request failed`\n });\n }\n\n if (middlewares) {\n for (const middleware of middlewares) {\n finalError = await middleware(finalError);\n }\n }\n\n return Promise.reject(finalError);\n });\n }\n}\n\nexport default Fetcher;\n","import Fetcher from \"../../../network/fetcher/Fetcher\";\nimport {FetcherConfig} from \"../../../network/fetcher/fetcherTypes\";\nimport {ChainType} from \"../../algod/algod\";\n\nconst PERA_API_URLS = {\n mainnet: \"https://mainnet.api.perawallet.app/v1/\",\n testnet: \"https://testnet.api.perawallet.app/v1/\"\n};\n\nconst PERA_API_DEFAULT_OPTIONS: Omit = {\n initOptions: {\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n }\n },\n bodyParser: JSON.stringify\n};\n\nfunction getPeraApiBaseURLForNetwork(network: ChainType) {\n return network === ChainType.MainNet ? PERA_API_URLS.mainnet : PERA_API_URLS.testnet;\n}\n\nclass PeraApiManager {\n fetcher: Fetcher;\n\n constructor(network: ChainType) {\n this.fetcher = new Fetcher({\n baseUrl: getPeraApiBaseURLForNetwork(network),\n ...PERA_API_DEFAULT_OPTIONS\n });\n }\n\n updateFetcher(network: ChainType) {\n this.fetcher = new Fetcher({\n baseUrl: getPeraApiBaseURLForNetwork(network),\n ...PERA_API_DEFAULT_OPTIONS\n });\n }\n}\n\nconst peraApiManager = new PeraApiManager(ChainType.TestNet);\n\nexport default peraApiManager;\n","/**\n * Omits provided fields from main object\n * @param obj Target object\n * @param keys Keys to omit from obj\n */\nfunction omitKeys(obj: T, ...keys: K[]) {\n const newObj: {[x: string]: any} = {};\n\n Object.keys(obj).forEach((key) => {\n // @ts-ignore 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.\n // couldn't solve this issue\n if (!keys.includes(key)) {\n newObj[key as string] = obj[key];\n }\n });\n\n return newObj as Omit;\n}\n\n/**\n * Checks the given value if the value is object and not an array or null.\n * @param {unknown} x The value to check.\n * @returns {boolean} Returns `true` if `value` is an object and not an array or null, else returns `false`.\n * @example\n *\n * isRecord({})\n * // => true\n *\n * isRecord({a: \"1\"})\n * // => true\n *\n * isRecord(new Foo);\n * // => true\n *\n * isRecord([1, 2, 3])\n * // => false\n *\n * isRecord(Function)\n * // => false\n *\n * isRecord(null)\n * // => false\n */\nfunction isRecord(x: unknown): x is Record {\n return typeof x === \"object\" && Boolean(x) && !Array.isArray(x);\n}\n\nexport {omitKeys, isRecord};\n","/**\n * Initiates URLSearchParams with the provided params object and stringifies it\n * @param {object} params A params object.\n * @returns {string} Stringified search string\n * @example\n *\n * stringifySearchParams({a: \"123\"})\n * // => \"a=123\"\n *\n * stringifySearchParams({a: 1, b: \"test\", c: true})\n * // => \"a=1&b=test&c=true\"\n */\nfunction stringifySearchParams>(params: Params) {\n return new URLSearchParams(params).toString();\n}\n\n/**\n * Converts query string into a params object (all values of the object are strings).\n * @param {string} search Url query string\n * @return {object} Query params object\n */\nfunction getSearchParams>(search: string) {\n return Object.fromEntries(new URLSearchParams(search).entries()) as unknown as T;\n}\n\nexport {stringifySearchParams, getSearchParams};\n","import {useLayoutEffect} from \"react\";\n\nfunction useOnUnmount(callback?: VoidFunction) {\n useLayoutEffect(() => {\n return () => {\n if (callback) {\n callback();\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n\nexport default useOnUnmount;\n","import {useCallback, useEffect, useRef, useState} from \"react\";\n\nimport useOnUnmount from \"../useOnUnmount/useOnUnmount\";\n\nconst DEFAULT_INITIAL_ASYNC_PROCESS_STATE: AsyncProcessState = {\n isPending: false,\n isFetched: false,\n data: null,\n error: null\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint\nfunction useAsyncProcess(options?: UseAsyncProcessOptions) {\n const {initialState, shouldResetDataWhenPending = true} = options || {};\n const [asyncState, setAsyncState] = useState>(\n initialState || DEFAULT_INITIAL_ASYNC_PROCESS_STATE\n );\n const latestDataRef = useRef(asyncState.data);\n const isUnmountedRef = useRef(false);\n const asyncStateSetter = useCallback>(\n (state) => (isUnmountedRef.current ? () => undefined : setAsyncState(state)),\n []\n );\n\n const runAsyncProcess: AsyncProcessCallBack = useCallback(\n (promise, responseSerializer) => {\n asyncStateSetter({\n isPending: true,\n isFetched: false,\n data: shouldResetDataWhenPending ? null : latestDataRef.current,\n error: null\n });\n\n promise\n .then((response) => {\n asyncStateSetter({\n isPending: false,\n isFetched: true,\n data: responseSerializer ? responseSerializer(response) : response,\n error: null\n });\n })\n .catch((error) => {\n asyncStateSetter({\n isPending: false,\n isFetched: true,\n data: null,\n error\n });\n });\n\n return promise;\n },\n [asyncStateSetter, shouldResetDataWhenPending]\n );\n\n useEffect(() => {\n latestDataRef.current = asyncState.data;\n }, [asyncState.data]);\n\n useOnUnmount(() => {\n isUnmountedRef.current = true;\n });\n\n return {\n state: asyncState,\n setState: asyncStateSetter,\n runAsyncProcess\n };\n}\n\nexport {DEFAULT_INITIAL_ASYNC_PROCESS_STATE};\nexport default useAsyncProcess;\n","import peraApiManager from \"./peraApiManager\";\n\nconst PERA_API_PAGINATED_RESPONSE_LIMIT = 50;\n\nexport interface Asset {\n asset_id: number;\n name: string;\n unit_name: string;\n}\n\nconst peraApi = {\n getAssets(params?: ListRequestParams, options?: {signal: AbortSignal}) {\n return peraApiManager.fetcher.run>(\n {method: \"GET\", params, signal: options?.signal},\n \"assets/\"\n );\n }\n};\n\nexport default peraApi;\nexport {PERA_API_PAGINATED_RESPONSE_LIMIT};\n"],"sourceRoot":""} \ No newline at end of file