> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oumla.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tokenization

> SDK methods for creating collections, minting tokens, and managing NFTs

Create NFT collections (ERC-721, ERC-1155), mint tokens, manage token operations, and link existing contracts.

## Collection Methods

### `createCollection()`

Create a new NFT collection (ERC-721 or ERC-1155). Returns a workflow ID for async processing.

**Signature:**

```typescript theme={null}
createCollection(
  request: CreateCollectionRequest,
  requestOptions?: RequestOptions
): Promise<CreateCollectionResponse>
```

**Parameters:**

| Parameter                               | Type                                            | Required | Description                                                                     |
| --------------------------------------- | ----------------------------------------------- | -------- | ------------------------------------------------------------------------------- |
| `request.addressId`                     | `string`                                        | Yes      | Address ID for deployment                                                       |
| `request.type`                          | `'NON_FUNGIBLE_TOKEN' \| 'SEMI_FUNGIBLE_TOKEN'` | Yes      | Collection type (ERC-721 or ERC-1155)                                           |
| `request.clientShare`                   | `string`                                        | Yes      | Client share for signing                                                        |
| `request.createParams`                  | `object`                                        | Yes      | Constructor parameters                                                          |
| `request.createParams.initializeParams` | `array`                                         | Yes      | Array of exactly 5 constructor parameter objects `[{ name, type, value }, ...]` |
| `request.network`                       | `string`                                        | No       | Blockchain network                                                              |
| `request.displayName`                   | `string`                                        | No       | Collection display name                                                         |
| `request.useGasless`                    | `boolean`                                       | No       | Whether to use gasless transactions                                             |
| `request.fee`                           | `string`                                        | No       | Custom fee amount                                                               |
| `request.feeLevel`                      | `string`                                        | No       | Transaction fee level                                                           |
| `request.description`                   | `string`                                        | No       | Collection description                                                          |

**Example Request:**

```typescript theme={null}
const collection = await client.tokenization.createCollection({
  addressId: 'your-address-id',
  type: 'NON_FUNGIBLE_TOKEN',
  clientShare: 'your-client-share',
  network: 'ETHEREUM',
  displayName: 'My Collection',
  useGasless: false,
  fee: '0',
  feeLevel: 'standard',
  description: 'Optional collection description',
  createParams: {
    initializeParams: [
      { name: '_name', type: 'string', value: 'My Collection' },
      { name: '_symbol', type: 'string', value: 'MYC' },
      { name: 'defaultAdmin', type: 'address', value: '0x1111111111111111111111111111111111111111' },
      { name: 'minter', type: 'address', value: '0x2222222222222222222222222222222222222222' },
      { name: 'pauser', type: 'address', value: '0x3333333333333333333333333333333333333333' }
    ]
  }
});
```

**Example Response:**

```typescript theme={null}
{
  data: {
    workflowResult: {
      workflowId: 'workflow-id-here',
      operationId: 'deployment-id-here',
      status: 'started',
      message: 'Create collection workflow started'
    }
  }
}
```

**Response Fields:**

| Field                             | Type                             | Required | Description                                  |
| --------------------------------- | -------------------------------- | -------- | -------------------------------------------- |
| `data.workflowResult.workflowId`  | `string`                         | Yes      | Workflow ID for tracking collection creation |
| `data.workflowResult.operationId` | `string`                         | Yes      | Operation ID (e.g. `deploymentId`)           |
| `data.workflowResult.status`      | `'started' \| 'already_running'` | Yes      | Workflow status                              |
| `data.workflowResult.message`     | `string`                         | Yes      | Human-readable status message                |

```typescript theme={null}
console.log('Workflow ID:', collection.data.workflowResult.workflowId);
```

***

### `getCollections()`

Get a paginated list of collections.

**Signature:**

```typescript theme={null}
getCollections(
  request?: GetCollectionsRequest,
  requestOptions?: RequestOptions
): Promise<CollectionsResponse>
```

**Example:**

```typescript theme={null}
const collections = await client.tokenization.getCollections({
  skip: 0,
  take: 25
});

console.log('Collections:', collections.data);
```

***

### `getCollectionById()`

Get details for a specific collection.

**Signature:**

```typescript theme={null}
getCollectionById(
  id: string,
  requestOptions?: RequestOptions
): Promise<CollectionResponse>
```

**Example:**

