@flowtyio/flow-contracts 0.0.6 → 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 +141 -0
- package/index.js +0 -2
- package/package.json +3 -2
- 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
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
{
|
|
2
|
+
"networks": {
|
|
3
|
+
"emulator": "127.0.0.1:3569",
|
|
4
|
+
"mainnet": "access.mainnet.nodes.onflow.org:9000",
|
|
5
|
+
"sandboxnet": "access.sandboxnet.nodes.onflow.org:9000",
|
|
6
|
+
"testnet": "access.devnet.nodes.onflow.org:9000"
|
|
7
|
+
},
|
|
8
|
+
"accounts": {
|
|
9
|
+
"emulator-account": {
|
|
10
|
+
"address": "f8d6e0586b0a20c7",
|
|
11
|
+
"key": "a8201e155882e2a7ec94644ef0f023ecce8baec418276f95217db1ecf90b03db"
|
|
12
|
+
},
|
|
13
|
+
"emulator-ft": {
|
|
14
|
+
"address": "ee82856bf20e2aa6",
|
|
15
|
+
"key": "a8201e155882e2a7ec94644ef0f023ecce8baec418276f95217db1ecf90b03db"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"contracts": {
|
|
19
|
+
"NonFungibleToken": {
|
|
20
|
+
"source": "./contracts/NonFungibleToken.cdc",
|
|
21
|
+
"aliases": {
|
|
22
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
23
|
+
"testnet": "0x631e88ae7f1d7c20",
|
|
24
|
+
"mainnet": "0x1d7e57aa55817448"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"MetadataViews": {
|
|
28
|
+
"source": "./contracts/MetadataViews.cdc",
|
|
29
|
+
"aliases": {
|
|
30
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
31
|
+
"testnet": "0x631e88ae7f1d7c20",
|
|
32
|
+
"mainnet": "0x1d7e57aa55817448"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"FungibleToken": {
|
|
36
|
+
"source": "./contracts/FungibleToken.cdc",
|
|
37
|
+
"aliases": {
|
|
38
|
+
"emulator": "0xee82856bf20e2aa6",
|
|
39
|
+
"testnet": "0x9a0766d93b6608b7",
|
|
40
|
+
"mainnet": "0xf233dcee88fe0abe"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"ViewResolver": {
|
|
44
|
+
"source": "./contracts/ViewResolver.cdc",
|
|
45
|
+
"aliases": {
|
|
46
|
+
"emulator": "0xf8d6e0586b0a20c7",
|
|
47
|
+
"testnet": "0x631e88ae7f1d7c20",
|
|
48
|
+
"mainnet": "0x1d7e57aa55817448"
|
|
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
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"deployments": {
|
|
130
|
+
"emulator": {
|
|
131
|
+
"emulator-account": [
|
|
132
|
+
"NonFungibleToken",
|
|
133
|
+
"MetadataViews",
|
|
134
|
+
"ViewResolver"
|
|
135
|
+
],
|
|
136
|
+
"emulator-ft": [
|
|
137
|
+
"FungibleToken"
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowtyio/flow-contracts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"main": "index.json",
|
|
5
5
|
"description": "An NPM package for common flow contracts",
|
|
6
6
|
"author": "flowtyio",
|
|
@@ -27,9 +27,10 @@
|
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"*.js",
|
|
30
|
-
"README.md",
|
|
31
30
|
"index.json",
|
|
32
31
|
"contracts/*.cdc",
|
|
32
|
+
"flow.json",
|
|
33
|
+
"README.md",
|
|
33
34
|
"LICENSE"
|
|
34
35
|
]
|
|
35
36
|
}
|
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
|
|