# Bulk

## `bulk()`

Bundling bulk transactions into a single Startrail-API call.

* `createSRR()`
* `approveSRRByCommitment()`
* `transferFromWithProvenance()`

## Method parameters

| Variable                      | Type        | Description                                                                                 |
| ----------------------------- | ----------- | ------------------------------------------------------------------------------------------- |
| `startrailLUWContractAddress` | `string`    | The address of LicensedUserWallet(LUW) contract.                                            |
| `isCompressEnabled`           | `boolean`   | Sets true if you want to compress a chunk of data with Gzip for HTTP call to Startrail-API. |
| `txs`                         | `TxDetails` | See TxDetails below.                                                                        |

### TxDetails

| Variable       | Type                                                                      | Description                                                                                                                                                                                                                                                                                                                                     |
| -------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `functionType` | `'approveSRRByCommitment' \| 'createSRR' \| 'transferFromWithProvenance'` | Functoin type you want to execute                                                                                                                                                                                                                                                                                                               |
| `data`         | `approveSRRByCommitment \| createSRR \| transferFromWithProvenance`       | <p>Refer to the Method parameters respectively from<br><a href="/pages/4oopoohxg7HfT0tBze0z">createSRR</a><br><a href="/pages/XTXsUCYaHHmVYqkt0L4Y">approveSRRByCommitment</a><br><a href="/pages/FjqsD9gKgHGMcPXjOcZ1">transferFromWithProvenance</a><br>Please don't forget to extract 'startrailLUWContractAddress' from the parameters.</p> |

### Parameters Example

```
sdk.bulk(
  {
    isCompressEnabled: true,
    startrailLUWContractAddress: '0x1099a229951CeCcbE94aFA7017728503663E1983',
    txs: [
      {
        functionType: 'createSRR',
        data: {
          contractAddress: "0xA6E6a9E20a541680a1D6E1412f5088AefBF58a22",
          isPrimaryIssuer: false,
          artistAddress: "0xA6E6a9E20a541680a1D6E1412f5088AefBF58a22",
          lockExternalTransfer: false,
          metadata: {
            $schema: "ipfs://bafkreif77ionobe56gawqnplet46x3sjfinx3krm4reldzn7v6c2nfrmy4",
            startbahnCertICTagUIDs: [
              "1234567890abcdef"
            ],
            chipUIDs: [
              "1234567890abcdef"
            ],
            title: {
              en: "A title",
              ja: "タイトル",
              zh: "一个标题"
            },
            size: {
              width: 200.0,
              height: 400.0,
              depth: 12.4,
              unit: "pixel",
              flexibleDescription: {
                en: "flexibleDescription comes here",
                ja: "説明を入力"
              }
            },
            attributes: [
              {
                trait_type: "Mouth",
                value: "Surprised"
              }
            ],
            medium: {
              en: "Oil on canvas",
              ja: "キャンバスに油彩",
              zh: "布面油画"
            },
            edition: {
              uniqueness: "unique work",
              proofType: "ED",
              number: 1,
              totalNumber: 3,
              note: {
                en: "some extra notes in 1 or more languages"
              }
            },
            contractTerms: {
              royaltyRate: 15.7,
              fileURL: "ipfs://bafkreihmlsij6s5ri6e347h7yqjlsl4qa3iykub6qmumctb2mshc4u7vlm"
            },
            note: {
              en: "note",
              zh: "注意"
            },
            thumbnailURL: "ipfs://bafkreiedkaf4w5ogbbnfgp4jyrlvdqmwh3edryszcciee3puyn7nltcomi",
            yearOfCreation: {
              en: "around 2010-2020",
              ja: "2010年から2020年頃"
            },
            isDigital: true,
            digitalDataHash: "sha256-247e4b904322a1dd0b148cd77e8627ec7d391251380880ab4621726ecb945ef5",
            digitalComponents: [{
              hash: "sha256-247e4b904322a1dd0b148cd77e8627ec7d391251380880ab4621726ecb945ef5",
              category: "artwork"
            }],
            attachmentFiles: [{
              hash: "sha256-247e4b904322a1dd0b148cd77e8627ec7d391251380880ab4621726ecb945ef5",
              category: "artwork"
            }],
            name: "some nft name",
            description: "some nft description",
            image: "ipfs://bafkreiedkaf4w5ogbbnfgp4jyrlvdqmwh3edryszcciee3puyn7nltcomi",
            external_url: "https://openseacreatures.io/3"
          }
        }
      },
      {
        functionType: 'approveSRRByCommitment',
        data: {
          contractAddress: "0xA6E6a9E20a541680a1D6E1412f5088AefBF58a22",
          tokenId: '639283836913',
          preimage: 'test86@gmail.com',
          metadata: {
              $schema: 'ipfs://bafkreiagmzvya63vrv4byglrtkabk5xrr2x7g7zsa3fzxbz43c7tyw6kgm',
              transferType: 'Primary sale',
              remarks: {
                  en: 'Reason for the transfer, English',
                  ja: '移転の理由：日本語'
              }
          },
          isHashPreimageEnabled: false
        }
      },
      {
        functionType: 'transferFromWithProvenance',
        data: {
          contractAddress: "0xA6E6a9E20a541680a1D6E1412f5088AefBF58a22",
          to: '0xF6B90C96D53058123C32C53A03b4420594714342',
          tokenId: '832736095995',
          metadata: {
            transferType: "Primary sale",
            remarks: {
              en: "Reason for the transfer",
              ja: "移転の理由：日本語"
            },
            customHistoryId: 1,
          },
          isIntermediary: false,
        }
      }
    ]
  }
)

```

## Returns

`Promise` will be returned which resolves with a `Response` object upon a successful confirmation. `false` will be returned when user flow is cancelled in such a case that a user closes the popup modal.

If the confirmation fails, the `Promise` will resolve with an {error} object that describes the failure.

`Promise<Response | false>`

### Response

| Variable  | Type        | Description                                             |
| --------- | ----------- | ------------------------------------------------------- |
| `batchId` | `string`    | ID to identify transaction details in Startrail-API DB. |
| `txs`     | `TxDetails` | Transaction details                                     |

### TxDetails

| Variable      | Type     | Description              |
| ------------- | -------- | ------------------------ |
| `metadataCID` | `string` | A calculated metadataCID |
| `tokenId`     | `string` | A calculated tokenId     |

### Error

Custom `Error` objects. Refer to the [Error Catalogue](/startrail-sdk-js/errors.md) for possible data.

### Response Example

```
{
  batchId: 1,
  tx: {
      tokenId: "209850285627",
      metadataCID: "bafkreibjdtcklpe5wjgh6qp2dqygaydm3d4xttfhaphgian73bpprkr7xu"
  }
}
```


---

# Agent Instructions: 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:

```
GET https://docs.startrail.io/startrail-sdk-js/startrail-api-methods/bulk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
