@dynamic-labs/starknet 4.0.0-alpha.45 → 4.0.0-alpha.47
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 +28 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -9
- package/src/wallet/StarknetWallet.cjs +24 -0
- package/src/wallet/StarknetWallet.d.ts +10 -0
- package/src/wallet/StarknetWallet.js +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.47](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.46...v4.0.0-alpha.47) (2024-12-17)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* stop exposing authToken and minAuthToken from dynamic context (#7629)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* allow re-linking unknown wallet when there's another account of the same wallet provider already linked ([#7628](https://github.com/dynamic-labs/dynamic-auth/issues/7628)) ([20c6dc3](https://github.com/dynamic-labs/dynamic-auth/commit/20c6dc3b1847d82bd46f0df5abaef4efe1e24e38))
|
|
12
|
+
* ensure wallet connector will not get removed ([#7625](https://github.com/dynamic-labs/dynamic-auth/issues/7625)) ([b764846](https://github.com/dynamic-labs/dynamic-auth/commit/b764846b56428e2997d33858e29a87f44359eb6c))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
* stop exposing authToken and minAuthToken from dynamic context ([#7629](https://github.com/dynamic-labs/dynamic-auth/issues/7629)) ([9648870](https://github.com/dynamic-labs/dynamic-auth/commit/9648870478cdcecde279117ada2a1095dab54e2c))
|
|
16
|
+
|
|
17
|
+
## [4.0.0-alpha.46](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.45...v4.0.0-alpha.46) (2024-12-17)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **GVTY-2484:** add subdomain handle field ([#7613](https://github.com/dynamic-labs/dynamic-auth/issues/7613)) ([ee8df3b](https://github.com/dynamic-labs/dynamic-auth/commit/ee8df3b34fa9fed96d92d0b414334c370c9791bc))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* increase wait for transactions ([#7624](https://github.com/dynamic-labs/dynamic-auth/issues/7624)) ([2f7f01b](https://github.com/dynamic-labs/dynamic-auth/commit/2f7f01b024c2733f71ea0fd09dff24f815120acb))
|
|
28
|
+
* solana wallet standard signer connect ([#7614](https://github.com/dynamic-labs/dynamic-auth/issues/7614)) ([1836cf3](https://github.com/dynamic-labs/dynamic-auth/commit/1836cf343b45bae01cfdcf0c0d010bf38bf54d83))
|
|
29
|
+
|
|
2
30
|
## [4.0.0-alpha.45](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.44...v4.0.0-alpha.45) (2024-12-11)
|
|
3
31
|
|
|
4
32
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/starknet",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.47",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"starknet": "6.11.0",
|
|
24
24
|
"starknetkit": "2.6.2",
|
|
25
25
|
"text-encoding": "0.7.0",
|
|
26
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
27
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/logger": "4.0.0-alpha.
|
|
29
|
-
"@dynamic-labs/rpc-providers": "4.0.0-alpha.
|
|
30
|
-
"@dynamic-labs/starknet-core": "4.0.0-alpha.
|
|
31
|
-
"@dynamic-labs/utils": "4.0.0-alpha.
|
|
32
|
-
"@dynamic-labs/wallet-book": "4.0.0-alpha.
|
|
33
|
-
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.
|
|
26
|
+
"@dynamic-labs/sdk-api-core": "0.0.576",
|
|
27
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.47",
|
|
28
|
+
"@dynamic-labs/logger": "4.0.0-alpha.47",
|
|
29
|
+
"@dynamic-labs/rpc-providers": "4.0.0-alpha.47",
|
|
30
|
+
"@dynamic-labs/starknet-core": "4.0.0-alpha.47",
|
|
31
|
+
"@dynamic-labs/utils": "4.0.0-alpha.47",
|
|
32
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.47",
|
|
33
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.47",
|
|
34
34
|
"assert": "2.1.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {}
|
|
@@ -4,10 +4,34 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
|
+
var starknet = require('starknet');
|
|
7
8
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
9
|
var utils = require('@dynamic-labs/utils');
|
|
10
|
+
var constants = require('../constants.cjs');
|
|
11
|
+
var ethereumContractAbi = require('../ethereumContractAbi.cjs');
|
|
9
12
|
|
|
10
13
|
class StarknetWallet extends walletConnectorCore.Wallet {
|
|
14
|
+
/**
|
|
15
|
+
* Sends the native balance of the wallet to the given address.
|
|
16
|
+
* @param amount - The amount of balance to send (in Starknet ETH).
|
|
17
|
+
* @param toAddress - The address to send the balance to.
|
|
18
|
+
* @returns The signature of the sent transaction.
|
|
19
|
+
*/
|
|
20
|
+
sendBalance(_a) {
|
|
21
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
|
|
22
|
+
yield this._connector.connect();
|
|
23
|
+
const account = yield this._connector.getWalletAccount();
|
|
24
|
+
if (!account) {
|
|
25
|
+
throw new Error('unable to retrieve Starknet wallet account');
|
|
26
|
+
}
|
|
27
|
+
const contract = new starknet.Contract(ethereumContractAbi, constants.ETH_STARKNET_ADDRESS, account);
|
|
28
|
+
const transfer = yield contract.invoke('transfer', [
|
|
29
|
+
toAddress,
|
|
30
|
+
starknet.cairo.uint256(Number(amount) * 1e18),
|
|
31
|
+
]);
|
|
32
|
+
return transfer === null || transfer === void 0 ? void 0 : transfer.transaction_hash;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
11
35
|
getWalletAccount() {
|
|
12
36
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
13
37
|
const account = yield this._connector.getWalletAccount();
|
|
@@ -2,6 +2,16 @@ import { RpcProvider, WalletAccount } from 'starknet';
|
|
|
2
2
|
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { StarknetWalletConnector } from '../StarknetWalletConnector';
|
|
4
4
|
export declare class StarknetWallet extends Wallet<StarknetWalletConnector> {
|
|
5
|
+
/**
|
|
6
|
+
* Sends the native balance of the wallet to the given address.
|
|
7
|
+
* @param amount - The amount of balance to send (in Starknet ETH).
|
|
8
|
+
* @param toAddress - The address to send the balance to.
|
|
9
|
+
* @returns The signature of the sent transaction.
|
|
10
|
+
*/
|
|
11
|
+
sendBalance({ amount, toAddress, }: {
|
|
12
|
+
amount: string;
|
|
13
|
+
toAddress: string;
|
|
14
|
+
}): Promise<string>;
|
|
5
15
|
getWalletAccount(): Promise<WalletAccount>;
|
|
6
16
|
getProvider(): Promise<RpcProvider>;
|
|
7
17
|
}
|
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
|
+
import { Contract, cairo } from 'starknet';
|
|
3
4
|
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
4
5
|
import { wrapMethodWithCallback } from '@dynamic-labs/utils';
|
|
6
|
+
import { ETH_STARKNET_ADDRESS } from '../constants.js';
|
|
7
|
+
import ETH_CONTRACT_ABI from '../ethereumContractAbi.js';
|
|
5
8
|
|
|
6
9
|
class StarknetWallet extends Wallet {
|
|
10
|
+
/**
|
|
11
|
+
* Sends the native balance of the wallet to the given address.
|
|
12
|
+
* @param amount - The amount of balance to send (in Starknet ETH).
|
|
13
|
+
* @param toAddress - The address to send the balance to.
|
|
14
|
+
* @returns The signature of the sent transaction.
|
|
15
|
+
*/
|
|
16
|
+
sendBalance(_a) {
|
|
17
|
+
return __awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
|
|
18
|
+
yield this._connector.connect();
|
|
19
|
+
const account = yield this._connector.getWalletAccount();
|
|
20
|
+
if (!account) {
|
|
21
|
+
throw new Error('unable to retrieve Starknet wallet account');
|
|
22
|
+
}
|
|
23
|
+
const contract = new Contract(ETH_CONTRACT_ABI, ETH_STARKNET_ADDRESS, account);
|
|
24
|
+
const transfer = yield contract.invoke('transfer', [
|
|
25
|
+
toAddress,
|
|
26
|
+
cairo.uint256(Number(amount) * 1e18),
|
|
27
|
+
]);
|
|
28
|
+
return transfer === null || transfer === void 0 ? void 0 : transfer.transaction_hash;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
7
31
|
getWalletAccount() {
|
|
8
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9
33
|
const account = yield this._connector.getWalletAccount();
|