@cityofzion/appkit-stellar-adapter 0.0.1 → 1.0.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.
- package/LICENSE +201 -0
- package/README.md +166 -0
- package/dist/esm/adapter.js +254 -0
- package/dist/esm/adapter.js.map +1 -0
- package/dist/esm/connector.js +74 -0
- package/dist/esm/connector.js.map +1 -0
- package/dist/esm/constants.js +30 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/emitter.js +28 -0
- package/dist/esm/emitter.js.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/networks.js +32 -0
- package/dist/esm/networks.js.map +1 -0
- package/dist/types/adapter.d.ts +38 -0
- package/dist/types/adapter.d.ts.map +1 -0
- package/dist/types/connector.d.ts +42 -0
- package/dist/types/connector.d.ts.map +1 -0
- package/dist/types/constants.d.ts +17 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/emitter.d.ts +12 -0
- package/dist/types/emitter.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/networks.d.ts +4 -0
- package/dist/types/networks.d.ts.map +1 -0
- package/package.json +58 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# AppKit Stellar Adapter
|
|
2
|
+
|
|
3
|
+
An AppKit adapter for integrating Stellar blockchain support into your dApps.
|
|
4
|
+
|
|
5
|
+
## Live Demo
|
|
6
|
+
|
|
7
|
+
You can access the deployed project here: [Connect Lab on GitHub Pages](https://cityofzion.github.io/appkit-adapters/)
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This adapter enables seamless integration of Stellar blockchain functionality with [Reown AppKit](https://docs.reown.com/appkit) (formerly WalletConnect AppKit), allowing developers to build Stellar-enabled dApps with WalletConnect support.
|
|
12
|
+
|
|
13
|
+
> **💡 Need a working example?** Check out the [Connect Lab](../../apps/connect-lab/) project for a complete implementation demonstrating how to use this adapter in a real-world application.
|
|
14
|
+
|
|
15
|
+
> **📚 Learn more about AppKit:** Visit the official [Reown AppKit repository](https://github.com/reown-com/appkit) for comprehensive documentation, examples, and the latest updates on AppKit features.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @cityofzion/appkit-stellar-adapter
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Basic Setup
|
|
26
|
+
|
|
27
|
+
> **⚠️ IMPORTANT:** You **must** include the `universalProviderConfigOverride` option with `StellarConstants.OVERRIDES`. This is required because AppKit does not include Stellar methods in its default configuration.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { StellarAdapter, stellarMainnetNetwork, stellarTestnetNetwork, StellarConstants } from '@cityofzion/appkit-stellar-adapter';
|
|
31
|
+
import { createAppKit } from '@reown/appkit';
|
|
32
|
+
|
|
33
|
+
// Create AppKit instance with Stellar support
|
|
34
|
+
createAppKit({
|
|
35
|
+
projectId: 'YOUR_PROJECT_ID', // Get from https://cloud.reown.com
|
|
36
|
+
adapters: [new StellarAdapter()],
|
|
37
|
+
networks: [stellarMainnetNetwork, stellarTestnetNetwork],
|
|
38
|
+
metadata: {
|
|
39
|
+
name: 'My Stellar dApp',
|
|
40
|
+
description: 'My Stellar dApp description',
|
|
41
|
+
url: 'https://myapp.com',
|
|
42
|
+
icons: ['https://myapp.com/icon.png']
|
|
43
|
+
},
|
|
44
|
+
// REQUIRED: Register Stellar methods with WalletConnect
|
|
45
|
+
universalProviderConfigOverride: StellarConstants.OVERRIDES
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### React Example with AppKitProvider
|
|
50
|
+
|
|
51
|
+
> **⚠️ IMPORTANT:** Don't forget to include `universalProviderConfigOverride={StellarConstants.OVERRIDES}` in your AppKitProvider configuration. This is essential for Stellar functionality.
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import React from 'react';
|
|
55
|
+
import { AppKitProvider } from "@reown/appkit/react";
|
|
56
|
+
import { StellarAdapter, stellarMainnetNetwork, stellarTestnetNetwork, StellarConstants } from '@cityofzion/appkit-stellar-adapter';
|
|
57
|
+
|
|
58
|
+
function App() {
|
|
59
|
+
return (
|
|
60
|
+
<AppKitProvider
|
|
61
|
+
adapters={[new StellarAdapter()]}
|
|
62
|
+
networks={[stellarMainnetNetwork, stellarTestnetNetwork]}
|
|
63
|
+
projectId='YOUR_PROJECT_ID'
|
|
64
|
+
metadata={{
|
|
65
|
+
name: 'My Stellar dApp',
|
|
66
|
+
description: 'My Stellar dApp description',
|
|
67
|
+
url: 'https://myapp.com',
|
|
68
|
+
icons: ['https://myapp.com/icon.png']
|
|
69
|
+
}}
|
|
70
|
+
universalProviderConfigOverride={StellarConstants.OVERRIDES}
|
|
71
|
+
>
|
|
72
|
+
<YourApp />
|
|
73
|
+
</AppKitProvider>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default App;
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Available Networks
|
|
81
|
+
|
|
82
|
+
The adapter exports pre-configured Stellar networks:
|
|
83
|
+
|
|
84
|
+
- `stellarMainnetNetwork` - Stellar Mainnet
|
|
85
|
+
- `stellarTestnetNetwork` - Stellar Testnet
|
|
86
|
+
|
|
87
|
+
### Accessing the Stellar Provider in React
|
|
88
|
+
|
|
89
|
+
To interact with the Stellar blockchain in your React components, you can access the provider using the `useAppKitProvider` hook:
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { useAppKitProvider } from "@reown/appkit/react";
|
|
93
|
+
import type { StellarProvider } from '@cityofzion/appkit-stellar-adapter';
|
|
94
|
+
|
|
95
|
+
function MyComponent() {
|
|
96
|
+
// @ts-expect-error ChainNamespace does not include stellar
|
|
97
|
+
const { walletProvider } = useAppKitProvider<StellarProvider>("stellar");
|
|
98
|
+
|
|
99
|
+
const handleSignTransaction = async () => {
|
|
100
|
+
if (!walletProvider) {
|
|
101
|
+
console.error("Provider not available");
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
// Use the provider to interact with Stellar
|
|
107
|
+
const result = await walletProvider.signTransaction("your XDR transaction");
|
|
108
|
+
|
|
109
|
+
console.log("Transaction result:", result);
|
|
110
|
+
} catch (error) {
|
|
111
|
+
console.error("Error:", error);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<button onClick={handleSignTransaction}>
|
|
117
|
+
Sign transaction
|
|
118
|
+
</button>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## TypeScript Considerations
|
|
124
|
+
|
|
125
|
+
### Stellar Namespace Support
|
|
126
|
+
|
|
127
|
+
The Reown/AppKit types currently do not include `stellar` as a recognized namespace in their `ChainNamespace` type. This means TypeScript will show type errors when using Stellar-specific configurations.
|
|
128
|
+
|
|
129
|
+
To work around this limitation, you need to use the `@ts-expect-error` directive above lines that reference the `stellar` namespace:
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import { useAppKit, useDisconnect } from "@reown/appkit/react";
|
|
133
|
+
import { Fragment } from "react"
|
|
134
|
+
|
|
135
|
+
function ConnectButton() {
|
|
136
|
+
const appKit = useAppKit();
|
|
137
|
+
const { disconnect } = useDisconnect();
|
|
138
|
+
|
|
139
|
+
async function handleConnect() {
|
|
140
|
+
//@ts-expect-error ChainNamespace does not include stellar
|
|
141
|
+
await appKit.open({ namespace: "stellar" });
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async function handleDisconnect() {
|
|
145
|
+
//@ts-expect-error ChainNamespace does not include stellar
|
|
146
|
+
await disconnect({ namespace: : "stellar" });
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Fragment>
|
|
151
|
+
<button onClick={handleConnect}>Connect</button>
|
|
152
|
+
<button onClick={handleDisconnect}>Disconnect</button>
|
|
153
|
+
</Fragment>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
This is expected behavior and does not affect runtime functionality. The `@ts-expect-error` directive suppresses TypeScript errors while maintaining full Stellar functionality. The pre-configured networks exported by this package (`stellarMainnetNetwork` and `stellarTestnetNetwork`) already include these directives, so you typically won't need to add them when using the exported networks.
|
|
159
|
+
|
|
160
|
+
## Contributing
|
|
161
|
+
|
|
162
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
163
|
+
|
|
164
|
+
## Author
|
|
165
|
+
|
|
166
|
+
Created by [Raul Duarte Pereira](https://github.com/raulduartep)
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { AdapterBlueprint, CoreHelperUtil, WcHelpersUtil, } from "@reown/appkit-controllers";
|
|
2
|
+
import { StellarConnector } from "./connector.js";
|
|
3
|
+
import { StellarConstants } from "./constants.js";
|
|
4
|
+
import { ConstantsUtil as CommonConstantsUtil, UserRejectedRequestError, } from "@reown/appkit-common";
|
|
5
|
+
export class StellarAdapter extends AdapterBlueprint {
|
|
6
|
+
constructor(params = {}) {
|
|
7
|
+
super({
|
|
8
|
+
adapterType: "stellar",
|
|
9
|
+
// @ts-expect-error AppKit does not stellar namespace included in ChainNamespace
|
|
10
|
+
namespace: "stellar",
|
|
11
|
+
...params,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
async setUniversalProvider(universalProvider) {
|
|
15
|
+
if (!this.namespace) {
|
|
16
|
+
throw new Error("StellarAdapter:setUniversalProvider - Namespace is not defined.");
|
|
17
|
+
}
|
|
18
|
+
const wcConnectorId = CommonConstantsUtil.CONNECTOR_ID.WALLET_CONNECT;
|
|
19
|
+
WcHelpersUtil.listenWcProvider({
|
|
20
|
+
universalProvider,
|
|
21
|
+
namespace: this.namespace,
|
|
22
|
+
onConnect: (accounts) => this.onConnect(accounts, wcConnectorId),
|
|
23
|
+
onDisconnect: () => this.onDisconnect(wcConnectorId),
|
|
24
|
+
onAccountsChanged: (accounts) => super.onAccountsChanged(accounts, wcConnectorId, false),
|
|
25
|
+
});
|
|
26
|
+
this.addConnector(new StellarConnector({
|
|
27
|
+
provider: universalProvider,
|
|
28
|
+
caipNetworks: this.getCaipNetworks(),
|
|
29
|
+
namespace: this.namespace,
|
|
30
|
+
}));
|
|
31
|
+
return Promise.resolve();
|
|
32
|
+
}
|
|
33
|
+
async connect(params) {
|
|
34
|
+
const connector = this.connectors.find((c) => c.id === params.id);
|
|
35
|
+
if (!connector || !connector.provider) {
|
|
36
|
+
throw new Error("StellarAdapter:connect - connector is undefined");
|
|
37
|
+
}
|
|
38
|
+
const chain = connector.chains.find((c) => c.id === params.chainId) ||
|
|
39
|
+
connector.chains[0];
|
|
40
|
+
if (!chain) {
|
|
41
|
+
throw new Error("StellarAdapter:connect - The connector does not support any of the requested chains");
|
|
42
|
+
}
|
|
43
|
+
if (params.address) {
|
|
44
|
+
const connection = this.getConnection({
|
|
45
|
+
address: params.address,
|
|
46
|
+
connectorId: connector.id,
|
|
47
|
+
connections: this.connections,
|
|
48
|
+
connectors: this.connectors,
|
|
49
|
+
});
|
|
50
|
+
if (connection?.account && connection.caipNetwork) {
|
|
51
|
+
this.emit("accountChanged", {
|
|
52
|
+
address: connection.account.address,
|
|
53
|
+
chainId: connection.caipNetwork.id,
|
|
54
|
+
connector,
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
id: connector.id,
|
|
58
|
+
type: connector.type,
|
|
59
|
+
address: connection.account.address,
|
|
60
|
+
chainId: chain.id,
|
|
61
|
+
provider: connector.provider,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const address = await connector.connect().catch((err) => {
|
|
66
|
+
throw new UserRejectedRequestError(err);
|
|
67
|
+
});
|
|
68
|
+
this.emit("accountChanged", {
|
|
69
|
+
address,
|
|
70
|
+
chainId: chain.id,
|
|
71
|
+
connector,
|
|
72
|
+
});
|
|
73
|
+
const accounts = await this.getAccounts({
|
|
74
|
+
id: connector.id,
|
|
75
|
+
namespace: this.namespace,
|
|
76
|
+
});
|
|
77
|
+
this.addConnection({
|
|
78
|
+
connectorId: connector.id,
|
|
79
|
+
accounts: accounts.accounts.map((a) => ({
|
|
80
|
+
address: a.address,
|
|
81
|
+
type: a.type,
|
|
82
|
+
publicKey: a.publicKey,
|
|
83
|
+
path: a.path,
|
|
84
|
+
})),
|
|
85
|
+
caipNetwork: chain,
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
id: connector.id,
|
|
89
|
+
type: connector.type,
|
|
90
|
+
address,
|
|
91
|
+
chainId: chain.id,
|
|
92
|
+
provider: connector.provider,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
async disconnect(params) {
|
|
96
|
+
if (params.id) {
|
|
97
|
+
const connector = this.connectors.find((c) => c.id.toLowerCase() === params.id?.toLowerCase());
|
|
98
|
+
if (!connector?.provider) {
|
|
99
|
+
throw new Error("StellarAdapter:disconnect - connector.provider is undefined");
|
|
100
|
+
}
|
|
101
|
+
const connection = this.getConnection({
|
|
102
|
+
connectorId: params.id,
|
|
103
|
+
connections: this.connections,
|
|
104
|
+
connectors: this.connectors,
|
|
105
|
+
});
|
|
106
|
+
await connector.provider.disconnect();
|
|
107
|
+
this.removeProviderListeners(connector.id);
|
|
108
|
+
this.deleteConnection(connector.id);
|
|
109
|
+
if (this.connections.length === 0) {
|
|
110
|
+
this.emit("disconnect");
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this.emitFirstAvailableConnection();
|
|
114
|
+
}
|
|
115
|
+
return { connections: connection ? [connection] : [] };
|
|
116
|
+
}
|
|
117
|
+
return this.disconnectAll();
|
|
118
|
+
}
|
|
119
|
+
async disconnectAll() {
|
|
120
|
+
const connections = await Promise.all(this.connections.map(async (connection) => {
|
|
121
|
+
const connector = this.connectors.find((c) => c.id.toLowerCase() === connection.connectorId.toLowerCase());
|
|
122
|
+
if (!connector) {
|
|
123
|
+
throw new Error("Connector not found");
|
|
124
|
+
}
|
|
125
|
+
await this.disconnect({
|
|
126
|
+
id: connector.id,
|
|
127
|
+
});
|
|
128
|
+
return connection;
|
|
129
|
+
}));
|
|
130
|
+
return { connections };
|
|
131
|
+
}
|
|
132
|
+
async getAccounts({ namespace, }) {
|
|
133
|
+
const provider = this.provider;
|
|
134
|
+
const addresses = provider.session?.namespaces[namespace]?.accounts
|
|
135
|
+
.map((account) => {
|
|
136
|
+
const [, , address] = account.split(":");
|
|
137
|
+
return address;
|
|
138
|
+
})
|
|
139
|
+
.filter((address, index, self) => self.indexOf(address) === index) || [];
|
|
140
|
+
return Promise.resolve({
|
|
141
|
+
accounts: addresses.map((address) => CoreHelperUtil.createAccount(namespace, address, "eoa")),
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
getWalletConnectProvider() {
|
|
145
|
+
return this.connectors.find((c) => c.type === "WALLET_CONNECT");
|
|
146
|
+
}
|
|
147
|
+
async getBalance(params) {
|
|
148
|
+
const { address, chainId } = params;
|
|
149
|
+
const horizonUrl = chainId
|
|
150
|
+
? StellarConstants.HORIZON_URL_BY_ID[chainId]
|
|
151
|
+
: undefined;
|
|
152
|
+
if (!address || !horizonUrl) {
|
|
153
|
+
return {
|
|
154
|
+
balance: "0",
|
|
155
|
+
symbol: StellarConstants.XLM_TOKEN.symbol,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
let balances = [];
|
|
159
|
+
try {
|
|
160
|
+
const response = await fetch(`${horizonUrl}/accounts/${address}`, {
|
|
161
|
+
method: "GET",
|
|
162
|
+
headers: {
|
|
163
|
+
"Content-Type": "application/json",
|
|
164
|
+
Accept: "application/json",
|
|
165
|
+
},
|
|
166
|
+
redirect: "follow",
|
|
167
|
+
});
|
|
168
|
+
const data = await response.json();
|
|
169
|
+
balances = data?.balances || [];
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
/* empty */
|
|
173
|
+
}
|
|
174
|
+
const xlmBalanceObj = balances.find((balanceObj) => balanceObj.asset_type === "native");
|
|
175
|
+
const balance = xlmBalanceObj ? xlmBalanceObj.balance : "0";
|
|
176
|
+
return {
|
|
177
|
+
balance: this.formatUnits({
|
|
178
|
+
value: balance,
|
|
179
|
+
decimals: StellarConstants.XLM_TOKEN.decimals,
|
|
180
|
+
}),
|
|
181
|
+
symbol: StellarConstants.XLM_TOKEN.symbol,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
parseUnits(params) {
|
|
185
|
+
const { value, decimals } = params;
|
|
186
|
+
const [integerPart, fractionalPart = ""] = value.split(".");
|
|
187
|
+
const paddedFractionalPart = fractionalPart
|
|
188
|
+
.padEnd(decimals, "0")
|
|
189
|
+
.slice(0, decimals);
|
|
190
|
+
const combined = integerPart + paddedFractionalPart;
|
|
191
|
+
return BigInt(combined);
|
|
192
|
+
}
|
|
193
|
+
formatUnits(params) {
|
|
194
|
+
const { value, decimals } = params;
|
|
195
|
+
const divisor = BigInt(10) ** BigInt(decimals);
|
|
196
|
+
const integerPart = BigInt(value) / divisor;
|
|
197
|
+
const fractionalPart = BigInt(value) % divisor;
|
|
198
|
+
const fractionalPartStr = fractionalPart
|
|
199
|
+
.toString()
|
|
200
|
+
.padStart(decimals, "0")
|
|
201
|
+
.replace(/0+$/, ""); // Remove trailing zeros
|
|
202
|
+
return fractionalPartStr
|
|
203
|
+
? `${integerPart.toString()}.${fractionalPartStr}`
|
|
204
|
+
: integerPart.toString();
|
|
205
|
+
}
|
|
206
|
+
syncConnections() {
|
|
207
|
+
// It should return an promises even if nothing is done here. It should not throw an error because it is called on appkit connect flow
|
|
208
|
+
return Promise.resolve();
|
|
209
|
+
}
|
|
210
|
+
syncConnectors() {
|
|
211
|
+
// It should return an promises even if nothing is done here. It should not throw an error because it is called on appkit connect flow
|
|
212
|
+
return Promise.resolve();
|
|
213
|
+
}
|
|
214
|
+
async syncConnection() {
|
|
215
|
+
return Promise.resolve({
|
|
216
|
+
id: "WALLET_CONNECT",
|
|
217
|
+
type: "WALLET_CONNECT",
|
|
218
|
+
chainId: 1,
|
|
219
|
+
provider: this.provider,
|
|
220
|
+
address: "",
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
writeSolanaTransaction() {
|
|
224
|
+
throw new Error("StellarAdapter:writeContract - Not supported.");
|
|
225
|
+
}
|
|
226
|
+
signMessage(_params) {
|
|
227
|
+
throw new Error("StellarAdapter:signMessage - Not supported.");
|
|
228
|
+
}
|
|
229
|
+
estimateGas() {
|
|
230
|
+
throw new Error("StellarAdapter:estimateGas - Not supported.");
|
|
231
|
+
}
|
|
232
|
+
sendTransaction() {
|
|
233
|
+
throw new Error("StellarAdapter:sendTransaction - Not supported.");
|
|
234
|
+
}
|
|
235
|
+
walletGetAssets(_params) {
|
|
236
|
+
throw new Error("StellarAdapter:walletGetAssets - Not supported.");
|
|
237
|
+
}
|
|
238
|
+
writeContract() {
|
|
239
|
+
throw new Error("StellarAdapter:writeContract - Not supported.");
|
|
240
|
+
}
|
|
241
|
+
getCapabilities() {
|
|
242
|
+
throw new Error("StellarAdapter:getCapabilities - Not supported.");
|
|
243
|
+
}
|
|
244
|
+
grantPermissions() {
|
|
245
|
+
throw new Error("StellarAdapter:grantPermissions - Not supported.");
|
|
246
|
+
}
|
|
247
|
+
revokePermissions() {
|
|
248
|
+
throw new Error("StellarAdapter:revokePermissions - Not supported.");
|
|
249
|
+
}
|
|
250
|
+
switchNetwork(_params) {
|
|
251
|
+
throw new Error("StellarAdapter:switchNetwork - Not supported.");
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,GACd,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,aAAa,IAAI,mBAAmB,EACpC,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,OAAO,cAAe,SAAQ,gBAAgB;IAClD,YAAY,SAAkC,EAAE;QAC9C,KAAK,CAAC;YACJ,WAAW,EAAE,SAAS;YACtB,gFAAgF;YAChF,SAAS,EAAE,SAAS;YACpB,GAAG,MAAM;SACV,CAAC,CAAC;IACL,CAAC;IAEe,KAAK,CAAC,oBAAoB,CACxC,iBAAoC;QAEpC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;QACJ,CAAC;QAED,MAAM,aAAa,GAAG,mBAAmB,CAAC,YAAY,CAAC,cAAc,CAAC;QAEtE,aAAa,CAAC,gBAAgB,CAAC;YAC7B,iBAAiB;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC;YAChE,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC;YACpD,iBAAiB,EAAE,CAAC,QAAQ,EAAE,EAAE,CAC9B,KA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,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAEe,aAAa,CAC3B,OAA6C;QAE7C,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;CACF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ChainController, WalletConnectConnector, WcHelpersUtil, } from "@reown/appkit-controllers";
|
|
2
|
+
import { ProviderEventEmitter } from "./emitter.js";
|
|
3
|
+
export class StellarConnector extends WalletConnectConnector {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.eventEmitter = new ProviderEventEmitter();
|
|
7
|
+
this.emit = this.eventEmitter.emit.bind(this.eventEmitter);
|
|
8
|
+
this.on = this.eventEmitter.on.bind(this.eventEmitter);
|
|
9
|
+
this.removeListener = this.eventEmitter.removeListener.bind(this.eventEmitter);
|
|
10
|
+
}
|
|
11
|
+
get session() {
|
|
12
|
+
return this.provider.session;
|
|
13
|
+
}
|
|
14
|
+
get sessionChains() {
|
|
15
|
+
return WcHelpersUtil.getChainsFromNamespaces(this.provider.session?.namespaces);
|
|
16
|
+
}
|
|
17
|
+
get chains() {
|
|
18
|
+
return this.sessionChains
|
|
19
|
+
.map((chainId) => this.caipNetworks.find((chain) => chain.caipNetworkId === chainId))
|
|
20
|
+
.filter(Boolean);
|
|
21
|
+
}
|
|
22
|
+
async connect() {
|
|
23
|
+
const { session } = await super.connectWalletConnect();
|
|
24
|
+
const account = session.namespaces[this.chain]?.accounts[0];
|
|
25
|
+
const address = account?.split(":")[2];
|
|
26
|
+
if (!address) {
|
|
27
|
+
throw new Error("No account found in session");
|
|
28
|
+
}
|
|
29
|
+
this.emit("connect", address);
|
|
30
|
+
return address;
|
|
31
|
+
}
|
|
32
|
+
async request(args) {
|
|
33
|
+
const caipNetwork = ChainController.getCaipNetworkByNamespace(this.chain);
|
|
34
|
+
return await this.provider.request(args, caipNetwork?.caipNetworkId);
|
|
35
|
+
}
|
|
36
|
+
async signTransaction(xdr) {
|
|
37
|
+
const { signedXDR, signerAddress } = await this.request({
|
|
38
|
+
method: "stellar_signXDR",
|
|
39
|
+
params: { xdr },
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
signedTxXdr: signedXDR,
|
|
43
|
+
signerAddress,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
async signAndSubmitTransaction(xdr) {
|
|
47
|
+
const resp = await this.request({
|
|
48
|
+
method: "stellar_signAndSubmitXDR",
|
|
49
|
+
params: { xdr },
|
|
50
|
+
});
|
|
51
|
+
return resp;
|
|
52
|
+
}
|
|
53
|
+
async signMessage(message) {
|
|
54
|
+
const resp = await this.request({
|
|
55
|
+
method: "stellar_signMessage",
|
|
56
|
+
params: { message },
|
|
57
|
+
});
|
|
58
|
+
return resp;
|
|
59
|
+
}
|
|
60
|
+
async signAuthEntry(xdr) {
|
|
61
|
+
const resp = await this.request({
|
|
62
|
+
method: "stellar_signAuthEntry",
|
|
63
|
+
params: { xdr },
|
|
64
|
+
});
|
|
65
|
+
return resp;
|
|
66
|
+
}
|
|
67
|
+
async getNetwork() {
|
|
68
|
+
const resp = await this.request({
|
|
69
|
+
method: "stellar_getNetwork",
|
|
70
|
+
});
|
|
71
|
+
return resp;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector.js","sourceRoot":"","sources":["../../src/connector.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,aAAa,GAEd,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAkCpD,MAAM,OAAO,gBACX,SAAQ,sBAAsB;IADhC;;QAImB,iBAAY,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC3C,SAAI,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,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|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
export class StellarConstants {
|
|
3
|
+
}
|
|
4
|
+
_a = StellarConstants;
|
|
5
|
+
StellarConstants.XLM_TOKEN = {
|
|
6
|
+
symbol: "XLM",
|
|
7
|
+
name: "Lumens",
|
|
8
|
+
decimals: 7,
|
|
9
|
+
};
|
|
10
|
+
StellarConstants.HORIZON_URL_BY_ID = {
|
|
11
|
+
pubnet: "https://horizon.stellar.org",
|
|
12
|
+
testnet: "https://horizon-testnet.stellar.org",
|
|
13
|
+
};
|
|
14
|
+
StellarConstants.METHODS = [
|
|
15
|
+
"stellar_signXDR",
|
|
16
|
+
"stellar_signAndSubmitXDR",
|
|
17
|
+
"stellar_signMessage",
|
|
18
|
+
"stellar_signAuthEntry",
|
|
19
|
+
"stellar_getNetwork",
|
|
20
|
+
];
|
|
21
|
+
StellarConstants.EVENTS = [];
|
|
22
|
+
StellarConstants.OVERRIDES = {
|
|
23
|
+
methods: {
|
|
24
|
+
stellar: _a.METHODS,
|
|
25
|
+
},
|
|
26
|
+
events: {
|
|
27
|
+
stellar: _a.EVENTS,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";AAAA,MAAM,OAAO,gBAAgB;;;AACX,0BAAS,GAAG;IAC1B,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC;CACH,AAJe,CAId;AAEK,kCAAiB,GAA2B;IAC1D,MAAM,EAAE,6BAA6B;IACrC,OAAO,EAAE,qCAAqC;CAC/C,AAHgC,CAG/B;AAEc,wBAAO,GAAa;IAClC,iBAAiB;IACjB,0BAA0B;IAC1B,qBAAqB;IACrB,uBAAuB;IACvB,oBAAoB;CACrB,AANsB,CAMrB;AAEc,uBAAM,GAAa,EAAE,AAAf,CAAgB;AAEtB,0BAAS,GAKrB;IACF,OAAO,EAAE;QACP,OAAO,EAAE,EAAI,CAAC,OAAO;KACtB;IACD,MAAM,EAAE;QACN,OAAO,EAAE,EAAI,CAAC,MAAM;KACrB;CACF,AAZwB,CAYvB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export class ProviderEventEmitter {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.listeners = {
|
|
4
|
+
accountsChanged: [],
|
|
5
|
+
chainChanged: [],
|
|
6
|
+
connect: [],
|
|
7
|
+
disconnect: [],
|
|
8
|
+
display_uri: [],
|
|
9
|
+
message: [],
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
on(event, listener) {
|
|
13
|
+
this.listeners[event].push(listener);
|
|
14
|
+
}
|
|
15
|
+
removeListener(event, listener) {
|
|
16
|
+
if (event in this.listeners) {
|
|
17
|
+
// @ts-expect-error - Bad typed Provider from core package
|
|
18
|
+
this.listeners[event] = this.listeners[event].filter((l) => l !== listener);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
emit(event, data) {
|
|
22
|
+
if (event in this.listeners) {
|
|
23
|
+
// @ts-expect-error - Bad typed Provider from core package
|
|
24
|
+
this.listeners[event].forEach((listener) => listener(data));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAkBA,MAAM,OAAO,oBAAoB;IAAjC;QACU,cAAS,GAAc;YAC7B,eAAe,EAAE,EAAE;YACnB,YAAY,EAAE,EAAE;YAChB,OAAO,EAAE,EAAE;YACX,UAAU,EAAE,EAAE;YACd,WAAW,EAAE,EAAE;YACf,OAAO,EAAE,EAAE;SACZ,CAAC;IAqBJ,CAAC;IAnBC,EAAE,CAAuB,KAAY,EAAE,QAAyB;QAC9D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,cAAc,CAAI,KAAa,EAAE,QAA2B;QAC1D,IAAI,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAC5B,0DAA0D;YAC1D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,CAClD,CAAC,CAAmB,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,CACxC,CAAC;QACJ,CAAC;IACH,CAAC;IAEM,IAAI,CAAC,KAAa,EAAE,IAAc;QACvC,IAAI,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAC5B,0DAA0D;YAC1D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAE7B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {} from "@reown/appkit/networks";
|
|
2
|
+
import { StellarConstants } from "./constants.js";
|
|
3
|
+
export const stellarMainnetNetwork = {
|
|
4
|
+
id: "pubnet",
|
|
5
|
+
// @ts-expect-error AppKit does not stellar namespace included in ChainNamespace
|
|
6
|
+
caipNetworkId: "stellar:pubnet",
|
|
7
|
+
// @ts-expect-error AppKit does not stellar namespace included in ChainNamespace
|
|
8
|
+
chainNamespace: "stellar",
|
|
9
|
+
nativeCurrency: StellarConstants.XLM_TOKEN,
|
|
10
|
+
rpcUrls: {
|
|
11
|
+
default: {
|
|
12
|
+
http: ["https://soroban-rpc.mainnet.stellar.gateway.fm"],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
name: "Stellar Mainnet",
|
|
16
|
+
};
|
|
17
|
+
export const stellarTestnetNetwork = {
|
|
18
|
+
id: "testnet",
|
|
19
|
+
// @ts-expect-error AppKit does not stellar namespace included in ChainNamespace
|
|
20
|
+
caipNetworkId: "stellar:testnet",
|
|
21
|
+
// @ts-expect-error AppKit does not stellar namespace included in ChainNamespace
|
|
22
|
+
chainNamespace: "stellar",
|
|
23
|
+
nativeCurrency: StellarConstants.XLM_TOKEN,
|
|
24
|
+
rpcUrls: {
|
|
25
|
+
default: {
|
|
26
|
+
http: ["https://soroban-rpc.testnet.stellar.gateway.fm"],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
name: "Stellar Testnet",
|
|
30
|
+
testnet: true,
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=networks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networks.js","sourceRoot":"","sources":["../../src/networks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,qBAAqB,GAAkB;IAClD,EAAE,EAAE,QAAQ;IAEZ,gFAAgF;IAChF,aAAa,EAAE,gBAAgB;IAE/B,gFAAgF;IAChF,cAAc,EAAE,SAAS;IAEzB,cAAc,EAAE,gBAAgB,CAAC,SAAS;IAE1C,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,gDAAgD,CAAC;SACzD;KACF;IAED,IAAI,EAAE,iBAAiB;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAkB;IAClD,EAAE,EAAE,SAAS;IAEb,gFAAgF;IAChF,aAAa,EAAE,iBAAiB;IAEhC,gFAAgF;IAChF,cAAc,EAAE,SAAS;IAEzB,cAAc,EAAE,gBAAgB,CAAC,SAAS;IAE1C,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,gDAAgD,CAAC;SACzD;KACF;IAED,IAAI,EAAE,iBAAiB;IAEvB,OAAO,EAAE,IAAI;CACd,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AdapterBlueprint } from "@reown/appkit-controllers";
|
|
2
|
+
import type UniversalProvider from "@walletconnect/universal-provider";
|
|
3
|
+
import type { ChainNamespace } from "@reown/appkit/networks";
|
|
4
|
+
import { StellarConnector } from "./connector.js";
|
|
5
|
+
export declare class StellarAdapter extends AdapterBlueprint {
|
|
6
|
+
constructor(params?: AdapterBlueprint.Params);
|
|
7
|
+
setUniversalProvider(universalProvider: UniversalProvider): Promise<void>;
|
|
8
|
+
connect(params: AdapterBlueprint.ConnectParams): Promise<AdapterBlueprint.ConnectResult>;
|
|
9
|
+
disconnect(params: AdapterBlueprint.DisconnectParams): Promise<AdapterBlueprint.DisconnectResult>;
|
|
10
|
+
private disconnectAll;
|
|
11
|
+
getAccounts({ namespace, }: AdapterBlueprint.GetAccountsParams & {
|
|
12
|
+
namespace: ChainNamespace;
|
|
13
|
+
}): Promise<AdapterBlueprint.GetAccountsResult>;
|
|
14
|
+
getWalletConnectProvider(): StellarConnector;
|
|
15
|
+
getBalance(params: AdapterBlueprint.GetBalanceParams): Promise<AdapterBlueprint.GetBalanceResult>;
|
|
16
|
+
parseUnits(params: AdapterBlueprint.ParseUnitsParams): AdapterBlueprint.ParseUnitsResult;
|
|
17
|
+
formatUnits(params: AdapterBlueprint.FormatUnitsParams): AdapterBlueprint.FormatUnitsResult;
|
|
18
|
+
syncConnections(): Promise<void>;
|
|
19
|
+
syncConnectors(): Promise<void>;
|
|
20
|
+
syncConnection(): Promise<{
|
|
21
|
+
id: string;
|
|
22
|
+
type: "WALLET_CONNECT";
|
|
23
|
+
chainId: number;
|
|
24
|
+
provider: UniversalProvider;
|
|
25
|
+
address: string;
|
|
26
|
+
}>;
|
|
27
|
+
writeSolanaTransaction(): Promise<AdapterBlueprint.WriteSolanaTransactionResult>;
|
|
28
|
+
signMessage(_params: AdapterBlueprint.SignMessageParams): Promise<AdapterBlueprint.SignMessageResult>;
|
|
29
|
+
estimateGas(): Promise<AdapterBlueprint.EstimateGasTransactionResult>;
|
|
30
|
+
sendTransaction(): Promise<AdapterBlueprint.SendTransactionResult>;
|
|
31
|
+
walletGetAssets(_params: AdapterBlueprint.WalletGetAssetsParams): Promise<AdapterBlueprint.WalletGetAssetsResponse>;
|
|
32
|
+
writeContract(): Promise<AdapterBlueprint.WriteContractResult>;
|
|
33
|
+
getCapabilities(): Promise<unknown>;
|
|
34
|
+
grantPermissions(): Promise<unknown>;
|
|
35
|
+
revokePermissions(): Promise<`0x${string}`>;
|
|
36
|
+
switchNetwork(_params: AdapterBlueprint.SwitchNetworkParams): Promise<any>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,iBAAiB,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOlD,qBAAa,cAAe,SAAQ,gBAAgB;gBACtC,MAAM,GAAE,gBAAgB,CAAC,MAAW;IAS1B,oBAAoB,CACxC,iBAAiB,EAAE,iBAAiB,GACnC,OAAO,CAAC,IAAI,CAAC;IA6BD,OAAO,CACpB,MAAM,EAAE,gBAAgB,CAAC,aAAa,GACrC,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC;IA+EpB,UAAU,CAC9B,MAAM,EAAE,gBAAg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AC,mBAAmB,GAC5C,OAAO,CAAC,GAAG,CAAC;CAGhB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { WalletConnectConnector, type Provider } from "@reown/appkit-controllers";
|
|
2
|
+
import type { RequestArguments } from "@walletconnect/universal-provider";
|
|
3
|
+
import type { SessionTypes } from "@walletconnect/types";
|
|
4
|
+
import type { CaipNetwork } from "@reown/appkit-common";
|
|
5
|
+
type TStellarConnectorSignXDRResponse = {
|
|
6
|
+
signedTxXdr: string;
|
|
7
|
+
signerAddress: string;
|
|
8
|
+
};
|
|
9
|
+
type TStellarConnectorSignAndSubmitXDRResponse = {
|
|
10
|
+
hash: string;
|
|
11
|
+
status: string;
|
|
12
|
+
};
|
|
13
|
+
type TStellarConnectorSignMessageResponse = {
|
|
14
|
+
signedMessage: string;
|
|
15
|
+
signerAddress: string;
|
|
16
|
+
};
|
|
17
|
+
type TStellarConnectorSignAuthEntryResponse = {
|
|
18
|
+
signedAuthEntry: string;
|
|
19
|
+
signerAddress: string;
|
|
20
|
+
};
|
|
21
|
+
type TStellarConnectorGetNetworkResponse = {
|
|
22
|
+
network: "PUBLIC" | "TESTNET";
|
|
23
|
+
networkPassphrase: string;
|
|
24
|
+
};
|
|
25
|
+
export declare class StellarConnector extends WalletConnectConnector implements Provider {
|
|
26
|
+
private readonly eventEmitter;
|
|
27
|
+
readonly emit: (event: string, data?: unknown) => void;
|
|
28
|
+
readonly on: <Event extends keyof import("@reown/appkit-controllers").ProviderEventListener>(event: Event, listener: import("@reown/appkit-controllers").ProviderEventListener[Event]) => void;
|
|
29
|
+
readonly removeListener: <T>(event: string, listener: (data: T) => void) => void;
|
|
30
|
+
get session(): SessionTypes.Struct | undefined;
|
|
31
|
+
private get sessionChains();
|
|
32
|
+
get chains(): CaipNetwork[];
|
|
33
|
+
connect(): Promise<string>;
|
|
34
|
+
request<T>(args: RequestArguments): Promise<T>;
|
|
35
|
+
signTransaction(xdr: string): Promise<TStellarConnectorSignXDRResponse>;
|
|
36
|
+
signAndSubmitTransaction(xdr: string): Promise<TStellarConnectorSignAndSubmitXDRResponse>;
|
|
37
|
+
signMessage(message: string): Promise<TStellarConnectorSignMessageResponse>;
|
|
38
|
+
signAuthEntry(xdr: string): Promise<TStellarConnectorSignAuthEntryResponse>;
|
|
39
|
+
getNetwork(): Promise<TStellarConnectorGetNetworkResponse>;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=connector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../src/connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EAEtB,KAAK,QAAQ,EACd,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAOxD,KAAK,gCAAgC,GAAG;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,yCAAyC,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,oCAAoC,GAAG;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,sCAAsC,GAAG;IAC5C,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,mCAAmC,GAAG;IACzC,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC9B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,qBAAa,gBACX,SAAQ,sBACR,YAAW,QAAQ;IAEnB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA8B;IAC3D,SAAgB,IAAI,0CAAkD;IACtE,SAAgB,EAAE,oLAAgD;IAClE,SAAgB,cAAc,0DAE5B;IAEF,IAAW,OAAO,IAAI,YAAY,CAAC,MAAM,GAAG,SAAS,CAEpD;IAED,OAAO,KAAK,aAAa,GAIxB;IAED,IAAoB,MAAM,IAKF,WAAW,EAAE,CACpC;IAEK,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAc1B,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC;IAK9C,eAAe,CACnB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,gCAAgC,CAAC;IAatC,wBAAwB,CAC5B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,yCAAyC,CAAC;IAS/C,WAAW,CACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,oCAAoC,CAAC;IAS1C,aAAa,CACjB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,sCAAsC,CAAC;IAS5C,UAAU,IAAI,OAAO,CAAC,mCAAmC,CAAC;CAOjE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class StellarConstants {
|
|
2
|
+
static readonly XLM_TOKEN: {
|
|
3
|
+
readonly symbol: "XLM";
|
|
4
|
+
readonly name: "Lumens";
|
|
5
|
+
readonly decimals: 7;
|
|
6
|
+
};
|
|
7
|
+
static readonly HORIZON_URL_BY_ID: Record<string, string>;
|
|
8
|
+
static readonly METHODS: string[];
|
|
9
|
+
static readonly EVENTS: string[];
|
|
10
|
+
static readonly OVERRIDES: {
|
|
11
|
+
methods?: Record<string, string[]>;
|
|
12
|
+
chains?: Record<string, string[]>;
|
|
13
|
+
events?: Record<string, string[]>;
|
|
14
|
+
rpcMap?: Record<string, string>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,SAAS;;;;MAId;IAEX,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGvD;IAEF,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAM/B;IAEF,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAM;IAEtC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE;QACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAClC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAClC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACjC,CAOC;CACH"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Provider, ProviderEventListener } from "@reown/appkit-controllers";
|
|
2
|
+
type ProviderEventEmitterMethods = Pick<Provider, "on" | "removeListener" | "emit">;
|
|
3
|
+
type Events = keyof ProviderEventListener;
|
|
4
|
+
type Listener<Event extends Events> = ProviderEventListener[Event];
|
|
5
|
+
export declare class ProviderEventEmitter implements ProviderEventEmitterMethods {
|
|
6
|
+
private listeners;
|
|
7
|
+
on<Event extends Events>(event: Event, listener: Listener<Event>): void;
|
|
8
|
+
removeListener<T>(event: string, listener: (data: T) => void): void;
|
|
9
|
+
emit(event: string, data?: unknown): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,KAAK,2BAA2B,GAAG,IAAI,CACrC,QAAQ,EACR,IAAI,GAAG,gBAAgB,GAAG,MAAM,CACjC,CAAC;AAEF,KAAK,MAAM,GAAG,MAAM,qBAAqB,CAAC;AAE1C,KAAK,QAAQ,CAAC,KAAK,SAAS,MAAM,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;AAMnE,qBAAa,oBAAqB,YAAW,2BAA2B;IACtE,OAAO,CAAC,SAAS,CAOf;IAEF,EAAE,CAAC,KAAK,SAAS,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI;IAIvE,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI;IASrD,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CAM1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAE7B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,eAAe,CAAC;AAE9B,MAAM,MAAM,eAAe,GAAG,OAAO,gBAAgB,EAAE,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../../src/networks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAG5D,eAAO,MAAM,qBAAqB,EAAE,aAkBnC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,aAoBnC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/appkit-stellar-adapter",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "AppKit adapter for Stellar blockchain",
|
|
5
|
+
"author": "Raul Duarte Pereira (https://github.com/raulduartep)",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/CityOfZion/appkit-adapters.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"appkit",
|
|
13
|
+
"wallet",
|
|
14
|
+
"dapps",
|
|
15
|
+
"web3",
|
|
16
|
+
"stellar",
|
|
17
|
+
"blockchain",
|
|
18
|
+
"adapter"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"main": "./dist/esm/index.js",
|
|
25
|
+
"types": "./dist/types/exports/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/types/index.d.ts",
|
|
29
|
+
"import": "./dist/esm/index.js",
|
|
30
|
+
"default": "./dist/esm/index.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"type": "module",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/CityOfZion/appkit-adapters/issues"
|
|
8
36
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
37
|
+
"homepage": "https://github.com/CityOfZion/appkit-adapters/packages/appkit-stellar-adapter#readme",
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@eslint/js": "^9.36.0",
|
|
40
|
+
"@types/node": "^25.1.0",
|
|
41
|
+
"@walletconnect/types": "^2.23.4",
|
|
42
|
+
"eslint": "^9.39.2",
|
|
43
|
+
"eslint-config-prettier": "^10.1.8",
|
|
44
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
45
|
+
"prettier": "^3.6.2",
|
|
46
|
+
"typescript": "^5.9.3",
|
|
47
|
+
"typescript-eslint": "^8.44.1"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@reown/appkit": "*",
|
|
51
|
+
"@reown/appkit-common": "*",
|
|
52
|
+
"@reown/appkit-controllers": "*",
|
|
53
|
+
"@walletconnect/universal-provider": "*"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "rm -rf ./dist && npm run typecheck && tsc --project tsconfig.json",
|
|
57
|
+
"format": "eslint --fix",
|
|
58
|
+
"lint": "eslint .",
|
|
59
|
+
"typecheck": "tsc --noEmit"
|
|
60
|
+
}
|
|
61
|
+
}
|