You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
refactor: object APIs write methods now return CIDs
For the back story on this change, please see: ipfs-inactive/interface-js-ipfs-core#388 (review)
BREAKING CHANGE: Object API refactor.
Object API methods that write DAG nodes now return a [CID](https://www.npmjs.com/package/cids) instead of a DAG node. Affected methods:
* `ipfs.object.new`
* `ipfs.object.patch.addLink`
* `ipfs.object.patch.appendData`
* `ipfs.object.patch.rmLink`
* `ipfs.object.patch.setData`
* `ipfs.object.put`
Example:
```js
// Before
const dagNode = await ipfs.object.new()
```
```js
// After
const cid = await ipfs.object.new() // now returns a CID
const dagNode = await ipfs.object.get(cid) // fetch the DAG node that was created
```
IMPORTANT: `DAGNode` instances, which are part of the IPLD dag-pb format have been refactored.
These instances no longer have `multihash`, `cid` or `serialized` properties.
This effects the following API methods that return these types of objects:
* `ipfs.object.get`
* `ipfs.dag.get`
See ipld/js-ipld-dag-pb#99 for more information.
License: MIT
Signed-off-by: Alan Shaw <[email protected]>
0 commit comments