chg: erc1155 param changes
MODIFY
src/index.ts
src/index.ts
@@ -106,11 +106,11 @@ export class MaticPOSClient extends SDKClient {
return this.posRootChainManager.exitERC721(txHash, options)
}
- approveERC1155ForDeposit(rootToken: address, tokenId: BN | string, options?: SendOptions) {
- if (options && (!options.from || !tokenId || !rootToken)) {
- throw new Error('options.from, rootToken or tokenId is missing')
+ approveERC1155ForDeposit(rootToken: address, options?: SendOptions) {
+ if (options && (!options.from || !rootToken)) {
+ throw new Error('options.from or rootToken is missing')
}
- return this.posRootChainManager.approveERC1155(rootToken, tokenId, options)
+ return this.posRootChainManager.approveERC1155(rootToken, options)
}
depositSingleERC1155ForUser(
@@ -118,12 +118,13 @@ export class MaticPOSClient extends SDKClient {
user: address,
tokenId: BN | string,
amount: BN | string,
+ data?: string,
options?: SendOptions
) {
if (options && (!options.from || !tokenId || !amount || !rootToken || !user)) {
throw new Error('options.from, rootToken, user, tokenId or amount is missing')
}
- return this.posRootChainManager.depositSingleERC1155ForUser(rootToken, tokenId, amount, user, options)
+ return this.posRootChainManager.depositSingleERC1155ForUser(rootToken, tokenId, amount, user, data, options)
}
depositBatchERC1155ForUser(
@@ -131,12 +132,13 @@ export class MaticPOSClient extends SDKClient {
user: address,
tokenIds: (BN | string)[],
amounts: (BN | string)[],
+ data?: string,
options?: SendOptions
) {
if (options && (!options.from || !tokenIds || !rootToken || !user)) {
throw new Error('options.from, rootToken, user, tokenIds or amounts is missing')
}
- return this.posRootChainManager.depositBatchERC1155ForUser(rootToken, tokenIds, amounts, user, options)
+ return this.posRootChainManager.depositBatchERC1155ForUser(rootToken, tokenIds, amounts, user, data, options)
}
burnSingleERC1155(childToken: address, tokenId: BN | string, amount: BN | string, options?: SendOptions) {

MODIFY
src/root/POSRootChainManager.ts
src/root/POSRootChainManager.ts
@@ -145,7 +145,7 @@ export default class POSRootChainManager extends ContractsBase {
return this.exit(burnTxHash, ERC721_TRANSFER_EVENT_SIG, options)
}
- async approveERC1155(rootToken: address, tokenId: BN | string, options?: SendOptions) {
+ async approveERC1155(rootToken: address, options?: SendOptions) {
if (!this.erc1155Predicate) {
throw new Error('posERC1155Predicate address not found. Set it while constructing MaticPOSClient.')
}
@@ -165,11 +165,12 @@ export default class POSRootChainManager extends ContractsBase {
tokenId: BN | string,
amount: BN | string,
user: address,
+ data?: string,
options?: SendOptions
) {
const depositData = abiCoder.encodeParameters(
- ['uint256[]', 'uint256[]'],
- [[this.formatUint256(tokenId)], [this.formatUint256(amount)]]
+ ['uint256[]', 'uint256[]', 'bytes'],
+ [[this.formatUint256(tokenId)], [this.formatUint256(amount)], data || '0x0']
)
return this.depositFor(user, rootToken, depositData, options)
}
@@ -179,11 +180,12 @@ export default class POSRootChainManager extends ContractsBase {
tokenIds: (BN | string)[],
amounts: (BN | string)[],
user: address,
+ data?: string,
options?: SendOptions
) {
const depositData = abiCoder.encodeParameters(
- ['uint256[]', 'uint256[]'],
- [tokenIds.map(t => this.formatUint256(t)), amounts.map(a => this.formatUint256(a))]
+ ['uint256[]', 'uint256[]', 'bytes'],
+ [tokenIds.map(t => this.formatUint256(t)), amounts.map(a => this.formatUint256(a)), data || '0x0']
)
return this.depositFor(user, rootToken, depositData, options)
}

chg: erc1155 param changes