> For the complete documentation index, see [llms.txt](https://docs.v2.like.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.v2.like.co/developer/iscn/javascript/iscn-js.md).

# iscn-js

{% hint style="warning" %}
The documentation is designed for Liker Land and LikeCoin v2. For information on [3ook.com](https://3ook.com/) and LikeCoin v3, please visit [docs.3ook.com](https://docs.3ook.com) and [dao.like.co](https://dao.like.co/).
{% endhint %}

## Repository Link

Github: <https://github.com/likecoin/iscn-js>

npm: <https://www.npmjs.com/package/@likecoin/iscn-js>

## Install

```bash
npm i -S @cosmjs/stargate @likecoin/iscn-js
```

## Usage

Please refer to `*.spec.ts` test cases for more example

Query

```typescript
import { ISCNQueryClient } from '@likecoin/iscn-js';
const client = new ISCNQueryClient();

// optional custom rpc
// await client.connect('https://mainnet-node.like.co/rpc/')

// Query ISCN by ID
const res = await client.queryRecordsById('iscn://likecoin-chain/dLbKMa8EVO9RF4UmoWKk2ocUq7IsxMcnQL1_Ps5Vg80/1');

// Query ISCN by owner
const res = await client.queryRecordsByOwner('cosmos1sf2sc6t37xhd3m0dcaq6h5dz22mtru2ugdwp0v');
```

Signing

```typescript
import { ISCNQueryClient, ISCNSigningClient } from '@likecoin/iscn-js';
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing';
import { assertIsBroadcastTxSuccess, SigningStargateClient, StargateClient } from '@cosmjs/stargate';

const mnemonic = 'surround miss nominee dream gap cross assault thank captain prosper drop duty group candy wealth weather scale put';
const signer = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic);
const [wallet] = await signer.getAccounts();

const client = new ISCNQueryClient();
const signingClient = new ISCNSigningClient();
await signingClient.connectWithSigner('https://mainnet-node.like.co/rpc/', wallet);

const res = await signingClient.createISCNRecord(wallet.address, {
  'contentFingerprints': [
    'hash://sha256/9564b85669d5e96ac969dd0161b8475bbced9e5999c6ec598da718a3045d6f2e'
  ],
  'stakeholders': [
    {
      'entity': {
        '@id': 'did:cosmos:5sy29r37gfxvxz21rh4r0ktpuc46pzjrmz29g45',
        'name': 'Chung Wu'
      },
      'rewardProportion': 95,
      'contributionType': 'http://schema.org/author'
    }
  ],
  'type': 'Article',
  'name': '使用矩陣計算遞歸關係式',
  'usageInfo': 'https://creativecommons.org/licenses/by/4.0',
  'keywords': ['matrix', 'recursion'],
});

const iscnID = await client.queryISCNIdsByTx(res.transactionHash);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.v2.like.co/developer/iscn/javascript/iscn-js.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
