@directcryptopay/sdk 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +51 -87
  2. package/dist/core/config.d.ts +9 -46
  3. package/dist/core/iframe.d.ts +16 -0
  4. package/dist/dcp-sdk.umd.js +1 -12811
  5. package/dist/dcp.d.ts +12 -5
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +219 -2
  8. package/dist/types.d.ts +26 -164
  9. package/package.json +3 -13
  10. package/dist/ExchangeController-CPMQq6Q-.js +0 -217
  11. package/dist/HelpersUtil-DfMFC7Bf.js +0 -120
  12. package/dist/NavigationUtil-kj9LEOOd.js +0 -8
  13. package/dist/PhArrowCircleDown-lsK25DCk.js +0 -73
  14. package/dist/PhArrowClockwise-NeKHZ1co.js +0 -73
  15. package/dist/PhArrowDown-C9AkNvLs.js +0 -73
  16. package/dist/PhArrowLeft-RNfIQP1X.js +0 -73
  17. package/dist/PhArrowRight-DM1tna0G.js +0 -73
  18. package/dist/PhArrowSquareOut-S5XYbAZj.js +0 -73
  19. package/dist/PhArrowUp-DmktzOWy.js +0 -73
  20. package/dist/PhArrowUpRight-BkNeW_5i.js +0 -73
  21. package/dist/PhArrowsClockwise-CQ4pG76b.js +0 -73
  22. package/dist/PhArrowsDownUp-H6gxaNM6.js +0 -73
  23. package/dist/PhArrowsLeftRight-DZSsfMR6.js +0 -73
  24. package/dist/PhBank-4_9QzqIB.js +0 -73
  25. package/dist/PhBrowser-B-JSznId.js +0 -73
  26. package/dist/PhCaretDown-vV5oHMNi.js +0 -73
  27. package/dist/PhCaretLeft-BLo6Y_f4.js +0 -73
  28. package/dist/PhCaretRight-CqQN4TT3.js +0 -73
  29. package/dist/PhCaretUp-Df7UCAHy.js +0 -73
  30. package/dist/PhCheck-gtpfK4ed.js +0 -73
  31. package/dist/PhCircleHalf-Uq7dwDYw.js +0 -73
  32. package/dist/PhClock-SDCW-NmF.js +0 -73
  33. package/dist/PhCompass-B7hgtdx-.js +0 -73
  34. package/dist/PhCopy-BcnhyXCy.js +0 -73
  35. package/dist/PhCreditCard-BJjByVgu.js +0 -73
  36. package/dist/PhCurrencyDollar-B7ZXqXBy.js +0 -73
  37. package/dist/PhDesktop-B3VKPuJx.js +0 -73
  38. package/dist/PhDeviceMobile-Bnd0TYEH.js +0 -73
  39. package/dist/PhDotsThree-yyMWyZ-R.js +0 -73
  40. package/dist/PhEnvelope-67uzHbI9.js +0 -73
  41. package/dist/PhFunnelSimple-B-DCsloI.js +0 -73
  42. package/dist/PhGlobe-TMm_6qGk.js +0 -73
  43. package/dist/PhIdentificationCard-CePPD2xc.js +0 -73
  44. package/dist/PhImage-gY96WtHR.js +0 -73
  45. package/dist/PhInfo-DRQM_ZDP.js +0 -73
  46. package/dist/PhLightbulb-B0TxPfZ1.js +0 -73
  47. package/dist/PhMagnifyingGlass-B8si5_6W.js +0 -73
  48. package/dist/PhPaperPlaneRight-DVu5PLYd.js +0 -73
  49. package/dist/PhPlus-BfTsQnUz.js +0 -73
  50. package/dist/PhPower-CxYUGOWn.js +0 -73
  51. package/dist/PhPuzzlePiece-CQ4wh0gV.js +0 -73
  52. package/dist/PhQrCode-BuJ97NYJ.js +0 -73
  53. package/dist/PhQuestion-kJoP8Mja.js +0 -73
  54. package/dist/PhQuestionMark-C46ZkFpu.js +0 -73
  55. package/dist/PhSealCheck-Eh8jVqSN.js +0 -73
  56. package/dist/PhSignOut-jk97OSVt.js +0 -73
  57. package/dist/PhSpinner-CiYOhwMg.js +0 -73
  58. package/dist/PhTrash-pxerMqzd.js +0 -73
  59. package/dist/PhUser-BMg0VV4A.js +0 -73
  60. package/dist/PhVault-DYQvx5A-.js +0 -73
  61. package/dist/PhWarning-NLC5Mj87.js +0 -73
  62. package/dist/PhWarningCircle-Ch2jU9fA.js +0 -73
  63. package/dist/PhX-Bx4wpwm3.js +0 -73
  64. package/dist/SwapController-Cti0Cyxa.js +0 -457
  65. package/dist/ccip-CKZd2XJ7.js +0 -150
  66. package/dist/core/api.d.ts +0 -39
  67. package/dist/core/logic.d.ts +0 -2
  68. package/dist/core/wallet.d.ts +0 -55
  69. package/dist/data-capture-7D5CL385.js +0 -490
  70. package/dist/email-AmK0INbZ.js +0 -344
  71. package/dist/embedded-wallet-Pn0I_XLn.js +0 -820
  72. package/dist/features-x8XNprEe.js +0 -274
  73. package/dist/hashTypedData-B50-z0AA.js +0 -197
  74. package/dist/if-defined-CdZSZ6UL.js +0 -10
  75. package/dist/index-4ewUtPPp.js +0 -7981
  76. package/dist/index-51l86yqx.js +0 -276
  77. package/dist/index-B6K56LF_.js +0 -85
  78. package/dist/index-BAmv9PxJ.js +0 -257
  79. package/dist/index-BEswjY9r.js +0 -117
  80. package/dist/index-BSKRq56S.js +0 -355
  81. package/dist/index-BaygXQxx.js +0 -172
  82. package/dist/index-BcPxaHr5.js +0 -118
  83. package/dist/index-Bjt7nGaJ.js +0 -199
  84. package/dist/index-BkTSyAJb.js +0 -21991
  85. package/dist/index-Bmnl7l2U.js +0 -555
  86. package/dist/index-BvPvouSq.js +0 -56
  87. package/dist/index-C-6iznUO.js +0 -174
  88. package/dist/index-C1QEJL-2.js +0 -572
  89. package/dist/index-C4M5s_AM.js +0 -228
  90. package/dist/index-CEqcN8QP.js +0 -1175
  91. package/dist/index-CM3YaYca.js +0 -8189
  92. package/dist/index-CclBLA5r.js +0 -517
  93. package/dist/index-ChTxJOiF.js +0 -46
  94. package/dist/index-CmAv0Tzr.js +0 -86
  95. package/dist/index-CmvoKY4x.js +0 -125
  96. package/dist/index-D7PmdQ9B.js +0 -1750
  97. package/dist/index-D7k2Pc4e.js +0 -1083
  98. package/dist/index-D7lmgqUR.js +0 -153
  99. package/dist/index-DG_-qYze.js +0 -107
  100. package/dist/index-DHot9Fdb.js +0 -218
  101. package/dist/index-DV2LrPtU.js +0 -123
  102. package/dist/index-DYBaJQ2W.js +0 -65
  103. package/dist/index-D_8VUmn1.js +0 -41543
  104. package/dist/index-D_gLn3rT.js +0 -100
  105. package/dist/index-DqcVUSC9.js +0 -62
  106. package/dist/index-I7VDqINw.js +0 -128
  107. package/dist/index-Oz72I9VP.js +0 -209
  108. package/dist/index-UclsHkJ0.js +0 -118
  109. package/dist/index-X8zir_1j.js +0 -110
  110. package/dist/index-XvlWKGCu.js +0 -1281
  111. package/dist/index-dO97xPlt.js +0 -171
  112. package/dist/index-uBeF6OAB.js +0 -387
  113. package/dist/index-zeA_RiCV.js +0 -159
  114. package/dist/localBatchGatewayRequest-BUZHGdjw.js +0 -91
  115. package/dist/onramp-CdnBuF0r.js +0 -855
  116. package/dist/parseSignature-CcyTNGr4.js +0 -3304
  117. package/dist/pay-with-exchange-CSM6WCOV.js +0 -525
  118. package/dist/property-Bd8U3_QP.js +0 -618
  119. package/dist/receive-DooMu4Dx.js +0 -232
  120. package/dist/ref-CpgjXAw7.js +0 -107
  121. package/dist/send-3T7CyYic.js +0 -1166
  122. package/dist/socials-Dt-iHL17.js +0 -620
  123. package/dist/swaps-CjA9Es42.js +0 -1760
  124. package/dist/transactions-nRm9DVzn.js +0 -37
  125. package/dist/ui/Modal.d.ts +0 -9
  126. package/dist/ui/index.d.ts +0 -6
  127. package/dist/w3m-modal-NV25AXhM.js +0 -1706
