@flowtyio/flow-contracts 0.0.7 → 0.0.9
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/README.md +13 -1
- package/add.js +2 -2
- package/find.js +26 -0
- package/flow.json +77 -0
- package/index.js +0 -2
- package/package.json +1 -1
- package/utils.js +2 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# flow-contracts
|
|
2
2
|
|
|
3
3
|
```
|
|
4
|
-
npm i @
|
|
4
|
+
npm i @flowtyio/flow-contracts
|
|
5
5
|
```
|
|
6
6
|
|
|
7
7
|
## Commands
|
|
@@ -40,6 +40,18 @@ Currently, the list includes:
|
|
|
40
40
|
| NonFungibleToken | 0x1d7e57aa55817448 | 0x631e88ae7f1d7c20 |
|
|
41
41
|
| MetadataViews | 0x1d7e57aa55817448 | 0x631e88ae7f1d7c20 |
|
|
42
42
|
| ViewResolver | 0x1d7e57aa55817448 | 0x631e88ae7f1d7c20 |
|
|
43
|
+
| HybridCusody | 0x294e44e1ec6993c6 | N/A |
|
|
44
|
+
| CapabilityFactory | 0x294e44e1ec6993c6 | N/A |
|
|
45
|
+
| CapabilityFilter | 0x294e44e1ec6993c6 | N/A |
|
|
46
|
+
| CapabilityDelegator | 0x294e44e1ec6993c6 | N/A |
|
|
47
|
+
| FTAllFactory | 0x294e44e1ec6993c6 | N/A |
|
|
48
|
+
| FTBalanceFactory | 0x294e44e1ec6993c6 | N/A |
|
|
49
|
+
| FTProviderFactory | 0x294e44e1ec6993c6 | N/A |
|
|
50
|
+
| FTReceiverFactory | 0x294e44e1ec6993c6 | N/A |
|
|
51
|
+
| NFTCollectionPublicFactory | 0x294e44e1ec6993c6 | N/A |
|
|
52
|
+
| NFTProviderAndCollectionPublicFactory | 0x294e44e1ec6993c6 | N/A |
|
|
53
|
+
| NFTProviderFactory | 0x294e44e1ec6993c6 | N/A |
|
|
54
|
+
|
|
43
55
|
|
|
44
56
|
## Using a contract
|
|
45
57
|
|
package/add.js
CHANGED
|
@@ -48,7 +48,7 @@ const importContract = (contractName, source, config, account) => {
|
|
|
48
48
|
return
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
contract.source =
|
|
51
|
+
contract.source = contract.source.replace("./contracts/", "./node_modules/@flowtyio/flow-contracts/contracts/")
|
|
52
52
|
|
|
53
53
|
if (specialContractsHandlers[contractName]) {
|
|
54
54
|
specialContractsHandlers[contractName](contract, newConfig, account)
|
|
@@ -78,7 +78,7 @@ const add = ({name, config, account}) => {
|
|
|
78
78
|
return
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
contract.source =
|
|
81
|
+
contract.source = contract.source.replace("./contracts/", "./node_modules/@flowtyio/flow-contracts/contracts/")
|
|
82
82
|
|
|
83
83
|
if (!userConfig.contracts) {
|
|
84
84
|
userConfig.contracts = {}
|
package/find.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const findFileInDirectory = (directoryPath, fileNameToFind) => {
|
|
5
|
+
const files = fs.readdirSync(directoryPath);
|
|
6
|
+
|
|
7
|
+
for (const file of files) {
|
|
8
|
+
const filePath = path.join(directoryPath, file);
|
|
9
|
+
const stats = fs.statSync(filePath);
|
|
10
|
+
|
|
11
|
+
if (stats.isFile() && file === fileNameToFind) {
|
|
12
|
+
return filePath;
|
|
13
|
+
} else if (stats.isDirectory()) {
|
|
14
|
+
const foundFilePath = findFileInDirectory(filePath, fileNameToFind);
|
|
15
|
+
if (foundFilePath) {
|
|
16
|
+
return foundFilePath;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return null; // File not found
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = {
|
|
25
|
+
findFileInDirectory
|
|
26
|
+
}
|
package/flow.json
CHANGED
|
@@ -47,6 +47,83 @@
|
|
|
47
47
|
"testnet": "0x631e88ae7f1d7c20",
|
|
48
48
|
"mainnet": "0x1d7e57aa55817448"
|
|
49
49
|
}
|
|
50
|
+
},
|
|
51
|
+
"HybridCustody": {
|
|
52
|
+
"source": "./contracts/hybrid-custody/HybridCustody.cdc",
|
|
53
|
+
"aliases": {
|
|
54
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
55
|
+
"testnet": "0x294e44e1ec6993c6"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"CapabilityFactory": {
|
|
59
|
+
"source": "./contracts/hybrid-custody/CapabilityFactory.cdc",
|
|
60
|
+
"aliases": {
|
|
61
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
62
|
+
"testnet": "0x294e44e1ec6993c6"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"CapabilityDelegator": {
|
|
66
|
+
"source": "./contracts/hybrid-custody/CapabilityDelegator.cdc",
|
|
67
|
+
"aliases": {
|
|
68
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
69
|
+
"testnet": "0x294e44e1ec6993c6"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"CapabilityFilter": {
|
|
73
|
+
"source": "./contracts/hybrid-custody/CapabilityFilter.cdc",
|
|
74
|
+
"aliases": {
|
|
75
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
76
|
+
"testnet": "0x294e44e1ec6993c6"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"FTAllFactory": {
|
|
80
|
+
"source": "./contracts/hybrid-custody/factories/FTAllFactory.cdc",
|
|
81
|
+
"aliases": {
|
|
82
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
83
|
+
"testnet": "0x294e44e1ec6993c6"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"FTBalanceFactory": {
|
|
87
|
+
"source": "./contracts/hybrid-custody/factories/FTBalanceFactory.cdc",
|
|
88
|
+
"aliases": {
|
|
89
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
90
|
+
"testnet": "0x294e44e1ec6993c6"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"FTProviderFactory": {
|
|
94
|
+
"source": "./contracts/hybrid-custody/factories/FTProviderFactory.cdc",
|
|
95
|
+
"aliases": {
|
|
96
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
97
|
+
"testnet": "0x294e44e1ec6993c6"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"FTReceiverFactory": {
|
|
101
|
+
"source": "./contracts/hybrid-custody/factories/FTReceiverFactory.cdc",
|
|
102
|
+
"aliases": {
|
|
103
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
104
|
+
"testnet": "0x294e44e1ec6993c6"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"NFTCollectionPublicFactory": {
|
|
108
|
+
"source": "./contracts/hybrid-custody/factories/NFTCollectionPublicFactory.cdc",
|
|
109
|
+
"aliases": {
|
|
110
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
111
|
+
"testnet": "0x294e44e1ec6993c6"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"NFTProviderAndCollectionPublicFactory": {
|
|
115
|
+
"source": "./contracts/hybrid-custody/factories/NFTProviderAndCollectionPublicFactory.cdc",
|
|
116
|
+
"aliases": {
|
|
117
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
118
|
+
"testnet": "0x294e44e1ec6993c6"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"NFTProviderFactory": {
|
|
122
|
+
"source": "./contracts/hybrid-custody/factories/NFTProviderFactory.cdc",
|
|
123
|
+
"aliases": {
|
|
124
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
125
|
+
"testnet": "0x294e44e1ec6993c6"
|
|
126
|
+
}
|
|
50
127
|
}
|
|
51
128
|
},
|
|
52
129
|
"deployments": {
|
package/index.js
CHANGED
|
@@ -32,8 +32,6 @@ program.command("add-all")
|
|
|
32
32
|
.option('-c, --config <config>', 'File location of the config to be edited')
|
|
33
33
|
.option('-a, --account <account>', 'Account to be used for signing', 'emulator-account')
|
|
34
34
|
.action(({config, account}) => {
|
|
35
|
-
console.log("config: ", config, "account: ", account)
|
|
36
|
-
|
|
37
35
|
if(!config) {
|
|
38
36
|
options.config = getDefaultConfigPath()
|
|
39
37
|
console.log("no config specified, using default config: ", options.config)
|
package/package.json
CHANGED
package/utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
|
+
const {findFileInDirectory} = require("./find");
|
|
2
3
|
|
|
3
4
|
const getDefaultConfigPath = () => {
|
|
4
5
|
const currentWorkingDirectory = process.cwd();
|
|
@@ -15,7 +16,7 @@ const getConfig = (path) => {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const getContractCode = (contractName) => {
|
|
18
|
-
const path = `${__dirname}/contracts
|
|
19
|
+
const path = findFileInDirectory(`${__dirname}/contracts`, `${contractName}.cdc`)
|
|
19
20
|
return fs.readFileSync(path, 'utf8')
|
|
20
21
|
}
|
|
21
22
|
|