@icp-sdk/core 1.0.0-beta.4 → 4.0.0
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 +26 -25
- package/lib/cjs/identity/secp256k1/index.d.ts.map +1 -0
- package/lib/cjs/identity/secp256k1/index.js.map +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/identity/secp256k1/index.d.ts.map +1 -0
- package/lib/esm/identity/secp256k1/index.js.map +1 -0
- package/lib/esm/index.js.map +1 -1
- package/package.json +13 -13
- package/src/index.ts +3 -1
- package/lib/cjs/identity-secp256k1/index.d.ts.map +0 -1
- package/lib/cjs/identity-secp256k1/index.js.map +0 -1
- package/lib/esm/identity-secp256k1/index.d.ts.map +0 -1
- package/lib/esm/identity-secp256k1/index.js.map +0 -1
- /package/lib/cjs/{identity-secp256k1 → identity/secp256k1}/index.d.ts +0 -0
- /package/lib/cjs/{identity-secp256k1 → identity/secp256k1}/index.js +0 -0
- /package/lib/esm/{identity-secp256k1 → identity/secp256k1}/index.d.ts +0 -0
- /package/lib/esm/{identity-secp256k1 → identity/secp256k1}/index.js +0 -0
- /package/src/{identity-secp256k1 → identity/secp256k1}/index.ts +0 -0
package/README.md
CHANGED
|
@@ -4,9 +4,7 @@ The `@icp-sdk/core` package is a JavaScript and TypeScript library designed to i
|
|
|
4
4
|
|
|
5
5
|
Do you want to know more about developing on the Internet Computer? Visit the [Developer Docs](https://internetcomputer.org/docs/home).
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
**Note:** This package requires the `node16` (or later) module resolution strategy to function correctly.
|
|
7
|
+
> Still using `@dfinity/agent`? Migrate to [`@icp-sdk/core`](https://js.icp.build/core/latest/upgrading/v4)!
|
|
10
8
|
|
|
11
9
|
---
|
|
12
10
|
|
|
@@ -32,16 +30,6 @@ yarn add @icp-sdk/core
|
|
|
32
30
|
pnpm add @icp-sdk/core
|
|
33
31
|
```
|
|
34
32
|
|
|
35
|
-
## Package Structure
|
|
36
|
-
|
|
37
|
-
The `@icp-sdk/core` package re-exports modules from the following `@dfinity` packages:
|
|
38
|
-
|
|
39
|
-
- [`@dfinity/agent`](../agent/README.md): Provides tools to interact with the Internet Computer, including creating actors and making calls.
|
|
40
|
-
- [`@dfinity/candid`](../candid/README.md): Tools for working with Candid, the Internet Computer's interface definition language.
|
|
41
|
-
- [`@dfinity/identity`](../identity/README.md): Identity management for signing and authentication.
|
|
42
|
-
- [`@dfinity/identity-secp256k1`](../identity-secp256k1/README.md): Identity management using secp256k1 cryptography.
|
|
43
|
-
- [`@dfinity/principal`](../principal/README.md): Utilities for working with principals on the Internet Computer.
|
|
44
|
-
|
|
45
33
|
## Import Paths
|
|
46
34
|
|
|
47
35
|
The package provides the following import paths for accessing the re-exported modules:
|
|
@@ -49,7 +37,7 @@ The package provides the following import paths for accessing the re-exported mo
|
|
|
49
37
|
- `@icp-sdk/core/agent`
|
|
50
38
|
- `@icp-sdk/core/candid`
|
|
51
39
|
- `@icp-sdk/core/identity`
|
|
52
|
-
- `@icp-sdk/core/identity
|
|
40
|
+
- `@icp-sdk/core/identity/secp256k1`
|
|
53
41
|
- `@icp-sdk/core/principal`
|
|
54
42
|
|
|
55
43
|
## Usage Example
|
|
@@ -60,26 +48,39 @@ Here is an example of how to use the `@icp-sdk/core` package:
|
|
|
60
48
|
// Importing the HttpAgent from the agent module
|
|
61
49
|
import { HttpAgent } from '@icp-sdk/core/agent';
|
|
62
50
|
|
|
51
|
+
// Importing the Identity utility
|
|
52
|
+
import { Ed25519KeyIdentity } from '@icp-sdk/core/identity';
|
|
53
|
+
|
|
54
|
+
// Importing the Candid utility
|
|
55
|
+
import { IDL } from '@icp-sdk/core/candid';
|
|
56
|
+
|
|
63
57
|
// Importing the Principal utility
|
|
64
58
|
import { Principal } from '@icp-sdk/core/principal';
|
|
65
59
|
|
|
66
|
-
// Create
|
|
67
|
-
const
|
|
60
|
+
// Create a new identity
|
|
61
|
+
const identity = Ed25519KeyIdentity.generate();
|
|
68
62
|
|
|
69
63
|
// Create a Principal from a string
|
|
70
|
-
const
|
|
64
|
+
const canisterId = Principal.fromText('uqqxf-5h777-77774-qaaaa-cai');
|
|
71
65
|
|
|
72
|
-
//
|
|
73
|
-
|
|
66
|
+
// Create an HttpAgent instance
|
|
67
|
+
const agent = await HttpAgent.create({
|
|
68
|
+
host: 'https://icp-api.io',
|
|
69
|
+
identity,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// Call a canister
|
|
73
|
+
const response = await agent.call(canisterId, {
|
|
74
|
+
methodName: 'greet',
|
|
75
|
+
arg: IDL.encode([IDL.Text], ['world']),
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
console.log(response);
|
|
74
79
|
```
|
|
75
80
|
|
|
76
|
-
|
|
81
|
+
**Note:** If you are using TypeScript, this package requires the `node16` (or later) [`moduleResolution`](https://www.typescriptlang.org/tsconfig#moduleResolution) strategy to function correctly.
|
|
77
82
|
|
|
78
|
-
|
|
79
|
-
- [@dfinity/candid Documentation](../candid/README.md)
|
|
80
|
-
- [@dfinity/identity Documentation](../identity/README.md)
|
|
81
|
-
- [@dfinity/identity-secp256k1 Documentation](../identity-secp256k1/README.md)
|
|
82
|
-
- [@dfinity/principal Documentation](../principal/README.md)
|
|
83
|
+
Additional API Documentation can be found [here](https://js.icp.build/core/latest/).
|
|
83
84
|
|
|
84
85
|
## Contributing
|
|
85
86
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/identity/secp256k1/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/identity/secp256k1/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C"}
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,MAAM,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,MAAM,IAAI,KAAK,CACb,yJAAyJ,CAC1J,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/identity/secp256k1/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/identity/secp256k1/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,KAAK,CACb,yJAAyJ,CAC1J,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icp-sdk/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"author": "DFINITY Stiftung <sdk@dfinity.org>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "JavaScript and TypeScript library to interact with the Internet Computer",
|
|
7
|
-
"homepage": "https://js.icp.build/core/
|
|
7
|
+
"homepage": "https://js.icp.build/core/",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/dfinity/agent-js.git",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"sdk"
|
|
34
34
|
],
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@dfinity/agent": "^3.2.
|
|
37
|
-
"@dfinity/
|
|
38
|
-
"@dfinity/
|
|
39
|
-
"@dfinity/identity-secp256k1": "^3.2.
|
|
40
|
-
"@dfinity/principal": "^3.2.
|
|
36
|
+
"@dfinity/agent": "^3.2.2",
|
|
37
|
+
"@dfinity/candid": "^3.2.2",
|
|
38
|
+
"@dfinity/identity": "^3.2.2",
|
|
39
|
+
"@dfinity/identity-secp256k1": "^3.2.2",
|
|
40
|
+
"@dfinity/principal": "^3.2.2"
|
|
41
41
|
},
|
|
42
42
|
"exports": {
|
|
43
43
|
".": {
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"require": "./lib/cjs/identity/index.js",
|
|
69
69
|
"default": "./lib/esm/identity/index.js"
|
|
70
70
|
},
|
|
71
|
-
"./identity
|
|
72
|
-
"types": "./lib/esm/identity
|
|
73
|
-
"import": "./lib/esm/identity
|
|
74
|
-
"node": "./lib/cjs/identity
|
|
75
|
-
"require": "./lib/cjs/identity
|
|
76
|
-
"default": "./lib/esm/identity
|
|
71
|
+
"./identity/secp256k1": {
|
|
72
|
+
"types": "./lib/esm/identity/secp256k1/index.d.ts",
|
|
73
|
+
"import": "./lib/esm/identity/secp256k1/index.js",
|
|
74
|
+
"node": "./lib/cjs/identity/secp256k1/index.js",
|
|
75
|
+
"require": "./lib/cjs/identity/secp256k1/index.js",
|
|
76
|
+
"default": "./lib/esm/identity/secp256k1/index.js"
|
|
77
77
|
},
|
|
78
78
|
"./principal": {
|
|
79
79
|
"types": "./lib/esm/principal/index.d.ts",
|
package/src/index.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
throw new Error(
|
|
1
|
+
throw new Error(
|
|
2
|
+
'There are no exports in the root module of this package. Import from submodules instead. Use intellisense or the docs to find the available submodules.',
|
|
3
|
+
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identity-secp256k1/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/identity-secp256k1/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identity-secp256k1/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/identity-secp256k1/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|