```typescript theme={null}
const collection = await client.tokenization.getCollectionById('collection-id');

console.log('Contract Address:', collection.data.contractAddress);
console.log('Network:', collection.data.network);
```

***

### `deleteCollection()`

Delete a collection.

**Signature:**

```typescript theme={null}
deleteCollection(
  id: string,
  requestOptions?: RequestOptions
): Promise<void>
```

**Example:**

```typescript theme={null}
await client.tokenization.deleteCollection('collection-id');
```

***

## Token Methods

### `mintToken()`

Mint a token in a collection. Returns a workflow ID for async processing.

**Signature:**

```typescript theme={null}
mintToken(
  id: string,
  request: MintTokenRequest,
  requestOptions?: RequestOptions
): Promise<MintTokenResponse>
```

**Parameters:**

| Parameter             | Type      | Required | Description                         |
| --------------------- | --------- | -------- | ----------------------------------- |
| `id`                  | `string`  | Yes      | Collection ID                       |
| `request.addressId`   | `string`  | Yes      | Address ID for signing              |
| `request.clientShare` | `string`  | Yes      | Client share                        |
| `request.to`          | `string`  | Yes      | Recipient address                   |
| `request.metadata`    | `object`  | No       | Token metadata (JSON object)        |
| `request.useGasless`  | `boolean` | No       | Whether to use gasless transactions |
| `request.fee`         | `string`  | No       | Custom fee amount                   |
| `request.feeLevel`    | `string`  | No       | Transaction fee level               |

**Example Request:**

```typescript theme={null}
const mintResult = await client.tokenization.mintToken('collection-id', {
  addressId: 'address-id',
  clientShare: 'your-client-share',
  to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
  metadata: {
    name: 'My First NFT',
    image: 'https://example.com/image.png'
  },
  useGasless: false,
  fee: '0',
  feeLevel: 'standard'
});
```

**Example Response:**

```typescript theme={null}
{
  data: {
    workflowResult: {
      workflowId: 'workflow-id-here',
      operationId: 'mint-id-here',
      status: 'started',
      message: 'Mint token workflow started'
    }
  }
}
```

**Response Fields:**

| Field                             | Type                             | Required | Description                            |
| --------------------------------- | -------------------------------- | -------- | -------------------------------------- |
| `data.workflowResult.workflowId`  | `string`                         | Yes      | Workflow ID for tracking token minting |
| `data.workflowResult.operationId` | `string`                         | Yes      | Operation ID (e.g. `mintId`)           |
| `data.workflowResult.status`      | `'started' \| 'already_running'` | Yes      | Workflow status                        |
| `data.workflowResult.message`     | `string`                         | Yes      | Human-readable status message          |

```typescript theme={null}
console.log('Mint Workflow ID:', mintResult.data.workflowResult.workflowId);
```

***

### `burnToken()`

Burn a token from a collection. Returns a workflow ID for async processing.

**Signature:**

```typescript theme={null}
burnToken(
  id: string,
  request: BurnTokenRequest,
  requestOptions?: RequestOptions
): Promise<BurnTokenResponse>
```

**Parameters:**

| Parameter             | Type      | Required | Description                         |
| --------------------- | --------- | -------- | ----------------------------------- |
| `id`                  | `string`  | Yes      | Collection ID                       |
| `request.addressId`   | `string`  | Yes      | Address ID for signing              |
| `request.clientShare` | `string`  | Yes      | Client share                        |
| `request.tokenId`     | `string`  | Yes      | Token ID to burn                    |
| `request.useGasless`  | `boolean` | No       | Whether to use gasless transactions |
| `request.fee`         | `string`  | No       | Custom fee amount                   |
| `request.feeLevel`    | `string`  | No       | Transaction fee level               |

**Example Request:**

```typescript theme={null}
const burnResult = await client.tokenization.burnToken('collection-id', {
  addressId: 'address-id',
  clientShare: 'your-client-share',
  tokenId: '0',
  useGasless: false,
  fee: '0',
  feeLevel: 'standard'
});
```

**Example Response:**

```typescript theme={null}
{
  data: {
    workflowResult: {
      workflowId: 'workflow-id-here',
      operationId: 'burn-id-here',
      status: 'started',
      message: 'Burn token workflow started'
    }
  }
}
```

**Response Fields:**

