new: safeDepositERC721() implementation
MODIFY
src/plasma/erc721.ts
src/plasma/erc721.ts
@@ -25,9 +25,9 @@ export class ERC721 extends BaseToken {
* how many ERC721s are owned by this user
*
* @param userAddress
- * @param option
+ * @param options
*/
- getBalance(userAddress: string, option: ITransactionOption = {}) {
+ getBalance(userAddress: string, options: ITransactionOption = {}) {
const contract = this.contract;
const method = contract.method(
"balanceOf",
@@ -49,9 +49,9 @@ export class ERC721 extends BaseToken {
*
* @param userAddress
* @param index starting from zero, if no token found on that it will return error
- * @param option
+ * @param options
*/
- tokenOfOwnerByIndexERC721(userAddress: string, index: number, option: ITransactionOption = {}) {
+ tokenOfOwnerByIndexERC721(userAddress: string, index: number, options: ITransactionOption = {}) {
const contract = this.contract;
const method = contract.method(
"tokenOfOwnerByIndex",
@@ -67,4 +67,20 @@ export class ERC721 extends BaseToken {
return method.read<string>(config);
});
}
+
+ safeDepositERC721(tokenId: number, options: ITransactionOption = {}) {
+ if (!options.from) {
+ throw new Error('missing param - options.from');
+ }
+
+ const contract = this.contract;
+ const method = contract.method(
+ "safeTransferFrom",
+ options.from,
+ this.depositManager.contract.address,
+ tokenId,
+ );
+
+ return this.processWrite(method, options);
+ }
}

new: safeDepositERC721() implementation