@dynamic-labs/flow 4.0.0-alpha.46 → 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 +15 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +5 -5
- package/src/utils.cjs +27 -0
- package/src/utils.d.ts +1 -0
- package/src/utils.js +23 -0
- package/src/wallet/FlowWallet.cjs +21 -0
- package/src/wallet/FlowWallet.d.ts +10 -0
- package/src/wallet/FlowWallet.js +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
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
|
+
|
|
2
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)
|
|
3
18
|
|
|
4
19
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/flow",
|
|
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",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@onflow/fcl": "1.10.0",
|
|
22
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/utils": "4.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/wallet-book": "4.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.
|
|
22
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.47",
|
|
23
|
+
"@dynamic-labs/utils": "4.0.0-alpha.47",
|
|
24
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.47",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.47"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {}
|
|
28
28
|
}
|
package/src/utils.cjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const flowSendBalanceCadence = `
|
|
7
|
+
import FungibleToken from 0xFT
|
|
8
|
+
import FlowToken from 0xFLOW
|
|
9
|
+
|
|
10
|
+
transaction(recepient: Address, amount: UFix64){
|
|
11
|
+
prepare(signer: AuthAccount){
|
|
12
|
+
let sender = signer.borrow<&FlowToken.Vault>(from: /storage/flowTokenVault)
|
|
13
|
+
?? panic("Could not borrow Provider reference to the Vault")
|
|
14
|
+
|
|
15
|
+
let receiverAccount = getAccount(recepient)
|
|
16
|
+
|
|
17
|
+
let receiver = receiverAccount.getCapability(/public/flowTokenReceiver)
|
|
18
|
+
.borrow<&FlowToken.Vault{FungibleToken.Receiver}>()
|
|
19
|
+
?? panic("Could not borrow Receiver reference to the Vault")
|
|
20
|
+
|
|
21
|
+
let tempVault <- sender.withdraw(amount: amount)
|
|
22
|
+
receiver.deposit(from: <- tempVault)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports.flowSendBalanceCadence = flowSendBalanceCadence;
|
package/src/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const flowSendBalanceCadence = "\n import FungibleToken from 0xFT\n import FlowToken from 0xFLOW\n\n transaction(recepient: Address, amount: UFix64){\n prepare(signer: AuthAccount){\n let sender = signer.borrow<&FlowToken.Vault>(from: /storage/flowTokenVault)\n ?? panic(\"Could not borrow Provider reference to the Vault\")\n\n let receiverAccount = getAccount(recepient)\n\n let receiver = receiverAccount.getCapability(/public/flowTokenReceiver)\n .borrow<&FlowToken.Vault{FungibleToken.Receiver}>()\n ?? panic(\"Could not borrow Receiver reference to the Vault\")\n\n let tempVault <- sender.withdraw(amount: amount)\n receiver.deposit(from: <- tempVault)\n }\n }\n";
|
package/src/utils.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const flowSendBalanceCadence = `
|
|
3
|
+
import FungibleToken from 0xFT
|
|
4
|
+
import FlowToken from 0xFLOW
|
|
5
|
+
|
|
6
|
+
transaction(recepient: Address, amount: UFix64){
|
|
7
|
+
prepare(signer: AuthAccount){
|
|
8
|
+
let sender = signer.borrow<&FlowToken.Vault>(from: /storage/flowTokenVault)
|
|
9
|
+
?? panic("Could not borrow Provider reference to the Vault")
|
|
10
|
+
|
|
11
|
+
let receiverAccount = getAccount(recepient)
|
|
12
|
+
|
|
13
|
+
let receiver = receiverAccount.getCapability(/public/flowTokenReceiver)
|
|
14
|
+
.borrow<&FlowToken.Vault{FungibleToken.Receiver}>()
|
|
15
|
+
?? panic("Could not borrow Receiver reference to the Vault")
|
|
16
|
+
|
|
17
|
+
let tempVault <- sender.withdraw(amount: amount)
|
|
18
|
+
receiver.deposit(from: <- tempVault)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export { flowSendBalanceCadence };
|
|
@@ -3,9 +3,30 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
|
+
var fcl = require('@onflow/fcl');
|
|
6
8
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
|
+
var utils = require('../utils.cjs');
|
|
7
10
|
|
|
8
11
|
class FlowWallet extends walletConnectorCore.Wallet {
|
|
12
|
+
/**
|
|
13
|
+
* Sends the native balance of the wallet to the given address.
|
|
14
|
+
* @param amount - The amount of balance to send (in FLOW).
|
|
15
|
+
* @param toAddress - The address to send the balance to.
|
|
16
|
+
* @returns The transaction id of the sent transaction.
|
|
17
|
+
*/
|
|
18
|
+
sendBalance(_a) {
|
|
19
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
|
|
20
|
+
yield this._connector.connect();
|
|
21
|
+
const args = (arg, t) => [
|
|
22
|
+
arg(toAddress, t.Address),
|
|
23
|
+
arg(amount, t.UFix64),
|
|
24
|
+
];
|
|
25
|
+
const limit = 500;
|
|
26
|
+
const txId = yield fcl.mutate({ args, cadence: utils.flowSendBalanceCadence, limit });
|
|
27
|
+
return txId;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
9
30
|
}
|
|
10
31
|
|
|
11
32
|
exports.FlowWallet = FlowWallet;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
2
2
|
import { FlowWalletConnector } from '../FlowWalletConnector';
|
|
3
3
|
export declare class FlowWallet extends Wallet<FlowWalletConnector> {
|
|
4
|
+
/**
|
|
5
|
+
* Sends the native balance of the wallet to the given address.
|
|
6
|
+
* @param amount - The amount of balance to send (in FLOW).
|
|
7
|
+
* @param toAddress - The address to send the balance to.
|
|
8
|
+
* @returns The transaction id of the sent transaction.
|
|
9
|
+
*/
|
|
10
|
+
sendBalance({ amount, toAddress, }: {
|
|
11
|
+
amount?: string;
|
|
12
|
+
toAddress: string;
|
|
13
|
+
}): Promise<any>;
|
|
4
14
|
}
|
package/src/wallet/FlowWallet.js
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
|
+
import { mutate } from '@onflow/fcl';
|
|
2
4
|
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
import { flowSendBalanceCadence } from '../utils.js';
|
|
3
6
|
|
|
4
7
|
class FlowWallet extends Wallet {
|
|
8
|
+
/**
|
|
9
|
+
* Sends the native balance of the wallet to the given address.
|
|
10
|
+
* @param amount - The amount of balance to send (in FLOW).
|
|
11
|
+
* @param toAddress - The address to send the balance to.
|
|
12
|
+
* @returns The transaction id of the sent transaction.
|
|
13
|
+
*/
|
|
14
|
+
sendBalance(_a) {
|
|
15
|
+
return __awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
|
|
16
|
+
yield this._connector.connect();
|
|
17
|
+
const args = (arg, t) => [
|
|
18
|
+
arg(toAddress, t.Address),
|
|
19
|
+
arg(amount, t.UFix64),
|
|
20
|
+
];
|
|
21
|
+
const limit = 500;
|
|
22
|
+
const txId = yield mutate({ args, cadence: flowSendBalanceCadence, limit });
|
|
23
|
+
return txId;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
5
26
|
}
|
|
6
27
|
|
|
7
28
|
export { FlowWallet };
|