@dynamic-labs/algorand 1.0.0-alpha.0 → 1.0.0-alpha.10
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/CHANGELOG.md +176 -0
- package/_virtual/_tslib.cjs +30 -0
- package/_virtual/_tslib.js +26 -0
- package/package.json +6 -2
- package/src/AlgorandWalletConnector.cjs +108 -0
- package/src/AlgorandWalletConnector.d.ts +25 -0
- package/src/AlgorandWalletConnector.js +104 -0
- package/src/index.cjs +4 -2
- package/src/index.d.ts +1 -1
- package/src/index.js +4 -2
- package/src/myalgo/MyAlgoWalletConnector.cjs +66 -0
- package/src/myalgo/MyAlgoWalletConnector.d.ts +13 -0
- package/src/myalgo/MyAlgoWalletConnector.js +58 -0
- package/src/myalgo/index.cjs +11 -0
- package/src/myalgo/index.d.ts +3 -0
- package/src/myalgo/index.js +7 -0
- package/src/myalgo/myalgoSigner.cjs +24 -0
- package/src/myalgo/myalgoSigner.d.ts +21 -0
- package/src/myalgo/myalgoSigner.js +20 -0
- package/src/pera/PeraSigner.cjs +18 -0
- package/src/pera/PeraSigner.d.ts +16 -0
- package/src/pera/PeraSigner.js +14 -0
- package/src/pera/PeraWalletConnector.cjs +67 -0
- package/src/pera/PeraWalletConnector.d.ts +17 -0
- package/src/pera/PeraWalletConnector.js +63 -0
- package/src/pera/index.cjs +11 -0
- package/src/pera/index.d.ts +3 -0
- package/src/pera/index.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,180 @@
|
|
|
1
1
|
|
|
2
|
+
## [1.0.0-alpha.10](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2023-12-08)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* allow transaction error to read from viem error ([#4101](https://github.com/dynamic-labs/DynamicAuth/issues/4101)) ([0f46cbe](https://github.com/dynamic-labs/DynamicAuth/commit/0f46cbea1eb260c2efdeee9b62f669fb3cf4ab93))
|
|
8
|
+
* trigger claim flow for unclaimed embedded smart contract wallet signer ([#4108](https://github.com/dynamic-labs/DynamicAuth/issues/4108)) ([37c9013](https://github.com/dynamic-labs/DynamicAuth/commit/37c9013109f2d6a37bde041da9072c5f5fa2df67))
|
|
9
|
+
* WalletConnect v2 connector with non active chains ([#4085](https://github.com/dynamic-labs/DynamicAuth/issues/4085)) ([f69cbe9](https://github.com/dynamic-labs/DynamicAuth/commit/f69cbe96012563f71e89939c96f2a46926e7b394))
|
|
10
|
+
|
|
11
|
+
## [1.0.0-alpha.9](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2023-12-07)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### ⚠ BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* how to migrate
|
|
17
|
+
Whenever you would use the property wallets from the object returned by useDynamicContext, you must now rename it to walletConnectorOptions.
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* add support for eip6963 ([#4064](https://github.com/dynamic-labs/DynamicAuth/issues/4064)) ([3f8cf0e](https://github.com/dynamic-labs/DynamicAuth/commit/3f8cf0e4250945f3a331f701d491a308fab5f7b8))
|
|
22
|
+
* allow AA wallets to access owner features ([#4079](https://github.com/dynamic-labs/DynamicAuth/issues/4079)) ([9efc2be](https://github.com/dynamic-labs/DynamicAuth/commit/9efc2bee87ec9193c3682863d72024b3586de724))
|
|
23
|
+
* introduce UserWalletsContext ([#4083](https://github.com/dynamic-labs/DynamicAuth/issues/4083)) ([b9ca7f6](https://github.com/dynamic-labs/DynamicAuth/commit/b9ca7f6b0aff4b3992325b70cc9a903ece445c7f))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* ensure zero dev provider will receive a signer ([#4084](https://github.com/dynamic-labs/DynamicAuth/issues/4084)) ([f02a540](https://github.com/dynamic-labs/DynamicAuth/commit/f02a54036d39bfc5fb0c262f292acf914e4bd653))
|
|
29
|
+
* render recovery section only when turnkey provider is enabled ([#4093](https://github.com/dynamic-labs/DynamicAuth/issues/4093)) ([5f29bd2](https://github.com/dynamic-labs/DynamicAuth/commit/5f29bd23ccca2e307822377be28396edc7ab1fda))
|
|
30
|
+
* reset selected social provider on logout ([#4078](https://github.com/dynamic-labs/DynamicAuth/issues/4078)) ([85dc611](https://github.com/dynamic-labs/DynamicAuth/commit/85dc611d9c0e733bdb9d316b008bdaa35bcc2a91))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
* rename wallets > walletConnectorOptions ([#4086](https://github.com/dynamic-labs/DynamicAuth/issues/4086)) ([10a7795](https://github.com/dynamic-labs/DynamicAuth/commit/10a779567e751469a667095726da52d78facbd57))
|
|
34
|
+
|
|
35
|
+
## [1.0.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2023-12-05)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### ⚠ BREAKING CHANGES
|
|
39
|
+
|
|
40
|
+
* rename EthereumSmartWalletConnectors to ZeroDevSmartWalletConnectors (#4067)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Features
|
|
44
|
+
|
|
45
|
+
* add support for pregenerated wallets + securing them ([#3968](https://github.com/dynamic-labs/DynamicAuth/issues/3968)) ([8212b76](https://github.com/dynamic-labs/DynamicAuth/commit/8212b760ba199bd989e0ba2ad3caf97590db4861))
|
|
46
|
+
|
|
47
|
+
## [1.0.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2023-12-05)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Features
|
|
51
|
+
|
|
52
|
+
* add support for Turnkey HD wallets and backwards compatiblity for private key wallets ([#4011](https://github.com/dynamic-labs/DynamicAuth/issues/4011)) ([75c5258](https://github.com/dynamic-labs/DynamicAuth/commit/75c5258da494d5d4dfa8b96655303dd9645f2269))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Bug Fixes
|
|
56
|
+
|
|
57
|
+
* add close button to wallets list ([#4036](https://github.com/dynamic-labs/DynamicAuth/issues/4036)) ([a2b988b](https://github.com/dynamic-labs/DynamicAuth/commit/a2b988bdfc662af6f85d37a79ed6666c483aa447))
|
|
58
|
+
* add support for embedded wallets in connect-only ([#4041](https://github.com/dynamic-labs/DynamicAuth/issues/4041)) ([ceea635](https://github.com/dynamic-labs/DynamicAuth/commit/ceea635b69e2a0c2636b47fbd30639d69dba7a1c))
|
|
59
|
+
* embedded wallet invalid stored chain breaking network picker ([#4050](https://github.com/dynamic-labs/DynamicAuth/issues/4050)) ([2e2384b](https://github.com/dynamic-labs/DynamicAuth/commit/2e2384ba37407d9164cce47e23f5d5f469f7e062))
|
|
60
|
+
* handle insufficient funds from AA provider ([#4027](https://github.com/dynamic-labs/DynamicAuth/issues/4027)) ([6b9cc88](https://github.com/dynamic-labs/DynamicAuth/commit/6b9cc886f4f2590094bd50aba195c07a5532dfa4))
|
|
61
|
+
* prevent double logout caused by wagmi sync ([#4048](https://github.com/dynamic-labs/DynamicAuth/issues/4048)) ([c66c81c](https://github.com/dynamic-labs/DynamicAuth/commit/c66c81c80839aa9ce1cfae76f4afce12e34f3513))
|
|
62
|
+
* properly detect network switch for secondary wallets ([#4038](https://github.com/dynamic-labs/DynamicAuth/issues/4038)) ([f87174d](https://github.com/dynamic-labs/DynamicAuth/commit/f87174de0892dd057401eaf3c0bc68d974add0fc))
|
|
63
|
+
* **use-wallets-connected-state:** update state on wallet id change ([#4045](https://github.com/dynamic-labs/DynamicAuth/issues/4045)) ([ca3a835](https://github.com/dynamic-labs/DynamicAuth/commit/ca3a8359eae386bffa758ed646ac14af8360a7f8))
|
|
64
|
+
* user should be able to see the full passkey name on management view ([#4043](https://github.com/dynamic-labs/DynamicAuth/issues/4043)) ([7bc1b70](https://github.com/dynamic-labs/DynamicAuth/commit/7bc1b7043cbc9f0e21df78a57efc3e6938a99db2))
|
|
65
|
+
* users should be able to easily find passkey recovery ([#4058](https://github.com/dynamic-labs/DynamicAuth/issues/4058)) ([0202ae9](https://github.com/dynamic-labs/DynamicAuth/commit/0202ae98c96544dec5ac357dc77000996e32ad33))
|
|
66
|
+
|
|
67
|
+
## [1.0.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2023-11-29)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Bug Fixes
|
|
71
|
+
|
|
72
|
+
* transaction layout show alert ([#4024](https://github.com/dynamic-labs/DynamicAuth/issues/4024)) ([52057f5](https://github.com/dynamic-labs/DynamicAuth/commit/52057f54ebc32464b2486a2328cb6310caf85208)), closes [#4020](https://github.com/dynamic-labs/DynamicAuth/issues/4020)
|
|
73
|
+
|
|
74
|
+
## [1.0.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2023-11-29)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Features
|
|
78
|
+
|
|
79
|
+
* gracefully handle uknown wallet ([#3997](https://github.com/dynamic-labs/DynamicAuth/issues/3997)) ([ce7ff6a](https://github.com/dynamic-labs/DynamicAuth/commit/ce7ff6a50a8e8947050734b61587c8cadd041dbe))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Bug Fixes
|
|
83
|
+
|
|
84
|
+
* remove total on sponsored transactions ([#4019](https://github.com/dynamic-labs/DynamicAuth/issues/4019)) ([d976678](https://github.com/dynamic-labs/DynamicAuth/commit/d9766787b29665fbcd7983c5d61c31a4d97c8257))
|
|
85
|
+
* send balance align information ([#4020](https://github.com/dynamic-labs/DynamicAuth/issues/4020)) ([508dccf](https://github.com/dynamic-labs/DynamicAuth/commit/508dccfa2c6aeaed30616b6a41b30002cccb3b40))
|
|
86
|
+
|
|
87
|
+
## [1.0.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2023-11-28)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Bug Fixes
|
|
91
|
+
|
|
92
|
+
* update zerodev provider initialization ([#4015](https://github.com/dynamic-labs/DynamicAuth/issues/4015)) ([8faca00](https://github.com/dynamic-labs/DynamicAuth/commit/8faca00d414677adc5fecde451ca01da53fe9641))
|
|
93
|
+
|
|
94
|
+
## [1.0.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2023-11-28)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Bug Fixes
|
|
98
|
+
|
|
99
|
+
* fix solflare mobile wallet deep linking ([#3998](https://github.com/dynamic-labs/DynamicAuth/issues/3998)) ([10069ae](https://github.com/dynamic-labs/DynamicAuth/commit/10069ae9ed5d8e1978131f57c3e90680e85d2efb))
|
|
100
|
+
* passkey error message when reaching limit of accounts ([#4010](https://github.com/dynamic-labs/DynamicAuth/issues/4010)) ([dabce3b](https://github.com/dynamic-labs/DynamicAuth/commit/dabce3b6ada4bac75903b43d5cb125cfd5619d18))
|
|
101
|
+
|
|
102
|
+
## [1.0.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2023-11-28)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### ⚠ BREAKING CHANGES
|
|
106
|
+
|
|
107
|
+
* rename walletsByChain to bridgeChains (#3954)
|
|
108
|
+
|
|
109
|
+
### Features
|
|
110
|
+
|
|
111
|
+
* passkey management and recovery ([#3911](https://github.com/dynamic-labs/DynamicAuth/issues/3911)) ([b692b3a](https://github.com/dynamic-labs/DynamicAuth/commit/b692b3a8697d0ffb441faae97e609b144965695d))
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
### Bug Fixes
|
|
115
|
+
|
|
116
|
+
* ensure all chain rpc providers are always assigned correctly ([#3981](https://github.com/dynamic-labs/DynamicAuth/issues/3981)) ([cd2e25c](https://github.com/dynamic-labs/DynamicAuth/commit/cd2e25c4eb39791866c1ea283d61fff388cce5df))
|
|
117
|
+
* initialize selected chain with first evm network if no value in ls ([#3999](https://github.com/dynamic-labs/DynamicAuth/issues/3999)) ([bc9e43b](https://github.com/dynamic-labs/DynamicAuth/commit/bc9e43be9d33c75bb1236756589f63f17b230ab1))
|
|
118
|
+
* nextjs issues to show transaction modals ([#3964](https://github.com/dynamic-labs/DynamicAuth/issues/3964)) ([9326ac4](https://github.com/dynamic-labs/DynamicAuth/commit/9326ac49394e067ce38b17faff08b4fabf91bb3f))
|
|
119
|
+
* onEmbeddedWalletCreated not being called ([#3975](https://github.com/dynamic-labs/DynamicAuth/issues/3975)) ([035cebe](https://github.com/dynamic-labs/DynamicAuth/commit/035cebe02891048e62c66a7277ed7f43c27e559d))
|
|
120
|
+
* return linked wallets even when there's no primary wallet ([#3965](https://github.com/dynamic-labs/DynamicAuth/issues/3965)) ([27705de](https://github.com/dynamic-labs/DynamicAuth/commit/27705de4ac7e1584efd1245bb9c6a818b1c20742))
|
|
121
|
+
* transaction modal not throwing viem compatible exception ([#3971](https://github.com/dynamic-labs/DynamicAuth/issues/3971)) ([bedab0c](https://github.com/dynamic-labs/DynamicAuth/commit/bedab0c4448bcca5c3e696ceb276867ce55bbd85))
|
|
122
|
+
* **zero-dev:** ensure the sign typed data is parsed for zero dev to handle ([#3974](https://github.com/dynamic-labs/DynamicAuth/issues/3974)) ([f517738](https://github.com/dynamic-labs/DynamicAuth/commit/f517738e1abc138f882525c128cd1ee5e88b9050))
|
|
123
|
+
* zerodev sign message with ethers ([#3972](https://github.com/dynamic-labs/DynamicAuth/issues/3972)) ([5de3873](https://github.com/dynamic-labs/DynamicAuth/commit/5de3873daa9cbfeef6dd9123b7a319d8e6b412d5))
|
|
124
|
+
* **zerodev:** ensure ECDSAProvider supports sendUserOperation ([#4003](https://github.com/dynamic-labs/DynamicAuth/issues/4003)) ([c8f5886](https://github.com/dynamic-labs/DynamicAuth/commit/c8f58868fcf6912fd11a92940369faf37e3fcdde))
|
|
125
|
+
* **zerodev:** ensure transaction is sponsored before submission ([#3932](https://github.com/dynamic-labs/DynamicAuth/issues/3932)) ([74becb7](https://github.com/dynamic-labs/DynamicAuth/commit/74becb7ec2fd55f8b905a9c9f0bbba44a9d22513))
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
* rename walletsByChain to bridgeChains ([#3954](https://github.com/dynamic-labs/DynamicAuth/issues/3954)) ([a91e8fe](https://github.com/dynamic-labs/DynamicAuth/commit/a91e8fe605694ccd8a00b71aa194c0c5191f156c))
|
|
129
|
+
|
|
130
|
+
## [1.0.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.0...v1.0.0-alpha.1) (2023-11-22)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
### Features
|
|
134
|
+
|
|
135
|
+
* add basic zerodev connector ([#3782](https://github.com/dynamic-labs/DynamicAuth/issues/3782)) ([3f8debd](https://github.com/dynamic-labs/DynamicAuth/commit/3f8debddb1bff325389193e0348128ebb9ba59b9))
|
|
136
|
+
* add hcaptcha to dynamic signin methods ([#3853](https://github.com/dynamic-labs/DynamicAuth/issues/3853)) ([a4a9ad3](https://github.com/dynamic-labs/DynamicAuth/commit/a4a9ad3b048e33acc5b885cd797697ca4f41995e))
|
|
137
|
+
* add hcaptcha to magic login methods ([#3894](https://github.com/dynamic-labs/DynamicAuth/issues/3894)) ([c76b750](https://github.com/dynamic-labs/DynamicAuth/commit/c76b750351557ad9cf5bbcc39bd7fd0970b66312))
|
|
138
|
+
* add need help section to sign message modal ([#3847](https://github.com/dynamic-labs/DynamicAuth/issues/3847)) ([4f90617](https://github.com/dynamic-labs/DynamicAuth/commit/4f90617bcf400a7171062435c731d95c6bbf41c7))
|
|
139
|
+
* add perawallet to wallet book ([#3868](https://github.com/dynamic-labs/DynamicAuth/issues/3868)) ([5f4e79d](https://github.com/dynamic-labs/DynamicAuth/commit/5f4e79df202b02088b15c5dfab7feee5789e9ece))
|
|
140
|
+
* add serialization to allow sending events callbacks and wallet connectors used by customers ([0077eb0](https://github.com/dynamic-labs/DynamicAuth/commit/0077eb0af05feb765d0c61911a48d5e98554760a))
|
|
141
|
+
* add support for dynamic domains for starknet signatures ([#3927](https://github.com/dynamic-labs/DynamicAuth/issues/3927)) ([52797ce](https://github.com/dynamic-labs/DynamicAuth/commit/52797ce867c956049bfa5021cf5b1c562e771a2e))
|
|
142
|
+
* add support for Pera Wallet ([#3866](https://github.com/dynamic-labs/DynamicAuth/issues/3866)) ([cb99ae7](https://github.com/dynamic-labs/DynamicAuth/commit/cb99ae77605d913932a77bf2ea565b7e7baf781a))
|
|
143
|
+
* add support for private starknet rpc providers ([#3881](https://github.com/dynamic-labs/DynamicAuth/issues/3881)) ([8fd5ef9](https://github.com/dynamic-labs/DynamicAuth/commit/8fd5ef902d48ef828b1cb89d0e462ea5b54f4e42))
|
|
144
|
+
* add zerodev to wallet book and render generic wallet icon ([#3822](https://github.com/dynamic-labs/DynamicAuth/issues/3822)) ([9c5768d](https://github.com/dynamic-labs/DynamicAuth/commit/9c5768d0fc1169c62927926c0e436b6a448d5656))
|
|
145
|
+
* allow updating evmNetworks in real time ([#3877](https://github.com/dynamic-labs/DynamicAuth/issues/3877)) ([b4a2521](https://github.com/dynamic-labs/DynamicAuth/commit/b4a2521830b859a129d70bad2ae1213db075550d))
|
|
146
|
+
* editable copies as typed data ([#3784](https://github.com/dynamic-labs/DynamicAuth/issues/3784)) ([d6c6d74](https://github.com/dynamic-labs/DynamicAuth/commit/d6c6d74e60c9c9d459414c452fbd780d3f6bc2f9))
|
|
147
|
+
* email inputs now use email keyboard ([#3843](https://github.com/dynamic-labs/DynamicAuth/issues/3843)) ([76926e2](https://github.com/dynamic-labs/DynamicAuth/commit/76926e26b6a188d9d8e3bba2512340610e218e9f))
|
|
148
|
+
* hide unlink if disabled in dashboard ([#3825](https://github.com/dynamic-labs/DynamicAuth/issues/3825)) ([a0625e6](https://github.com/dynamic-labs/DynamicAuth/commit/a0625e6fd01aa5b57e6b8542efe04e280e0c6830))
|
|
149
|
+
* initialize smart wallet from verified credentials ([#3790](https://github.com/dynamic-labs/DynamicAuth/issues/3790)) ([1fc5890](https://github.com/dynamic-labs/DynamicAuth/commit/1fc5890f2e0ef458bfb59d38d536c41d183bc2a2))
|
|
150
|
+
* set smart wallet as primary when owner is an embedded wallet ([#3898](https://github.com/dynamic-labs/DynamicAuth/issues/3898)) ([ec40172](https://github.com/dynamic-labs/DynamicAuth/commit/ec401729f38d946d5431bbbb15c5c1cdc66acb73))
|
|
151
|
+
* support forced network validation via DynamicContext setting ([#3879](https://github.com/dynamic-labs/DynamicAuth/issues/3879)) ([a7993b9](https://github.com/dynamic-labs/DynamicAuth/commit/a7993b9b6bdd739bcb4e66e46d14e7f8623bed66))
|
|
152
|
+
* **transaction:** add sponsored gas transaction ([#3869](https://github.com/dynamic-labs/DynamicAuth/issues/3869)) ([ccceb24](https://github.com/dynamic-labs/DynamicAuth/commit/ccceb2421e029dc60e53912e404b574324d6772f))
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
### Bug Fixes
|
|
156
|
+
|
|
157
|
+
* **account-abstraction:** set verified credentials before setting EOA to wallet connector ([#3941](https://github.com/dynamic-labs/DynamicAuth/issues/3941)) ([7475c46](https://github.com/dynamic-labs/DynamicAuth/commit/7475c465f5ddf9e27d0b05d23e58d9b474fa8fd4))
|
|
158
|
+
* add brand to zerodev object ([#3828](https://github.com/dynamic-labs/DynamicAuth/issues/3828)) ([81cb237](https://github.com/dynamic-labs/DynamicAuth/commit/81cb237df4def8e1c53b4ae145afafccf3b04683))
|
|
159
|
+
* add spriteId to zerodev ([#3829](https://github.com/dynamic-labs/DynamicAuth/issues/3829)) ([6b87c5c](https://github.com/dynamic-labs/DynamicAuth/commit/6b87c5c3d5869f6cd15a7534fb0260932845fbb1))
|
|
160
|
+
* allow metadata to be updated in updateUser hook ([#3928](https://github.com/dynamic-labs/DynamicAuth/issues/3928)) ([4f39fbd](https://github.com/dynamic-labs/DynamicAuth/commit/4f39fbd757b4e816dd60651252575c1f7e4d80aa))
|
|
161
|
+
* blocto flow connect only infinite recursion ([#3883](https://github.com/dynamic-labs/DynamicAuth/issues/3883)) ([6c6f5ba](https://github.com/dynamic-labs/DynamicAuth/commit/6c6f5ba5dc0657cc7ffdc82a4ea7935f65686088))
|
|
162
|
+
* clear project settings on page refresh ([#3826](https://github.com/dynamic-labs/DynamicAuth/issues/3826)) ([da5b8f0](https://github.com/dynamic-labs/DynamicAuth/commit/da5b8f0a99bf913ea11314954e5f08c2b019f50f))
|
|
163
|
+
* don't call computeConnectedStateForWallets too often to avoid infinite loops ([#3946](https://github.com/dynamic-labs/DynamicAuth/issues/3946)) ([de4e61a](https://github.com/dynamic-labs/DynamicAuth/commit/de4e61a3fcdc9c25cbe030c3c25cbc2c04929a93))
|
|
164
|
+
* don't call disconnect multiple times ([#3940](https://github.com/dynamic-labs/DynamicAuth/issues/3940)) ([3ea8623](https://github.com/dynamic-labs/DynamicAuth/commit/3ea86233d8d07dfb3c751a5fec45d5df84e9e143))
|
|
165
|
+
* **embedded wallet:** stop overriding primary wallet selection ([#3796](https://github.com/dynamic-labs/DynamicAuth/issues/3796)) ([75b81e7](https://github.com/dynamic-labs/DynamicAuth/commit/75b81e74d472ce8cc493646b441d2b4fe3962373))
|
|
166
|
+
* exodusevm wallet connect and mobile deep linking ([#3855](https://github.com/dynamic-labs/DynamicAuth/issues/3855)) ([cf0b3f0](https://github.com/dynamic-labs/DynamicAuth/commit/cf0b3f077f935eab32ce45947f62e73342d6c169))
|
|
167
|
+
* handle errors properly when engaging captcha ([#3896](https://github.com/dynamic-labs/DynamicAuth/issues/3896)) ([2596315](https://github.com/dynamic-labs/DynamicAuth/commit/25963153d699b26c6e04ea38b267446d3a3af13b))
|
|
168
|
+
* null safe check to window object ([#3882](https://github.com/dynamic-labs/DynamicAuth/issues/3882)) ([8856b5a](https://github.com/dynamic-labs/DynamicAuth/commit/8856b5ae40d43285eac667401387971b9e3f077d))
|
|
169
|
+
* pass correct wallet connector onLinkSuccess ([#3904](https://github.com/dynamic-labs/DynamicAuth/issues/3904)) ([79cca69](https://github.com/dynamic-labs/DynamicAuth/commit/79cca69ed53a5ef2c4e4d712ce0934e1a4c11459))
|
|
170
|
+
* remove extra captcha context provider instantiation causing unecessary rerenderings ([#3914](https://github.com/dynamic-labs/DynamicAuth/issues/3914)) ([14120a6](https://github.com/dynamic-labs/DynamicAuth/commit/14120a6ac0415f9a59608b376e88de6c729d4e5d))
|
|
171
|
+
* remove the coming soon label ([#3860](https://github.com/dynamic-labs/DynamicAuth/issues/3860)) ([1effb7f](https://github.com/dynamic-labs/DynamicAuth/commit/1effb7f124bda66aae3e8991b5386a1cee28fd99))
|
|
172
|
+
* Revert "chore: fix vite build ([#3849](https://github.com/dynamic-labs/DynamicAuth/issues/3849))" ([#3870](https://github.com/dynamic-labs/DynamicAuth/issues/3870)) ([13bc424](https://github.com/dynamic-labs/DynamicAuth/commit/13bc42483bcb9338babd46eae00988acada83578))
|
|
173
|
+
* **single-wallet:** prompt user to select correct wallet ([#3742](https://github.com/dynamic-labs/DynamicAuth/issues/3742)) ([ccfdd3c](https://github.com/dynamic-labs/DynamicAuth/commit/ccfdd3cc6a4ac7f3b1ea13be92e58982ecfb1c59))
|
|
174
|
+
* update walletconnect.json and walletconnect source schema ([#3854](https://github.com/dynamic-labs/DynamicAuth/issues/3854)) ([88ee546](https://github.com/dynamic-labs/DynamicAuth/commit/88ee5468db0130b19c6637a5632e64e0bb5197ba))
|
|
175
|
+
* useEmailProvider not checking for enabled providers properly ([7c16edc](https://github.com/dynamic-labs/DynamicAuth/commit/7c16edc3785ba10d69762b174f054b0d10b8a072))
|
|
176
|
+
* **wagmi:** ensure chain is defined on wallet client ([#3888](https://github.com/dynamic-labs/DynamicAuth/issues/3888)) ([0e145f6](https://github.com/dynamic-labs/DynamicAuth/commit/0e145f6ac42f55df7a020716d4ddc023554d72f9))
|
|
177
|
+
|
|
2
178
|
## [1.0.0-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0...v1.0.0-alpha.0) (2023-10-31)
|
|
3
179
|
|
|
4
180
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/******************************************************************************
|
|
6
|
+
Copyright (c) Microsoft Corporation.
|
|
7
|
+
|
|
8
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
+
purpose with or without fee is hereby granted.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
+
***************************************************************************** */
|
|
19
|
+
|
|
20
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
21
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
22
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
23
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
24
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
25
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
26
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.__awaiter = __awaiter;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { __awaiter };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/algorand",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -26,7 +26,11 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@
|
|
29
|
+
"@perawallet/connect": "^1.3.3",
|
|
30
|
+
"@randlabs/myalgo-connect": "1.4.2",
|
|
31
|
+
"@dynamic-labs/utils": "1.0.0-alpha.10",
|
|
32
|
+
"@dynamic-labs/wallet-book": "1.0.0-alpha.10",
|
|
33
|
+
"@dynamic-labs/wallet-connector-core": "1.0.0-alpha.10"
|
|
30
34
|
},
|
|
31
35
|
"peerDependencies": {}
|
|
32
36
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../_virtual/_tslib.cjs');
|
|
6
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
7
|
+
var utils = require('@dynamic-labs/utils');
|
|
8
|
+
|
|
9
|
+
const HTTP_STATUS_TOO_MANY_REQUESTS = 429;
|
|
10
|
+
const HTTP_STATUS_NOT_FOUND = 404;
|
|
11
|
+
class AlgorandLocalStorageCache {
|
|
12
|
+
constructor(key) {
|
|
13
|
+
this.SESSION_STORAGE_KEY = `algorand_${key}_currentAddress`;
|
|
14
|
+
this.LAST_BALANCE_KEY = `algorand_${key}_lastBalance`;
|
|
15
|
+
}
|
|
16
|
+
getCurrentAddress() {
|
|
17
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const addr = yield utils.getItemAsync(this.SESSION_STORAGE_KEY);
|
|
19
|
+
if (!addr) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return addr;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
setCurrentAddress(addr) {
|
|
26
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
return utils.setItemAsync(this.SESSION_STORAGE_KEY, addr);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
clearCurrentAddress() {
|
|
31
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
return utils.removeItemAsync(this.SESSION_STORAGE_KEY);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
getLastBalance() {
|
|
36
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const balance = yield utils.getItemAsync(this.LAST_BALANCE_KEY);
|
|
38
|
+
if (!balance) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return balance;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
setLastBalance(balance) {
|
|
45
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
return utils.setItemAsync(this.LAST_BALANCE_KEY, balance);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
clearLastBalance() {
|
|
50
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
return utils.removeItemAsync(this.LAST_BALANCE_KEY);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
class AlgorandWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
56
|
+
constructor(opts) {
|
|
57
|
+
super(opts);
|
|
58
|
+
this.connectedChain = 'ALGO';
|
|
59
|
+
this.supportedChains = ['ALGO'];
|
|
60
|
+
this.cache = new AlgorandLocalStorageCache(opts.cacheKey);
|
|
61
|
+
}
|
|
62
|
+
getDeepLink() {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
getBalance() {
|
|
66
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const address = yield this.fetchPublicAddress();
|
|
68
|
+
if (!address) {
|
|
69
|
+
throw new utils.DynamicError('getBalance - Not connected!');
|
|
70
|
+
}
|
|
71
|
+
const response = yield fetch(`https://indexer.algoexplorerapi.io/v2/accounts/${address}`);
|
|
72
|
+
if (!response.ok) {
|
|
73
|
+
// if the request fails due to rate limits, return cached value
|
|
74
|
+
if (response.status === HTTP_STATUS_TOO_MANY_REQUESTS) {
|
|
75
|
+
return this.cache.getLastBalance();
|
|
76
|
+
}
|
|
77
|
+
// new accounts not yet indexed will return a 404
|
|
78
|
+
if (response.status === HTTP_STATUS_NOT_FOUND) {
|
|
79
|
+
return '0';
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
const accountInfo = yield response.json();
|
|
84
|
+
if (!accountInfo.account) {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
const balance = accountInfo.account.amount.toString();
|
|
88
|
+
yield this.cache.setLastBalance(balance.toString());
|
|
89
|
+
return balance.toString();
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
endSession() {
|
|
93
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
yield Promise.all([
|
|
95
|
+
this.cache.clearCurrentAddress(),
|
|
96
|
+
this.cache.clearLastBalance(),
|
|
97
|
+
]);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
getConnectedAccounts() {
|
|
101
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
const currentAddress = yield this.cache.getCurrentAddress();
|
|
103
|
+
return currentAddress ? [currentAddress] : [];
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
exports.AlgorandWalletConnector = AlgorandWalletConnector;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Chain, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
3
|
+
interface IAlgorandSessionCache {
|
|
4
|
+
clearCurrentAddress(): Promise<void>;
|
|
5
|
+
getCurrentAddress(): Promise<string | undefined>;
|
|
6
|
+
getLastBalance(): Promise<string | undefined>;
|
|
7
|
+
clearLastBalance(): Promise<void>;
|
|
8
|
+
setCurrentAddress(addr: string): Promise<void>;
|
|
9
|
+
setLastBalance(balance: string): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export type AlgorandWalletConnectorOpts = {
|
|
12
|
+
walletBook: WalletBookSchema;
|
|
13
|
+
cacheKey: string;
|
|
14
|
+
};
|
|
15
|
+
export declare abstract class AlgorandWalletConnector extends WalletConnectorBase {
|
|
16
|
+
cache: IAlgorandSessionCache;
|
|
17
|
+
connectedChain: Chain;
|
|
18
|
+
supportedChains: Chain[];
|
|
19
|
+
constructor(opts: AlgorandWalletConnectorOpts);
|
|
20
|
+
getDeepLink(): string | undefined;
|
|
21
|
+
getBalance(): Promise<string | undefined>;
|
|
22
|
+
endSession(): Promise<void>;
|
|
23
|
+
getConnectedAccounts(): Promise<string[]>;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { __awaiter } from '../_virtual/_tslib.js';
|
|
2
|
+
import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { DynamicError, getItemAsync, setItemAsync, removeItemAsync } from '@dynamic-labs/utils';
|
|
4
|
+
|
|
5
|
+
const HTTP_STATUS_TOO_MANY_REQUESTS = 429;
|
|
6
|
+
const HTTP_STATUS_NOT_FOUND = 404;
|
|
7
|
+
class AlgorandLocalStorageCache {
|
|
8
|
+
constructor(key) {
|
|
9
|
+
this.SESSION_STORAGE_KEY = `algorand_${key}_currentAddress`;
|
|
10
|
+
this.LAST_BALANCE_KEY = `algorand_${key}_lastBalance`;
|
|
11
|
+
}
|
|
12
|
+
getCurrentAddress() {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const addr = yield getItemAsync(this.SESSION_STORAGE_KEY);
|
|
15
|
+
if (!addr) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
return addr;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
setCurrentAddress(addr) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
return setItemAsync(this.SESSION_STORAGE_KEY, addr);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
clearCurrentAddress() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return removeItemAsync(this.SESSION_STORAGE_KEY);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
getLastBalance() {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const balance = yield getItemAsync(this.LAST_BALANCE_KEY);
|
|
34
|
+
if (!balance) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return balance;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
setLastBalance(balance) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
return setItemAsync(this.LAST_BALANCE_KEY, balance);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
clearLastBalance() {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
return removeItemAsync(this.LAST_BALANCE_KEY);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class AlgorandWalletConnector extends WalletConnectorBase {
|
|
52
|
+
constructor(opts) {
|
|
53
|
+
super(opts);
|
|
54
|
+
this.connectedChain = 'ALGO';
|
|
55
|
+
this.supportedChains = ['ALGO'];
|
|
56
|
+
this.cache = new AlgorandLocalStorageCache(opts.cacheKey);
|
|
57
|
+
}
|
|
58
|
+
getDeepLink() {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
getBalance() {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const address = yield this.fetchPublicAddress();
|
|
64
|
+
if (!address) {
|
|
65
|
+
throw new DynamicError('getBalance - Not connected!');
|
|
66
|
+
}
|
|
67
|
+
const response = yield fetch(`https://indexer.algoexplorerapi.io/v2/accounts/${address}`);
|
|
68
|
+
if (!response.ok) {
|
|
69
|
+
// if the request fails due to rate limits, return cached value
|
|
70
|
+
if (response.status === HTTP_STATUS_TOO_MANY_REQUESTS) {
|
|
71
|
+
return this.cache.getLastBalance();
|
|
72
|
+
}
|
|
73
|
+
// new accounts not yet indexed will return a 404
|
|
74
|
+
if (response.status === HTTP_STATUS_NOT_FOUND) {
|
|
75
|
+
return '0';
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
const accountInfo = yield response.json();
|
|
80
|
+
if (!accountInfo.account) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
const balance = accountInfo.account.amount.toString();
|
|
84
|
+
yield this.cache.setLastBalance(balance.toString());
|
|
85
|
+
return balance.toString();
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
endSession() {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
yield Promise.all([
|
|
91
|
+
this.cache.clearCurrentAddress(),
|
|
92
|
+
this.cache.clearLastBalance(),
|
|
93
|
+
]);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
getConnectedAccounts() {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
const currentAddress = yield this.cache.getCurrentAddress();
|
|
99
|
+
return currentAddress ? [currentAddress] : [];
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { AlgorandWalletConnector };
|
package/src/index.cjs
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var index = require('./myalgo/index.cjs');
|
|
6
|
+
var index$1 = require('./pera/index.cjs');
|
|
6
7
|
|
|
7
8
|
const AlgorandWalletConnectors = (props) => [
|
|
8
|
-
...
|
|
9
|
+
...index.MyAlgoWalletConnectors(),
|
|
10
|
+
...index$1.PeraWalletConnectors(),
|
|
9
11
|
];
|
|
10
12
|
|
|
11
13
|
exports.AlgorandWalletConnectors = AlgorandWalletConnectors;
|
package/src/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AlgorandWalletConnectors: (props: any) => typeof import("
|
|
1
|
+
export declare const AlgorandWalletConnectors: (props: any) => (typeof import("./myalgo").MyAlgoWalletConnector | typeof import("./pera").PeraWalletConnector)[];
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { MyAlgoWalletConnectors } from '
|
|
1
|
+
import { MyAlgoWalletConnectors } from './myalgo/index.js';
|
|
2
|
+
import { PeraWalletConnectors } from './pera/index.js';
|
|
2
3
|
|
|
3
4
|
const AlgorandWalletConnectors = (props) => [
|
|
4
|
-
...MyAlgoWalletConnectors(
|
|
5
|
+
...MyAlgoWalletConnectors(),
|
|
6
|
+
...PeraWalletConnectors(),
|
|
5
7
|
];
|
|
6
8
|
|
|
7
9
|
export { AlgorandWalletConnectors };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
|
+
var MyAlgoConnect = require('@randlabs/myalgo-connect');
|
|
7
|
+
var utils = require('@dynamic-labs/utils');
|
|
8
|
+
var AlgorandWalletConnector = require('../AlgorandWalletConnector.cjs');
|
|
9
|
+
var myalgoSigner = require('./myalgoSigner.cjs');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var MyAlgoConnect__default = /*#__PURE__*/_interopDefaultLegacy(MyAlgoConnect);
|
|
14
|
+
|
|
15
|
+
class MyAlgoWalletConnector extends AlgorandWalletConnector.AlgorandWalletConnector {
|
|
16
|
+
constructor(opts) {
|
|
17
|
+
super(Object.assign(Object.assign({}, opts), { cacheKey: 'myalgo' }));
|
|
18
|
+
this.name = 'MyAlgo';
|
|
19
|
+
this.canConnectViaCustodialService = true;
|
|
20
|
+
}
|
|
21
|
+
getClient() {
|
|
22
|
+
if (!this.client) {
|
|
23
|
+
this.client = new MyAlgoConnect__default["default"]();
|
|
24
|
+
}
|
|
25
|
+
return this.client;
|
|
26
|
+
}
|
|
27
|
+
getNetwork() {
|
|
28
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return undefined;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
fetchPublicAddress() {
|
|
33
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const currentAddress = yield this.cache.getCurrentAddress();
|
|
35
|
+
if (currentAddress) {
|
|
36
|
+
return currentAddress;
|
|
37
|
+
}
|
|
38
|
+
const accounts = yield this.getClient().connect({
|
|
39
|
+
shouldSelectOneAccount: true,
|
|
40
|
+
});
|
|
41
|
+
if (!accounts.length) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const [{ address }] = accounts;
|
|
45
|
+
yield this.cache.setCurrentAddress(address);
|
|
46
|
+
return address;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
getSigner() {
|
|
50
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const address = yield this.fetchPublicAddress();
|
|
52
|
+
if (!address)
|
|
53
|
+
throw new utils.DynamicError('MyAlgo Wallet Connector - Not connected!');
|
|
54
|
+
return new myalgoSigner.MyAlgoSigner(address, this.getClient());
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
signMessage(messageToSign) {
|
|
58
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const signer = yield this.getSigner();
|
|
60
|
+
const signature = yield signer.signBytes(Buffer.from(messageToSign));
|
|
61
|
+
return Buffer.from(signature).toString('hex');
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
exports.MyAlgoWalletConnector = MyAlgoWalletConnector;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AlgorandWalletConnector } from '../AlgorandWalletConnector';
|
|
2
|
+
import { IMyAlgoSigner } from './myalgoSigner';
|
|
3
|
+
export declare class MyAlgoWalletConnector extends AlgorandWalletConnector {
|
|
4
|
+
private client?;
|
|
5
|
+
name: string;
|
|
6
|
+
canConnectViaCustodialService: boolean;
|
|
7
|
+
constructor(opts: any);
|
|
8
|
+
private getClient;
|
|
9
|
+
getNetwork(): Promise<number | undefined>;
|
|
10
|
+
fetchPublicAddress(): Promise<string | undefined>;
|
|
11
|
+
getSigner(): Promise<IMyAlgoSigner>;
|
|
12
|
+
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
|
+
import MyAlgoConnect from '@randlabs/myalgo-connect';
|
|
3
|
+
import { DynamicError } from '@dynamic-labs/utils';
|
|
4
|
+
import { AlgorandWalletConnector } from '../AlgorandWalletConnector.js';
|
|
5
|
+
import { MyAlgoSigner } from './myalgoSigner.js';
|
|
6
|
+
|
|
7
|
+
class MyAlgoWalletConnector extends AlgorandWalletConnector {
|
|
8
|
+
constructor(opts) {
|
|
9
|
+
super(Object.assign(Object.assign({}, opts), { cacheKey: 'myalgo' }));
|
|
10
|
+
this.name = 'MyAlgo';
|
|
11
|
+
this.canConnectViaCustodialService = true;
|
|
12
|
+
}
|
|
13
|
+
getClient() {
|
|
14
|
+
if (!this.client) {
|
|
15
|
+
this.client = new MyAlgoConnect();
|
|
16
|
+
}
|
|
17
|
+
return this.client;
|
|
18
|
+
}
|
|
19
|
+
getNetwork() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
return undefined;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
fetchPublicAddress() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const currentAddress = yield this.cache.getCurrentAddress();
|
|
27
|
+
if (currentAddress) {
|
|
28
|
+
return currentAddress;
|
|
29
|
+
}
|
|
30
|
+
const accounts = yield this.getClient().connect({
|
|
31
|
+
shouldSelectOneAccount: true,
|
|
32
|
+
});
|
|
33
|
+
if (!accounts.length) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const [{ address }] = accounts;
|
|
37
|
+
yield this.cache.setCurrentAddress(address);
|
|
38
|
+
return address;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
getSigner() {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const address = yield this.fetchPublicAddress();
|
|
44
|
+
if (!address)
|
|
45
|
+
throw new DynamicError('MyAlgo Wallet Connector - Not connected!');
|
|
46
|
+
return new MyAlgoSigner(address, this.getClient());
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
signMessage(messageToSign) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const signer = yield this.getSigner();
|
|
52
|
+
const signature = yield signer.signBytes(Buffer.from(messageToSign));
|
|
53
|
+
return Buffer.from(signature).toString('hex');
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { MyAlgoWalletConnector };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var MyAlgoWalletConnector = require('./MyAlgoWalletConnector.cjs');
|
|
6
|
+
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
8
|
+
const MyAlgoWalletConnectors = (props) => [MyAlgoWalletConnector.MyAlgoWalletConnector];
|
|
9
|
+
|
|
10
|
+
exports.MyAlgoWalletConnector = MyAlgoWalletConnector.MyAlgoWalletConnector;
|
|
11
|
+
exports.MyAlgoWalletConnectors = MyAlgoWalletConnectors;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MyAlgoWalletConnector } from './MyAlgoWalletConnector.js';
|
|
2
|
+
export { MyAlgoWalletConnector } from './MyAlgoWalletConnector.js';
|
|
3
|
+
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
|
+
const MyAlgoWalletConnectors = (props) => [MyAlgoWalletConnector];
|
|
6
|
+
|
|
7
|
+
export { MyAlgoWalletConnectors };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
class MyAlgoSigner {
|
|
6
|
+
constructor(connectedAddress, client) {
|
|
7
|
+
this.connectedAddress = connectedAddress;
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
signBytes(bytes) {
|
|
11
|
+
return this.client.signBytes(bytes, this.connectedAddress);
|
|
12
|
+
}
|
|
13
|
+
signLogicSig(teal) {
|
|
14
|
+
return this.client.signLogicSig(teal, this.connectedAddress);
|
|
15
|
+
}
|
|
16
|
+
signTransaction(txs) {
|
|
17
|
+
return this.client.signTransaction(txs);
|
|
18
|
+
}
|
|
19
|
+
tealSign(data, contractAddress) {
|
|
20
|
+
return this.client.tealSign(data, contractAddress, this.connectedAddress);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.MyAlgoSigner = MyAlgoSigner;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import MyAlgoConnect from '@randlabs/myalgo-connect';
|
|
2
|
+
interface AlgorandSignedTx {
|
|
3
|
+
blob: Uint8Array;
|
|
4
|
+
txID: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IMyAlgoSigner {
|
|
7
|
+
signBytes(bytes: Uint8Array): Promise<Uint8Array>;
|
|
8
|
+
signLogicSig(teal: Uint8Array): Promise<Uint8Array>;
|
|
9
|
+
signTransaction(txs: any[]): Promise<AlgorandSignedTx[]>;
|
|
10
|
+
tealSign(data: Uint8Array, contractAddress: string): Promise<Uint8Array>;
|
|
11
|
+
}
|
|
12
|
+
export declare class MyAlgoSigner implements IMyAlgoSigner {
|
|
13
|
+
private readonly connectedAddress;
|
|
14
|
+
private readonly client;
|
|
15
|
+
constructor(connectedAddress: string, client: MyAlgoConnect);
|
|
16
|
+
signBytes(bytes: Uint8Array): Promise<Uint8Array>;
|
|
17
|
+
signLogicSig(teal: Uint8Array): Promise<Uint8Array>;
|
|
18
|
+
signTransaction(txs: any[]): Promise<AlgorandSignedTx[]>;
|
|
19
|
+
tealSign(data: Uint8Array, contractAddress: string): Promise<Uint8Array>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class MyAlgoSigner {
|
|
2
|
+
constructor(connectedAddress, client) {
|
|
3
|
+
this.connectedAddress = connectedAddress;
|
|
4
|
+
this.client = client;
|
|
5
|
+
}
|
|
6
|
+
signBytes(bytes) {
|
|
7
|
+
return this.client.signBytes(bytes, this.connectedAddress);
|
|
8
|
+
}
|
|
9
|
+
signLogicSig(teal) {
|
|
10
|
+
return this.client.signLogicSig(teal, this.connectedAddress);
|
|
11
|
+
}
|
|
12
|
+
signTransaction(txs) {
|
|
13
|
+
return this.client.signTransaction(txs);
|
|
14
|
+
}
|
|
15
|
+
tealSign(data, contractAddress) {
|
|
16
|
+
return this.client.tealSign(data, contractAddress, this.connectedAddress);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { MyAlgoSigner };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
class PeraSigner {
|
|
6
|
+
constructor(connectedAddress, client) {
|
|
7
|
+
this.connectedAddress = connectedAddress;
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
signData(data) {
|
|
11
|
+
return this.client.signData(data, this.connectedAddress);
|
|
12
|
+
}
|
|
13
|
+
signTransaction(txs) {
|
|
14
|
+
return this.client.signTransaction(txs);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.PeraSigner = PeraSigner;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PeraWalletConnect } from '@perawallet/connect';
|
|
2
|
+
export interface PeraWalletArbitraryData {
|
|
3
|
+
data: Uint8Array;
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IPeraSigner {
|
|
7
|
+
signData(data: PeraWalletArbitraryData[]): Promise<Uint8Array[]>;
|
|
8
|
+
signTransaction(txs: any[]): Promise<Uint8Array[]>;
|
|
9
|
+
}
|
|
10
|
+
export declare class PeraSigner implements IPeraSigner {
|
|
11
|
+
private readonly connectedAddress;
|
|
12
|
+
private readonly client;
|
|
13
|
+
constructor(connectedAddress: string, client: PeraWalletConnect);
|
|
14
|
+
signData(data: PeraWalletArbitraryData[]): Promise<Uint8Array[]>;
|
|
15
|
+
signTransaction(txs: any[]): Promise<Uint8Array[]>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class PeraSigner {
|
|
2
|
+
constructor(connectedAddress, client) {
|
|
3
|
+
this.connectedAddress = connectedAddress;
|
|
4
|
+
this.client = client;
|
|
5
|
+
}
|
|
6
|
+
signData(data) {
|
|
7
|
+
return this.client.signData(data, this.connectedAddress);
|
|
8
|
+
}
|
|
9
|
+
signTransaction(txs) {
|
|
10
|
+
return this.client.signTransaction(txs);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { PeraSigner };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
|
+
var connect = require('@perawallet/connect');
|
|
7
|
+
var utils = require('@dynamic-labs/utils');
|
|
8
|
+
var AlgorandWalletConnector = require('../AlgorandWalletConnector.cjs');
|
|
9
|
+
var PeraSigner = require('./PeraSigner.cjs');
|
|
10
|
+
|
|
11
|
+
class PeraWalletConnector extends AlgorandWalletConnector.AlgorandWalletConnector {
|
|
12
|
+
constructor(opts) {
|
|
13
|
+
super(Object.assign(Object.assign({}, opts), { cacheKey: 'pera' }));
|
|
14
|
+
this.canConnectViaCustodialService = true;
|
|
15
|
+
this.name = 'Pera Wallet';
|
|
16
|
+
}
|
|
17
|
+
getClient() {
|
|
18
|
+
if (!this.client) {
|
|
19
|
+
this.client = new connect.PeraWalletConnect();
|
|
20
|
+
}
|
|
21
|
+
return this.client;
|
|
22
|
+
}
|
|
23
|
+
getNetwork() {
|
|
24
|
+
var _a;
|
|
25
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return (_a = this.getClient().chainId) === null || _a === void 0 ? void 0 : _a.valueOf();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
fetchPublicAddress() {
|
|
30
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const currentAddress = yield this.cache.getCurrentAddress();
|
|
32
|
+
if (currentAddress) {
|
|
33
|
+
return currentAddress;
|
|
34
|
+
}
|
|
35
|
+
const accounts = yield this.getClient().connect();
|
|
36
|
+
if (!accounts.length) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
const [address] = accounts;
|
|
40
|
+
yield this.cache.setCurrentAddress(address);
|
|
41
|
+
return address;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
getSigner() {
|
|
45
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const address = yield this.fetchPublicAddress();
|
|
47
|
+
if (!address) {
|
|
48
|
+
throw new utils.DynamicError('Pera Wallet Connector - Not connected!');
|
|
49
|
+
}
|
|
50
|
+
return new PeraSigner.PeraSigner(address, this.getClient());
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
signMessage(messageToSign) {
|
|
54
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const signer = yield this.getSigner();
|
|
56
|
+
const signature = yield signer.signData([
|
|
57
|
+
{
|
|
58
|
+
data: Buffer.from(messageToSign),
|
|
59
|
+
message: messageToSign,
|
|
60
|
+
},
|
|
61
|
+
]);
|
|
62
|
+
return Buffer.from(signature[0]).toString('hex');
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
exports.PeraWalletConnector = PeraWalletConnector;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
2
|
+
import { AlgorandWalletConnector } from '../AlgorandWalletConnector';
|
|
3
|
+
import { IPeraSigner } from './PeraSigner';
|
|
4
|
+
export type PeraWalletConnectorOpts = {
|
|
5
|
+
walletBook: WalletBookSchema;
|
|
6
|
+
};
|
|
7
|
+
export declare class PeraWalletConnector extends AlgorandWalletConnector {
|
|
8
|
+
private client?;
|
|
9
|
+
canConnectViaCustodialService: boolean;
|
|
10
|
+
name: string;
|
|
11
|
+
constructor(opts: PeraWalletConnectorOpts);
|
|
12
|
+
private getClient;
|
|
13
|
+
getNetwork(): Promise<number | undefined>;
|
|
14
|
+
fetchPublicAddress(): Promise<string | undefined>;
|
|
15
|
+
getSigner(): Promise<IPeraSigner>;
|
|
16
|
+
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
|
+
import { PeraWalletConnect } from '@perawallet/connect';
|
|
3
|
+
import { DynamicError } from '@dynamic-labs/utils';
|
|
4
|
+
import { AlgorandWalletConnector } from '../AlgorandWalletConnector.js';
|
|
5
|
+
import { PeraSigner } from './PeraSigner.js';
|
|
6
|
+
|
|
7
|
+
class PeraWalletConnector extends AlgorandWalletConnector {
|
|
8
|
+
constructor(opts) {
|
|
9
|
+
super(Object.assign(Object.assign({}, opts), { cacheKey: 'pera' }));
|
|
10
|
+
this.canConnectViaCustodialService = true;
|
|
11
|
+
this.name = 'Pera Wallet';
|
|
12
|
+
}
|
|
13
|
+
getClient() {
|
|
14
|
+
if (!this.client) {
|
|
15
|
+
this.client = new PeraWalletConnect();
|
|
16
|
+
}
|
|
17
|
+
return this.client;
|
|
18
|
+
}
|
|
19
|
+
getNetwork() {
|
|
20
|
+
var _a;
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return (_a = this.getClient().chainId) === null || _a === void 0 ? void 0 : _a.valueOf();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
fetchPublicAddress() {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const currentAddress = yield this.cache.getCurrentAddress();
|
|
28
|
+
if (currentAddress) {
|
|
29
|
+
return currentAddress;
|
|
30
|
+
}
|
|
31
|
+
const accounts = yield this.getClient().connect();
|
|
32
|
+
if (!accounts.length) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const [address] = accounts;
|
|
36
|
+
yield this.cache.setCurrentAddress(address);
|
|
37
|
+
return address;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
getSigner() {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const address = yield this.fetchPublicAddress();
|
|
43
|
+
if (!address) {
|
|
44
|
+
throw new DynamicError('Pera Wallet Connector - Not connected!');
|
|
45
|
+
}
|
|
46
|
+
return new PeraSigner(address, this.getClient());
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
signMessage(messageToSign) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const signer = yield this.getSigner();
|
|
52
|
+
const signature = yield signer.signData([
|
|
53
|
+
{
|
|
54
|
+
data: Buffer.from(messageToSign),
|
|
55
|
+
message: messageToSign,
|
|
56
|
+
},
|
|
57
|
+
]);
|
|
58
|
+
return Buffer.from(signature[0]).toString('hex');
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { PeraWalletConnector };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var PeraWalletConnector = require('./PeraWalletConnector.cjs');
|
|
6
|
+
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
8
|
+
const PeraWalletConnectors = (props) => [PeraWalletConnector.PeraWalletConnector];
|
|
9
|
+
|
|
10
|
+
exports.PeraWalletConnector = PeraWalletConnector.PeraWalletConnector;
|
|
11
|
+
exports.PeraWalletConnectors = PeraWalletConnectors;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PeraWalletConnector } from './PeraWalletConnector.js';
|
|
2
|
+
export { PeraWalletConnector } from './PeraWalletConnector.js';
|
|
3
|
+
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
|
+
const PeraWalletConnectors = (props) => [PeraWalletConnector];
|
|
6
|
+
|
|
7
|
+
export { PeraWalletConnectors };
|