@flowtyio/flow-contracts 0.0.1

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -0
  3. package/index.json +1 -0
  4. package/package.json +9 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Flowty
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # flow-contracts
2
+
3
+ ```
4
+ npm i @flowty/flow-contracts
5
+ ```
6
+
7
+ This repository publishes common Flow contracts as an npm package so that they can be more easily consumed.
8
+ Currently, the list includes:
9
+
10
+ | Name | Mainnet | Testnet |
11
+ |--------|-----------|-----------|
12
+ | FungibleToken | 0xf233dcee88fe0abe | 0x9a0766d93b6608b7 |
13
+ | NonFungibleToken | 0x1d7e57aa55817448 | 0x631e88ae7f1d7c20 |
14
+ | MetadataViews | 0x1d7e57aa55817448 | 0x631e88ae7f1d7c20 |
15
+ | ViewResolver | 0x1d7e57aa55817448 | 0x631e88ae7f1d7c20 |
16
+
17
+ ## Using a contract
18
+
19
+ You can follow our `example/flow.json` to see how to import each contract. Please note the following:
20
+ - **Some contracts need special handling and are marked with a * (see section below.)**
21
+ - The address of the emulator version of a deployed address might need to change depending on your setup
22
+ - You will also need to ensure that any contract you add is also in your emulator deployment section.
23
+
24
+ For example, here is how you might add `NonFungibleToken` to your flow.json :
25
+
26
+ ```
27
+ {
28
+ "networks": {
29
+ "emulator": "127.0.0.1:3569",
30
+ ...
31
+ },
32
+ "accounts": {
33
+ "emulator-account": {
34
+ ...
35
+ }
36
+ },
37
+ "contracts": {
38
+ "NonFungibleToken": {
39
+ "source": "./node_modules/@flowty/flow-contracts/contracts/NonFungibleToken.cdc",
40
+ "aliases": {
41
+ "emulator": "0xf8d6e0586b0a20c7",
42
+ "testnet": "0x631e88ae7f1d7c20",
43
+ "mainnet": "0x1d7e57aa55817448"
44
+ }
45
+ }
46
+ },
47
+ "deployments": {
48
+ "emulator": {
49
+ "emulator-account": [
50
+ "NonFungibleToken"
51
+ ]
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ ## Important Notes
58
+
59
+ ### FungibleToken
60
+
61
+ FungibleToken is a contract that is automatically deployed to the flow emulator. If you want to deploy
62
+ your project to the flow emulator AND you and to import `FungibleToken` into your contracts, scripts, or transactions,
63
+ you will need to:
64
+
65
+ - Add an account which deploys to the FungibleToken address
66
+ - Setup a deployment section in the emulator for this account
67
+ - Always deploy your project using the `--update` flag, even if it's the first deployment (this is because FungibleToken is already deployed)
68
+
69
+ ```
70
+ {
71
+ "networks": {
72
+ "emulator": "127.0.0.1:3569"
73
+ },
74
+ "accounts": {
75
+ "emulator-account": {
76
+ "address": "f8d6e0586b0a20c7",
77
+ "key": "a8201e155882e2a7ec94644ef0f023ecce8baec418276f95217db1ecf90b03db"
78
+ },
79
+ "emulator-ft": {
80
+ "address": "ee82856bf20e2aa6",
81
+ "key": "a8201e155882e2a7ec94644ef0f023ecce8baec418276f95217db1ecf90b03db"
82
+ }
83
+ },
84
+ "contracts": {
85
+ "FungibleToken": {
86
+ "source": "./node_modules/@flowty/flow-contracts/contracts/FungibleToken.cdc",
87
+ "aliases": {
88
+ "emulator": "0xee82856bf20e2aa6",
89
+ }
90
+ }
91
+ },
92
+ "deployments": {
93
+ "emulator": {
94
+ "emulator-ft": [
95
+ "FungibleToken"
96
+ ]
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ If you would like to request other contracts be included, please create a ticket, or submit a PullRequest to add them and
103
+ ping us on Twitter/Discord.
104
+
105
+ Cheers!
package/index.json ADDED
@@ -0,0 +1 @@
1
+ {}
package/package.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@flowtyio/flow-contracts",
3
+ "version": "0.0.1",
4
+ "main": "index.json",
5
+ "description": "An NPM package for common flow contracts",
6
+ "author": "Flowty",
7
+ "license": "MIT"
8
+ }
9
+