| Field                             | Type                             | Required | Description                            |
| --------------------------------- | -------------------------------- | -------- | -------------------------------------- |
| `data.workflowResult.workflowId`  | `string`                         | Yes      | Workflow ID for tracking token burning |
| `data.workflowResult.operationId` | `string`                         | Yes      | Operation ID (e.g. `burnId`)           |
| `data.workflowResult.status`      | `'started' \| 'already_running'` | Yes      | Workflow status                        |
| `data.workflowResult.message`     | `string`                         | Yes      | Human-readable status message          |

```typescript theme={null}
console.log('Burn Workflow ID:', burnResult.data.workflowResult.workflowId);
```

***

### `getCollectionTokens()`

Get all tokens in a collection.

**Signature:**

```typescript theme={null}
getCollectionTokens(
  request: GetCollectionTokensRequest,
  requestOptions?: RequestOptions
): Promise<CollectionTokensResponse>
```

**Example:**

```typescript theme={null}
const tokens = await client.tokenization.getCollectionTokens({
  id: 'collection-id',
  skip: 0,
  take: 50
});

console.log('Tokens:', tokens.data);
```

***

### `getCollectionTokenDetails()`

Get details for a specific token.

**Signature:**

```typescript theme={null}
getCollectionTokenDetails(
  id: string,
  tokenId: string,
  requestOptions?: RequestOptions
): Promise<TokenDetailsResponse>
```

**Example:**

```typescript theme={null}
const token = await client.tokenization.getCollectionTokenDetails(
  'collection-id',
  '0'
);

console.log('Token:', token.data);
```

***

## Token Management Methods

### `issueNewToken()`

Start the issue-token workflow from a deployed contract template. Returns a workflow ID for async processing — the token is not ready until the workflow completes.

**Signature:**

```typescript theme={null}
issueNewToken(
  request: IssueNewTokenRequest,
  requestOptions?: RequestOptions
): Promise<IssueNewTokenResponse>
```

**Parameters:**

| Parameter              | Type                          | Required | Description                            |
| ---------------------- | ----------------------------- | -------- | -------------------------------------- |
| `request.networkId`    | `string`                      | Yes      | Network ID (from `getNetworks()`)      |
| `request.addressId`    | `string`                      | Yes      | Address ID for signing                 |
| `request.clientShare`  | `string`                      | Yes      | Client share for signing               |
| `request.createParams` | `object`                      | Yes      | Constructor parameters                 |
| `request.deploymentId` | `string`                      | Yes      | Deployment ID of the contract template |
| `request.displayName`  | `string`                      | Yes      | Token display name                     |
| `request.useGasless`   | `boolean`                     | Yes      | Whether to use gasless transactions    |
| `request.fee`          | `string`                      | Yes      | Custom fee amount                      |
| `request.feeLevel`     | `'LOW' \| 'MEDIUM' \| 'HIGH'` | No       | Transaction fee level                  |

**Example Request:**

```typescript theme={null}
const token = await client.tokenization.issueNewToken({
  networkId: 'your-network-id',
  addressId: 'address-id',
  clientShare: 'your-client-share',
  deploymentId: 'deployment-id',
  displayName: 'My Token',
  useGasless: false,
  fee: '0',
  feeLevel: 'MEDIUM',
  createParams: {
    initializeParams: [
      { name: '_name', type: 'string', value: 'My Token' },
      { name: '_symbol', type: 'string', value: 'MTK' }
    ]
  }
});
```

**Example Response:**

```typescript theme={null}
{
  data: {
    workflowResult: {
      workflowId: 'workflow-id-here',
      operationId: 'token-id-here',
      status: 'started',
      message: 'Issue token workflow started'
    }
  }
}
```

**Response Fields:**

| Field                             | Type                             | Required | Description                                      |
| --------------------------------- | -------------------------------- | -------- | ------------------------------------------------ |
| `data.workflowResult.workflowId`  | `string`                         | Yes      | Workflow ID for tracking token issuance          |
| `data.workflowResult.operationId` | `string`                         | Yes      | Operation ID (token ID assigned to the issuance) |
| `data.workflowResult.status`      | `'started' \| 'already_running'` | Yes      | Workflow status                                  |
| `data.workflowResult.message`     | `string`                         | Yes      | Human-readable status message                    |