@@ -1,153 +0,0 @@
1
- import { cU as d, cV as c, cW as m, cX as f, cZ as v, cY as h } from "./index-D_8VUmn1.js";
2
- import { n as r, c as y, U as b } from "./index-CEqcN8QP.js";
3
- import { e as g, n as w } from "./ref-CpgjXAw7.js";
4
- const x = d`
5
- :host {
6
- position: relative;
7
- display: inline-block;
8
- }
9
-
10
- :host([data-error='true']) > input {
11
- color: ${({ tokens: t }) => t.core.textError};
12
- }
13
-
14
- :host([data-error='false']) > input {
15
- color: ${({ tokens: t }) => t.theme.textSecondary};
16
- }
17
-
18
- input {
19
- background: transparent;
20
- height: auto;
21
- box-sizing: border-box;
22
- color: ${({ tokens: t }) => t.theme.textPrimary};
23
- font-feature-settings: 'case' on;
24
- font-size: ${({ textSize: t }) => t.h4};
25
- caret-color: ${({ tokens: t }) => t.core.backgroundAccentPrimary};
26
- line-height: ${({ typography: t }) => t["h4-regular-mono"].lineHeight};
27
- letter-spacing: ${({ typography: t }) => t["h4-regular-mono"].letterSpacing};
28
- -webkit-appearance: none;
29
- -moz-appearance: textfield;
30
- padding: 0px;
31
- font-family: ${({ fontFamily: t }) => t.mono};
32
- }
33
-
34
- :host([data-width-variant='auto']) input {
35
- width: 100%;
36
- }
37
-
38
- :host([data-width-variant='fit']) input {
39
- width: 1ch;
40
- }
41
-
42
- .wui-input-amount-fit-mirror {
43
- position: absolute;
44
- visibility: hidden;
45
- white-space: pre;
46
- font-size: var(--local-font-size);
47
- line-height: 130%;
48
- letter-spacing: -1.28px;
49
- font-family: ${({ fontFamily: t }) => t.mono};
50
- }
51
-
52
- .wui-input-amount-fit-width {
53
- display: inline-block;
54
- position: relative;
55
- }
56
-
57
- input::-webkit-outer-spin-button,
58
- input::-webkit-inner-spin-button {
59
- -webkit-appearance: none;
60
- margin: 0;
61
- }
62
-
63
- input::placeholder {
64
- color: ${({ tokens: t }) => t.theme.textSecondary};
65
- }
66
- `;
67
- var a = function(t, e, n, s) {
68
- var p = arguments.length, o = p < 3 ? e : s === null ? s = Object.getOwnPropertyDescriptor(e, n) : s, l;
69
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(t, e, n, s);
70
- else for (var u = t.length - 1; u >= 0; u--) (l = t[u]) && (o = (p < 3 ? l(o) : p > 3 ? l(e, n, o) : l(e, n)) || o);
71
- return p > 3 && o && Object.defineProperty(e, n, o), o;
72
- };
73
- let i = class extends f {
74
- constructor() {
75
- super(...arguments), this.inputElementRef = g(), this.disabled = !1, this.value = "", this.placeholder = "0", this.widthVariant = "auto", this.maxDecimals = void 0, this.maxIntegers = void 0, this.fontSize = "h4", this.error = !1;
76
- }
77
- firstUpdated() {
78
- this.resizeInput();
79
- }
80
- updated() {
81
- this.style.setProperty("--local-font-size", v.textSize[this.fontSize]), this.resizeInput();
82
- }
83
- render() {
84
- var e;
85
- return this.dataset.widthVariant = this.widthVariant, this.dataset.error = String(this.error), (e = this.inputElementRef) != null && e.value && this.value && (this.inputElementRef.value.value = this.value), this.widthVariant === "auto" ? this.inputTemplate() : h`
86
- <div class="wui-input-amount-fit-width">
87
- <span class="wui-input-amount-fit-mirror"></span>
88
- ${this.inputTemplate()}
89
- </div>
90
- `;
91
- }
92
- inputTemplate() {
93
- return h`<input
94
- ${w(this.inputElementRef)}
95
- type="text"
96
- inputmode="decimal"
97
- pattern="[0-9,.]*"
98
- placeholder=${this.placeholder}
99
- ?disabled=${this.disabled}
100
- autofocus
101
- value=${this.value ?? ""}
102
- @input=${this.dispatchInputChangeEvent.bind(this)}
103
- />`;
104
- }
105
- dispatchInputChangeEvent() {
106
- this.inputElementRef.value && (this.inputElementRef.value.value = b.maskInput({
107
- value: this.inputElementRef.value.value,
108
- decimals: this.maxDecimals,
109
- integers: this.maxIntegers
110
- }), this.dispatchEvent(new CustomEvent("inputChange", {
111
- detail: this.inputElementRef.value.value,
112
- bubbles: !0,
113
- composed: !0
114
- })), this.resizeInput());
115
- }
116
- resizeInput() {
117
- if (this.widthVariant === "fit") {
118
- const e = this.inputElementRef.value;
119
- if (e) {
120
- const n = e.previousElementSibling;
121
- n && (n.textContent = e.value || "0", e.style.width = `${n.offsetWidth}px`);
122
- }
123
- }
124
- }
125
- };
126
- i.styles = [c, m, x];
127
- a([
128
- r({ type: Boolean })
129
- ], i.prototype, "disabled", void 0);
130
- a([
131
- r({ type: String })
132
- ], i.prototype, "value", void 0);
133
- a([
134
- r({ type: String })
135
- ], i.prototype, "placeholder", void 0);
136
- a([
137
- r({ type: String })
138
- ], i.prototype, "widthVariant", void 0);
139
- a([
140
- r({ type: Number })
141
- ], i.prototype, "maxDecimals", void 0);
142
- a([
143
- r({ type: Number })
144
- ], i.prototype, "maxIntegers", void 0);
145
- a([
146
- r({ type: String })
147
- ], i.prototype, "fontSize", void 0);
148
- a([
149
- r({ type: Boolean })
150
- ], i.prototype, "error", void 0);
151
- i = a([
152
- y("wui-input-amount")
153
- ], i);
@@ -1,107 +0,0 @@
1
- import { cU as p, cV as f, cW as h, cX as b, cN as d, cY as m } from "./index-D_8VUmn1.js";
2
- import { n as i, c as w } from "./index-CEqcN8QP.js";
3
- import "./index-I7VDqINw.js";
4
- const g = p`
5
- :host {
6
- width: 100%;
7
- }
8
-
9
- button {
10
- padding: ${({ spacing: e }) => e[3]};
11
- display: flex;
12
- justify-content: space-between;
13
- width: 100%;
14
- border-radius: ${({ borderRadius: e }) => e[4]};
15
- background-color: transparent;
16
- }
17
-
18
- @media (hover: hover) {
19
- button:hover:enabled {
20
- background-color: ${({ tokens: e }) => e.theme.foregroundSecondary};
21
- }
22
- }
23
-
24
- button:focus-visible:enabled {
25
- background-color: ${({ tokens: e }) => e.theme.foregroundSecondary};
26
- box-shadow: 0 0 0 4px ${({ tokens: e }) => e.core.foregroundAccent040};
27
- }
28
-
29
- button[data-clickable='false'] {
30
- pointer-events: none;
31
- background-color: transparent;
32
- }
33
-
34
- wui-image,
35
- wui-icon {
36
- width: ${({ spacing: e }) => e[10]};
37
- height: ${({ spacing: e }) => e[10]};
38
- }
39
-
40
- wui-image {
41
- border-radius: ${({ borderRadius: e }) => e[16]};
42
- }
43
- `;
44
- var n = function(e, r, a, u) {
45
- var l = arguments.length, o = l < 3 ? r : u === null ? u = Object.getOwnPropertyDescriptor(r, a) : u, c;
46
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, r, a, u);
47
- else for (var s = e.length - 1; s >= 0; s--) (c = e[s]) && (o = (l < 3 ? c(o) : l > 3 ? c(r, a, o) : c(r, a)) || o);
48
- return l > 3 && o && Object.defineProperty(r, a, o), o;
49
- };
50
- let t = class extends b {
51
- constructor() {
52
- super(...arguments), this.tokenName = "", this.tokenImageUrl = "", this.tokenValue = 0, this.tokenAmount = "0.0", this.tokenCurrency = "", this.clickable = !1;
53
- }
54
- render() {
55
- return m`
56
- <button data-clickable=${String(this.clickable)}>
57
- <wui-flex gap="2" alignItems="center">
58
- ${this.visualTemplate()}
59
- <wui-flex flexDirection="column" justifyContent="space-between" gap="1">
60
- <wui-text variant="md-regular" color="primary">${this.tokenName}</wui-text>
61
- <wui-text variant="sm-regular-mono" color="secondary">
62
- ${d.formatNumberToLocalString(this.tokenAmount, 4)} ${this.tokenCurrency}
63
- </wui-text>
64
- </wui-flex>
65
- </wui-flex>
66
- <wui-flex
67
- flexDirection="column"
68
- justifyContent="space-between"
69
- gap="1"
70
- alignItems="flex-end"
71
- >
72
- <wui-text variant="md-regular-mono" color="primary"
73
- >$${this.tokenValue.toFixed(2)}</wui-text
74
- >
75
- <wui-text variant="sm-regular-mono" color="secondary">
76
- ${d.formatNumberToLocalString(this.tokenAmount, 4)}
77
- </wui-text>
78
- </wui-flex>
79
- </button>
80
- `;
81
- }
82
- visualTemplate() {
83
- return this.tokenName && this.tokenImageUrl ? m`<wui-image alt=${this.tokenName} src=${this.tokenImageUrl}></wui-image>` : m`<wui-icon name="coinPlaceholder" color="default"></wui-icon>`;
84
- }
85
- };
86
- t.styles = [f, h, g];
87
- n([
88
- i()
89
- ], t.prototype, "tokenName", void 0);
90
- n([
91
- i()
92
- ], t.prototype, "tokenImageUrl", void 0);
93
- n([
94
- i({ type: Number })
95
- ], t.prototype, "tokenValue", void 0);
96
- n([
97
- i()
98
- ], t.prototype, "tokenAmount", void 0);
99
- n([
100
- i()
101
- ], t.prototype, "tokenCurrency", void 0);
102
- n([
103
- i({ type: Boolean })
104
- ], t.prototype, "clickable", void 0);
105
- t = n([
106
- w("wui-list-token")
107
- ], t);
@@ -1,218 +0,0 @@
1
- import { d9 as D, bp as b, aW as I, da as C, c0 as g, b2 as A, db as y, cn as _ } from "./index-D_8VUmn1.js";
2
- import { dc as m } from "./index-D_8VUmn1.js";
3
- function q(u = {}) {
4
- let l, d, s, a;
5
- return D((n) => ({
6
- id: "baseAccount",
7
- name: "Base Account",
8
- rdns: "app.base.account",
9
- type: "baseAccount",
10
- async connect({ chainId: t, withCapabilities: e, ...i } = {}) {
11
- var r;
12
- try {
13
- const c = await this.getProvider(), p = t ?? ((r = n.chains[0]) == null ? void 0 : r.id);
14
- if (!p)
15
- throw new C();
16
- const h = await c.request({
17
- method: "wallet_connect",
18
- params: [
19
- {
20
- capabilities: "capabilities" in i && i.capabilities ? i.capabilities : {},
21
- chainIds: [
22
- g(p),
23
- ...n.chains.filter((o) => o.id !== p).map((o) => g(o.id))
24
- ]
25
- }
26
- ]
27
- }), v = h.accounts.map((o) => ({
28
- address: b(o.address),
29
- capabilities: o.capabilities ?? {}
30
- }));
31
- let f = Number(h.chainIds[0]);
32
- if (d || (d = this.onAccountsChanged.bind(this), c.on("accountsChanged", d)), s || (s = this.onChainChanged.bind(this), c.on("chainChanged", s)), a || (a = this.onDisconnect.bind(this), c.on("disconnect", a)), t && f !== t) {
33
- const o = await this.switchChain({ chainId: t }).catch((w) => {
34
- if (w.code === A.code)
35
- throw w;
36
- return { id: f };
37
- });
38
- f = (o == null ? void 0 : o.id) ?? f;
39
- }
40
- return {
41
- // TODO(v3): Make `withCapabilities: true` default behavior
42
- accounts: e ? v : v.map((o) => o.address),
43
- chainId: f
44
- };
45
- } catch (c) {
46
- throw /(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(c.message) ? new A(c) : c;
47
- }
48
- },
49
- async disconnect() {
50
- const t = await this.getProvider();
51
- d && (t.removeListener("accountsChanged", d), d = void 0), s && (t.removeListener("chainChanged", s), s = void 0), a && (t.removeListener("disconnect", a), a = void 0), t.disconnect();
52
- },
53
- async getAccounts() {
54
- return (await (await this.getProvider()).request({
55
- method: "eth_accounts"
56
- })).map((e) => b(e));
57
- },
58
- async getChainId() {
59
- const e = await (await this.getProvider()).request({
60
- method: "eth_chainId"
61
- });
62
- return Number(e);
63
- },
64
- async getProvider() {
65
- if (!l) {
66
- const t = (() => {
67
- var r;
68
- return typeof u.preference == "string" ? { options: u.preference } : {
69
- ...u.preference,
70
- options: ((r = u.preference) == null ? void 0 : r.options) ?? "all"
71
- };
72
- })(), { createBaseAccountSDK: e } = await import("./index-CM3YaYca.js");
73
- l = e({
74
- ...u,
75
- appChainIds: n.chains.map((r) => r.id),
76
- preference: t
77
- }).getProvider();
78
- }
79
- return l;
80
- },
81
- async isAuthorized() {
82
- try {
83
- return !!(await this.getAccounts()).length;
84
- } catch {
85
- return !1;
86
- }
87
- },
88
- async switchChain({ addEthereumChainParameter: t, chainId: e }) {
89
- var c, p, h, v;
90
- const i = n.chains.find((f) => f.id === e);
91
- if (!i)
92
- throw new I(new C());
93
- const r = await this.getProvider();
94
- try {
95
- return await r.request({
96
- method: "wallet_switchEthereumChain",
97
- params: [{ chainId: g(i.id) }]
98
- }), i;
99
- } catch (f) {
100
- if (f.code === 4902)
101
- try {
102
- let o;
103
- t != null && t.blockExplorerUrls ? o = t.blockExplorerUrls : o = (c = i.blockExplorers) != null && c.default.url ? [(p = i.blockExplorers) == null ? void 0 : p.default.url] : [];
104
- let w;
105
- (h = t == null ? void 0 : t.rpcUrls) != null && h.length ? w = t.rpcUrls : w = [((v = i.rpcUrls.default) == null ? void 0 : v.http[0]) ?? ""];
106
- const U = {
107
- blockExplorerUrls: o,
108
- chainId: g(e),
109
- chainName: (t == null ? void 0 : t.chainName) ?? i.name,
110
- iconUrls: t == null ? void 0 : t.iconUrls,
111
- nativeCurrency: (t == null ? void 0 : t.nativeCurrency) ?? i.nativeCurrency,
112
- rpcUrls: w
113
- };
114
- return await r.request({
115
- method: "wallet_addEthereumChain",
116
- params: [U]
117
- }), i;
118
- } catch (o) {
119
- throw new A(o);
120
- }
121
- throw new I(f);
122
- }
123
- },
124
- onAccountsChanged(t) {
125
- t.length === 0 ? this.onDisconnect() : n.emitter.emit("change", {
126
- accounts: t.map((e) => b(e))
127
- });
128
- },
129
- onChainChanged(t) {
130
- const e = Number(t);
131
- n.emitter.emit("change", { chainId: e });
132
- },
133
- async onDisconnect(t) {
134
- n.emitter.emit("disconnect");
135
- const e = await this.getProvider();
136
- d && (e.removeListener("accountsChanged", d), d = void 0), s && (e.removeListener("chainChanged", s), s = void 0), a && (e.removeListener("disconnect", a), a = void 0);
137
- }
138
- }));
139
- }
140
- S.type = "safe";
141
- function S(u = {}) {
142
- const { shimDisconnect: l = !1 } = u;
143
- let d, s;
144
- return D((a) => ({
145
- id: "safe",
146
- name: "Safe",
147
- type: S.type,
148
- async connect({ withCapabilities: n } = {}) {
149
- var r;
150
- const t = await this.getProvider();
151
- if (!t)
152
- throw new y();
153
- const e = await this.getAccounts(), i = await this.getChainId();
154
- return s || (s = this.onDisconnect.bind(this), t.on("disconnect", s)), l && await ((r = a.storage) == null ? void 0 : r.removeItem("safe.disconnected")), {
155
- // TODO(v3): Make `withCapabilities: true` default behavior
156
- accounts: n ? e.map((c) => ({ address: c, capabilities: {} })) : e,
157
- chainId: i
158
- };
159
- },
160
- async disconnect() {
161
- var t;
162
- const n = await this.getProvider();
163
- if (!n)
164
- throw new y();
165
- s && (n.removeListener("disconnect", s), s = void 0), l && await ((t = a.storage) == null ? void 0 : t.setItem("safe.disconnected", !0));
166
- },
167
- async getAccounts() {
168
- const n = await this.getProvider();
169
- if (!n)
170
- throw new y();
171
- return (await n.request({ method: "eth_accounts" })).map(b);
172
- },
173
- async getProvider() {
174
- if (typeof window < "u" && (window == null ? void 0 : window.parent) !== window) {
175
- if (!d) {
176
- const { default: t } = await import("./index-uBeF6OAB.js"), e = new t(u), i = await _(() => e.safe.getInfo(), {
177
- timeout: u.unstable_getInfoTimeout ?? 10
178
- });
179
- if (!i)
180
- throw new Error("Could not load Safe information");
181
- const r = await (async () => {
182
- const c = await import("./index-BkTSyAJb.js").then((p) => p.i);
183
- return typeof c.SafeAppProvider != "function" && typeof c.default.SafeAppProvider == "function" ? c.default.SafeAppProvider : c.SafeAppProvider;
184
- })();
185
- d = new r(i, e);
186
- }
187
- return d;
188
- }
189
- },
190
- async getChainId() {
191
- const n = await this.getProvider();
192
- if (!n)
193
- throw new y();
194
- return Number(n.chainId);
195
- },
196
- async isAuthorized() {
197
- var n;
198
- try {
199
- return l && // If shim exists in storage, connector is disconnected
200
- await ((n = a.storage) == null ? void 0 : n.getItem("safe.disconnected")) ? !1 : !!(await this.getAccounts()).length;
201
- } catch {
202
- return !1;
203
- }
204
- },
205
- onAccountsChanged() {
206
- },
207
- onChainChanged() {
208
- },
209
- onDisconnect() {
210
- a.emitter.emit("disconnect");
211
- }
212
- }));
213
- }
214
- export {
215
- q as baseAccount,
216
- m as injected,
217
- S as safe
218
- };
@@ -1,123 +0,0 @@
1
- import { cU as u, cV as p, cX as m, cY as c } from "./index-D_8VUmn1.js";
2
- import { n as s, c as f } from "./index-CEqcN8QP.js";
3
- import "./index-I7VDqINw.js";
4
- import "./index-UclsHkJ0.js";
5
- const w = u`
6
- :host {
7
- position: relative;
8
- background-color: ${({ tokens: e }) => e.theme.foregroundTertiary};
9
- display: flex;
10
- justify-content: center;
11
- align-items: center;
12
- border-radius: inherit;
13
- border-radius: var(--local-border-radius);
14
- }
15
-
16
- :host([data-image='true']) {
17
- background-color: transparent;
18
- }
19
-
20
- :host > wui-flex {
21
- overflow: hidden;
22
- border-radius: inherit;
23
- border-radius: var(--local-border-radius);
24
- }
25
-
26
- :host([data-size='sm']) {
27
- width: 32px;
28
- height: 32px;
29
- }
30
-
31
- :host([data-size='md']) {
32
- width: 40px;
33
- height: 40px;
34
- }
35
-
36
- :host([data-size='lg']) {
37
- width: 56px;
38
- height: 56px;
39
- }
40
-
41
- :host([name='Extension'])::after {
42
- border: 1px solid ${({ colors: e }) => e.accent010};
43
- }
44
-
45
- :host([data-wallet-icon='allWallets'])::after {
46
- border: 1px solid ${({ colors: e }) => e.accent010};
47
- }
48
-
49
- wui-icon[data-parent-size='inherit'] {
50
- width: 75%;
51
- height: 75%;
52
- align-items: center;
53
- }
54
-
55
- wui-icon[data-parent-size='sm'] {
56
- width: 32px;
57
- height: 32px;
58
- }
59
-
60
- wui-icon[data-parent-size='md'] {
61
- width: 40px;
62
- height: 40px;
63
- }
64
-
65
- :host > wui-icon-box {
66
- position: absolute;
67
- overflow: hidden;
68
- right: -1px;
69
- bottom: -2px;
70
- z-index: 1;
71
- border: 2px solid ${({ tokens: e }) => e.theme.backgroundPrimary};
72
- padding: 1px;
73
- }
74
- `;
75
- var r = function(e, t, o, n) {
76
- var l = arguments.length, a = l < 3 ? t : n === null ? n = Object.getOwnPropertyDescriptor(t, o) : n, d;
77
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, o, n);
78
- else for (var h = e.length - 1; h >= 0; h--) (d = e[h]) && (a = (l < 3 ? d(a) : l > 3 ? d(t, o, a) : d(t, o)) || a);
79
- return l > 3 && a && Object.defineProperty(t, o, a), a;
80
- };
81
- let i = class extends m {
82
- constructor() {
83
- super(...arguments), this.size = "md", this.name = "", this.installed = !1, this.badgeSize = "xs";
84
- }
85
- render() {
86
- let t = "1";
87
- return this.size === "lg" ? t = "4" : this.size === "md" ? t = "2" : this.size === "sm" && (t = "1"), this.style.cssText = `
88
- --local-border-radius: var(--apkt-borderRadius-${t});
89
- `, this.dataset.size = this.size, this.imageSrc && (this.dataset.image = "true"), this.walletIcon && (this.dataset.walletIcon = this.walletIcon), c`
90
- <wui-flex justifyContent="center" alignItems="center"> ${this.templateVisual()} </wui-flex>
91
- `;
92
- }
93
- templateVisual() {
94
- return this.imageSrc ? c`<wui-image src=${this.imageSrc} alt=${this.name}></wui-image>` : this.walletIcon ? c`<wui-icon size="md" color="default" name=${this.walletIcon}></wui-icon>` : c`<wui-icon
95
- data-parent-size=${this.size}
96
- size="inherit"
97
- color="inherit"
98
- name="wallet"
99
- ></wui-icon>`;
100
- }
101
- };
102
- i.styles = [p, w];
103
- r([
104
- s()
105
- ], i.prototype, "size", void 0);
106
- r([
107
- s()
108
- ], i.prototype, "name", void 0);
109
- r([
110
- s()
111
- ], i.prototype, "imageSrc", void 0);
112
- r([
113
- s()
114
- ], i.prototype, "walletIcon", void 0);
115
- r([
116
- s({ type: Boolean })
117
- ], i.prototype, "installed", void 0);
118
- r([
119
- s()
120
- ], i.prototype, "badgeSize", void 0);
121
- i = r([
122
- f("wui-wallet-image")
123
- ], i);
@@ -1,65 +0,0 @@
1
- import { cU as h, cV as l, cX as u, cY as f } from "./index-D_8VUmn1.js";
2
- import { n as p, c as m } from "./index-CEqcN8QP.js";
3
- const g = h`
4
- :host {
5
- display: block;
6
- width: 100px;
7
- height: 100px;
8
- }
9
-
10
- svg {
11
- width: 100px;
12
- height: 100px;
13
- }
14
-
15
- rect {
16
- fill: none;
17
- stroke: ${(r) => r.colors.accent100};
18
- stroke-width: 3px;
19
- stroke-linecap: round;
20
- animation: dash 1s linear infinite;
21
- }
22
-
23
- @keyframes dash {
24
- to {
25
- stroke-dashoffset: 0px;
26
- }
27
- }
28
- `;
29
- var c = function(r, e, a, s) {
30
- var n = arguments.length, t = n < 3 ? e : s === null ? s = Object.getOwnPropertyDescriptor(e, a) : s, o;
31
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") t = Reflect.decorate(r, e, a, s);
32
- else for (var d = r.length - 1; d >= 0; d--) (o = r[d]) && (t = (n < 3 ? o(t) : n > 3 ? o(e, a, t) : o(e, a)) || t);
33
- return n > 3 && t && Object.defineProperty(e, a, t), t;
34
- };
35
- let i = class extends u {
36
- constructor() {
37
- super(...arguments), this.radius = 36;
38
- }
39
- render() {
40
- return this.svgLoaderTemplate();
41
- }
42
- svgLoaderTemplate() {
43
- const e = this.radius > 50 ? 50 : this.radius, s = 36 - e, n = 116 + s, t = 245 + s, o = 360 + s * 1.75;
44
- return f`
45
- <svg viewBox="0 0 110 110" width="110" height="110">
46
- <rect
47
- x="2"
48
- y="2"
49
- width="106"
50
- height="106"
51
- rx=${e}
52
- stroke-dasharray="${n} ${t}"
53
- stroke-dashoffset=${o}
54
- />
55
- </svg>
56
- `;
57
- }
58
- };
59
- i.styles = [l, g];
60
- c([
61
- p({ type: Number })
62
- ], i.prototype, "radius", void 0);
63
- i = c([
64
- m("wui-loading-thumbnail")
65
- ], i);