@lukso/lsp-smart-contracts 0.16.2 → 0.16.4
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 +91 -2
- package/dist/abi.cjs +13834 -0
- package/dist/abi.d.cts +19732 -0
- package/dist/abi.d.mts +19732 -0
- package/dist/abi.d.ts +19732 -0
- package/dist/abi.mjs +13799 -0
- package/dist/constants.d.cts +2 -1
- package/dist/constants.d.mts +2 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.mjs +2 -2
- package/package.json +14 -14
- package/artifacts/LSP0ERC725Account.json +0 -676
- package/artifacts/LSP0ERC725AccountInit.json +0 -696
- package/artifacts/LSP11SocialRecovery.json +0 -1171
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +0 -88
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +0 -88
- package/artifacts/LSP23LinkedContractsFactory.json +0 -544
- package/artifacts/LSP26FollowerSystem.json +0 -248
- package/artifacts/LSP4DigitalAssetMetadata.json +0 -210
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +0 -218
- package/artifacts/LSP6KeyManager.json +0 -600
- package/artifacts/LSP6KeyManagerInit.json +0 -620
- package/artifacts/LSP7CappedSupply.json +0 -817
- package/artifacts/LSP7CappedSupplyInitAbstract.json +0 -825
- package/artifacts/LSP7DigitalAsset.json +0 -794
- package/artifacts/LSP7DigitalAssetInitAbstract.json +0 -802
- package/artifacts/LSP7Mintable.json +0 -853
- package/artifacts/LSP7MintableInit.json +0 -873
- package/artifacts/LSP7Votes.json +0 -1154
- package/artifacts/LSP8Burnable.json +0 -943
- package/artifacts/LSP8BurnableInitAbstract.json +0 -951
- package/artifacts/LSP8CappedSupply.json +0 -948
- package/artifacts/LSP8CappedSupplyInitAbstract.json +0 -956
- package/artifacts/LSP8Enumerable.json +0 -944
- package/artifacts/LSP8EnumerableInitAbstract.json +0 -952
- package/artifacts/LSP8IdentifiableDigitalAsset.json +0 -925
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +0 -933
- package/artifacts/LSP8Mintable.json +0 -995
- package/artifacts/LSP8MintableInit.json +0 -1015
- package/artifacts/LSP8Votes.json +0 -1230
- package/artifacts/LSP8VotesInitAbstract.json +0 -1222
- package/artifacts/LSP9Vault.json +0 -631
- package/artifacts/LSP9VaultInit.json +0 -651
- package/artifacts/UniversalProfile.json +0 -676
- package/artifacts/UniversalProfileInit.json +0 -696
- package/types/index.ts +0 -25392
package/README.md
CHANGED
|
@@ -8,21 +8,110 @@ This is the _"umbrella"_ package for the LSP smart contracts. It contains all th
|
|
|
8
8
|
npm install @lukso/lsp-smart-contracts
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### in Javascript
|
|
14
|
+
|
|
15
|
+
You can use the contracts JSON ABI by importing them as follow:
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import LSP0ERC725Account from "@lukso/lsp-smart-contracts/artifacts/LSP0ERC725Account.json";
|
|
19
|
+
|
|
20
|
+
const myContract = new web3.eth.Contract(
|
|
21
|
+
LSP0ERC725Account.abi,
|
|
22
|
+
"",
|
|
23
|
+
defaultOptions
|
|
24
|
+
);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### in Solidity
|
|
28
|
+
|
|
29
|
+
```sol
|
|
30
|
+
import "@lukso/lsp-smart-contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.sol";
|
|
31
|
+
|
|
32
|
+
contract MyAccount is LSP0ERC725Account {
|
|
33
|
+
constructor(address _newOwner) LSP0ERC725Account(_newOwner) {}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
11
37
|
## Available Constants & Types
|
|
12
38
|
|
|
13
|
-
The `@lukso/lsp-smart-contracts` npm package contains useful constants such as interface IDs, and ERC725Y data keys related to the LSP Standards. You can import and access them as follows
|
|
39
|
+
The `@lukso/lsp-smart-contracts` npm package contains useful constants such as interface IDs, and ERC725Y data keys related to the LSP Standards. You can import and access them as follows.
|
|
14
40
|
|
|
15
41
|
```js
|
|
16
42
|
import {
|
|
17
43
|
INTERFACE_IDS,
|
|
44
|
+
ERC1271,
|
|
18
45
|
LSP8_TOKEN_ID_FORMAT,
|
|
19
46
|
LSP1_TYPE_IDS,
|
|
20
|
-
|
|
47
|
+
OPERATION_TYPES,
|
|
48
|
+
PERMISSIONS,
|
|
49
|
+
ALL_PERMISSIONS,
|
|
21
50
|
SupportedStandards,
|
|
22
51
|
ERC725YDataKeys,
|
|
23
52
|
INTERFACE_ID_LSP1DELEGATE,
|
|
24
53
|
LSP6DataKeys,
|
|
25
54
|
LSP25_VERSION,
|
|
26
55
|
LSPSupportedStandard,
|
|
56
|
+
ErrorSelectors,
|
|
57
|
+
EventSigHashes,
|
|
58
|
+
FunctionSelectors,
|
|
59
|
+
ContractsDocs,
|
|
60
|
+
StateVariables,
|
|
27
61
|
} from "@lukso/lsp-smart-contracts";
|
|
28
62
|
```
|
|
63
|
+
|
|
64
|
+
> **Note:** we also export it as `@lukso/lsp-smart-contracts/constants` or `@lukso/lsp-smart-contracts/constants.js` to keep it backward compatible.
|
|
65
|
+
|
|
66
|
+
It also includes constant values [Array data keys](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-2-ERC725YJSONSchema.md#Array) to retrieve both the array length and for index access.
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
'LSP5ReceivedAssets[]': {
|
|
70
|
+
length: '0x6460ee3c0aac563ccbf76d6e1d07bada78e3a9514e6382b736ed3f478ab7b90b',
|
|
71
|
+
index: '0x6460ee3c0aac563ccbf76d6e1d07bada',
|
|
72
|
+
},
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Note for Hardhat Typescript projects
|
|
76
|
+
|
|
77
|
+
If you are trying to import the constants in a Hardhat project that uses Typescript, you will need to import the constants from the `dist` folder directly, as shown in the code snippet:
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
import { INTERFACE_IDS } from "@lukso/lsp-smart-contracts/dist/constants.cjs.js";
|
|
81
|
+
|
|
82
|
+
// This will raise an error if you have ES Lint enabled,
|
|
83
|
+
// but will allow you to import the constants in a Hardhat + Typescript based project.
|
|
84
|
+
const LSP0InterfaceId = INTERFACE_IDS.LSP0ERC725Account;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
See the [issue related to Hardhat Typescript + ES Modules](https://hardhat.org/hardhat-runner/docs/advanced/using-esm#esm-and-typescript-projects) in the Hardhat docs for more infos.
|
|
88
|
+
|
|
89
|
+
## Typescript types
|
|
90
|
+
|
|
91
|
+
The following additional typescript types are also available, including types for the JSON format of the LSP3 Profile and LSP4 Digital Asset metadata.
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import {
|
|
95
|
+
LSP2ArrayKey,
|
|
96
|
+
LSPSupportedStandard,
|
|
97
|
+
LSP6PermissionName,
|
|
98
|
+
LSP3ProfileMetadataJSON,
|
|
99
|
+
LSP3ProfileMetadata,
|
|
100
|
+
LSP4DigitalAssetMetadataJSON,
|
|
101
|
+
LSP4DigitalAssetMetadata,
|
|
102
|
+
ImageMetadata,
|
|
103
|
+
LinkMetadata,
|
|
104
|
+
AssetMetadata,
|
|
105
|
+
} from "@lukso/lsp-smart-contracts";
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
You can also import the [type-safe ABI](https://abitype.dev/) of each LSP smart contracts from the `/abi` path.
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import {
|
|
112
|
+
lsp0Erc725AccountAbi,
|
|
113
|
+
lsp6KeyManagerAbi,
|
|
114
|
+
lsp7DigitalAssetAbi,
|
|
115
|
+
lsp8IdentifiableDigitalAssetAbi,
|
|
116
|
+
} from "@lukso/lsp-smart-contracts/abi";
|
|
117
|
+
```
|