<Note>
  The HTTP endpoint responds with `202 Accepted`. If the underlying contract is still deploying, expect error code `ERR-146` ("Contract deployment is still in progress.") — wait for the contract deployment workflow to complete before retrying.
</Note>

***

### `getTokens()`

List issued tokens for the organization with pagination.

**Signature:**

```typescript theme={null}
getTokens(
  request?: GetTokensRequest,
  requestOptions?: RequestOptions
): Promise<TokensResponse>
```

**Example:**

```typescript theme={null}
const tokens = await client.tokenization.getTokens({
  skip: 0,
  take: 50
});

console.log('Tokens:', tokens.data);
```

***

### `getLinkedToken()`

Get a linked token by its ID.

**Signature:**

```typescript theme={null}
getLinkedToken(
  id: string,
  requestOptions?: RequestOptions
): Promise<LinkedTokenResponse>
```

**Example:**

```typescript theme={null}
const token = await client.tokenization.getLinkedToken('token-id');

console.log('Token:', token.data);
```

***

### `linkContract()`

Link an existing deployed contract to the organization for tokenization.

**Signature:**

```typescript theme={null}
linkContract(
  request: LinkContractRequest,
  requestOptions?: RequestOptions
): Promise<LinkContractResponse>
```

**Parameters:**

| Parameter                 | Type     | Required | Description                       |
| ------------------------- | -------- | -------- | --------------------------------- |
| `request.networkId`       | `string` | Yes      | Network ID (from `getNetworks()`) |
| `request.contractAddress` | `string` | Yes      | Contract address to link          |
| `request.type`            | `string` | No       | Token type                        |
| `request.refId`           | `string` | No       | External reference ID             |
| `request.displayName`     | `string` | No       | Display name                      |

**Example:**

```typescript theme={null}
const linked = await client.tokenization.linkContract({
  networkId: 'your-network-id',
  contractAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
  displayName: 'My Linked Token'
});

console.log('Linked:', linked.data);
```

***

### `unlinkToken()`

Unlink a token from the organization.

**Signature:**

```typescript theme={null}
unlinkToken(
  id: string,
  requestOptions?: RequestOptions
): Promise<void>
```

**Example:**

```typescript theme={null}
await client.tokenization.unlinkToken('token-id');
```

***

## Complete Example

```typescript theme={null}
import { OumlaSdkApiClient, OumlaSdkApiEnvironment } from '@oumla/sdk';

const client = new OumlaSdkApiClient({
  environment: OumlaSdkApiEnvironment.Sandbox,
  apiKey: 'your-api-key'
});

async function tokenizationWorkflow() {
  // Create collection
  const collection = await client.tokenization.createCollection({
    addressId: 'address-id',
    type: 'NON_FUNGIBLE_TOKEN',
    clientShare: process.env.CLIENT_SHARE!,
    network: 'ETHEREUM',
    displayName: 'My NFT Collection',
    createParams: {
      initializeParams: [
        { name: '_name', type: 'string', value: 'My NFT Collection' },
        { name: '_symbol', type: 'string', value: 'MNFT' },
        { name: 'defaultAdmin', type: 'address', value: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb' },
        { name: 'minter', type: 'address', value: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb' },
        { name: 'pauser', type: 'address', value: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb' }
      ]
    }
  });

  // Check workflow status
  let status;
  do {
    status = await client.workflows.getWorkflowStatus(collection.data.workflowResult.workflowId);
    await new Promise(resolve => setTimeout(resolve, 2000));
  } while (status.data.status === 'RUNNING');

  if (status.data.status === 'COMPLETED') {
    // The operationId returned from createCollection is the collection ID
    const collectionId = collection.data.workflowResult.operationId;

    // Mint token
    const mintResult = await client.tokenization.mintToken(collectionId, {
      addressId: 'address-id',
      clientShare: process.env.CLIENT_SHARE!,
      to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
      metadata: {
        name: 'My First NFT',
        image: 'https://example.com/image.png'
      }
    });

    console.log('Mint workflow started:', mintResult.data.workflowResult.workflowId);
  }

  // Link an existing contract
  const linked = await client.tokenization.linkContract({
    networkId: 'your-network-id',
    contractAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
    displayName: 'My Existing Token'
  });

  // List all tokens
  const tokens = await client.tokenization.getTokens({ skip: 0, take: 50 });
  console.log('Organization tokens:', tokens.data);
}
```
