iOS集成TPDSK的方式对波场钱包的trx进行转账交易失败的问题

步骤如下:
1.跳转tp钱包授权登录
2.跳转tp钱包签名
3.申请跳转tp,对波场钱包trx进行转账:
日志如下: 执行主币转账: TRX
:link: [DeepLink] 准备TRON转账:

  • 币种: TRX

  • 合约地址: TRX原生币

  • 发送方: TX5yyu7eMwGK21vaAd1GDXdhPC6m22UpwY

  • 接收方: TUdaofknguAvYPCx8gk9rfGNeBvuuYLtF8

  • 金额: 0.1
    :link: [DeepLink] 构建TRON交易数据 (完整raw_data格式)
    :link: [DeepLink] 参数: from=TX5yyu7eMwGK21vaAd1GDXdhPC6m22UpwY, to=TUdaofknguAvYPCx8gk9rfGNeBvuuYLtF8, amount=0.1, symbol=TRX, contract=(null)
    :link: [TRON] 开始获取最新区块信息
    :white_check_mark: [TRON] 成功获取区块信息: {
    blockID = 00000000046548c08a6f28dabc9e300c54432aa9286028bdfb9cc6a8420b73c7;
    “block_header” = {
    “raw_data” = {
    number = 73746624;
    parentHash = 00000000046548bf3847b428b2471e4d7d80c2e2833a967a8c87936d071d3ee2;
    timestamp = 1751898024000;
    txTrieRoot = aa4704176dc7462a3b137de34d7f3cce63fab5373a716f6fafd46cd566139dfa;
    version = 32;
    “witness_address” = 41c5614f3ebf88785fedf9d69bd82aac1353f8b431;
    };
    “witness_signature” = 6d21f9e0846004889188cbc2e675a6fe0e9362f4c0dd2e15e2785dc8db7d4aa40197aed0b9d0b52c1de07d6b8e76b6efa51fc200eac084c46d0af1bf4d7352a501;
    };
    transactions = (
    {
    “raw_data” = {
    contract = (
    {
    parameter = {
    “type_url” = "type.googleapis.com/protocol.TransferCo
    :white_check_mark: [TRON] 提取区块信息成功:

  • 区块号: 73746624

  • blockID: 00000000046548c08a6f28dabc9e300c54432aa9286028bdfb9cc6a8420b73c7

  • ref_block_bytes: 48c0

  • ref_block_hash: 8a6f28dabc9e300c
    :link: [DeepLink] 转换TRON地址: TX5yyu7eMwGK21vaAd1GDXdhPC6m22UpwY
    :link: [DeepLink] 转换TRON地址: TUdaofknguAvYPCx8gk9rfGNeBvuuYLtF8
    :outbox_tray: [DeepLink] TRX原生交易数据: {
    “raw_data” = {
    contract = (
    {
    parameter = {
    “type_url” = “type.googleapis.com/protocol.TransferContract”;
    value = {
    amount = 100000;
    “owner_address” = 41e7a2af4519c784d15b69237a66fcb0a5cb47d21f;
    “to_address” = 41d1eb17b8bbfd0b6c1b15e9dcfeb3a6b9b9c25789;
    };
    };
    type = TransferContract;

       }
    

    );
    data = “”;
    expiration = 1751898088658;
    “fee_limit” = 10000000;
    “permission_id” = 2;
    “ref_block_bytes” = 48c0;
    “ref_block_hash” = 8a6f28dabc9e300c;
    timestamp = 1751898028658;
    };
    }
    :locked_with_key: [DeepLink] 开始TRON交易签名流程
    NSBundle (null) initWithPath failed because the resolved path is empty or nil
    :locked_with_key: [DeepLink] 发送TRON签名请求 (十六进制格式)
    :locked_with_key: [DeepLink] 十六进制消息长度: 874
    :locked_with_key: [DeepLink] 十六进制消息前100字符: 7b227261775f64617461223a7b2264617461223a22222c227065726d697373696f6e5f6964223a322c227265665f626c6f63
    -[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID. inputModality = Keyboard, inputOperation = dismissAutoFillPanel, customInfoType = UIUserInteractionRemoteInputOperations
    Snapshotting a view (0x12b02ad80, UIKeyboardImpl) that is not in a visible window requires afterScreenUpdates:YES.
    :link: [SceneDelegate] 收到URL回调
    :link: [SceneDelegate] 处理URL: com.wellintech.test.wallet.Wallet.u20240726://transfer?param=%7B%22result%22:1,%22message%22:%22success%22,%22data%22:%7B%22wallet%22:%22TRX-1%22,%22action%22:%22sign%22,%22sign%22:%220xa60bef6f4977b8a6f4d1b0b125a3f0f29a10fe213dd8d12c78d0dc6a1889323e2e4f56337ea0881357928a66c57286a5d94ea374b912a0a2a62a33eb70d23d931b%22,%22publickey%22:%22TX5yyu7eMwGK21vaAd1GDXdhPC6m22UpwY%22,%22actionId%22:%22%22,%22result%22:1,%22ref%22:%22TokenPocket%22%7D%7D
    action:sign
    message:(null)
    响应结果:成功
    data:
    {
    action = sign;
    actionId = “”;
    publickey = TX5yyu7eMwGK21vaAd1GDXdhPC6m22UpwY;
    ref = TokenPocket;
    result = 1;
    sign = 0xa60bef6f4977b8a6f4d1b0b125a3f0f29a10fe213dd8d12c78d0dc6a1889323e2e4f56337ea0881357928a66c57286a5d94ea374b912a0a2a62a33eb70d23d931b;
    wallet = “TRX-1”;
    }
    :mobile_phone: [SceneDelegate] TPSDK响应: result=1, message=success
    :magnifying_glass_tilted_left: [SceneDelegate] respObj.data类型: __NSDictionaryI
    :magnifying_glass_tilted_left: [SceneDelegate] respObj.data内容: {
    action = sign;
    actionId = “”;
    publickey = TX5yyu7eMwGK21vaAd1GDXdhPC6m22UpwY;
    ref = TokenPocket;
    result = 1;
    sign = 0xa60bef6f4977b8a6f4d1b0b125a3f0f29a10fe213dd8d12c78d0dc6a1889323e2e4f56337ea0881357928a66c57286a5d94ea374b912a0a2a62a33eb70d23d931b;
    wallet = “TRX-1”;
    }
    :link: [SceneDelegate] URL处理完成
    :link: [DeepLink] 收到TokenPocket响应
    :white_check_mark: [DeepLink] TRON签名成功: 已获取签名
    :memo: [DeepLink] 使用签名发送TRON交易
    :locked_with_key: [DeepLink] 已将签名添加到交易数据: a60bef6f4977b8a6f4d1…
    NSBundle (null) initWithPath failed because the resolved path is empty or nil
    :link: [DeepLink] 发送TRON pushTransaction请求 (标准协议格式)
    :link: [DeepLink] 标准交易格式: raw_data存在=是, 签名数量=1
    :link: [DeepLink] 完整交易数据: {
    “raw_data” = {
    contract = (
    {
    parameter = {
    “type_url” = “type.googleapis.com/protocol.TransferContract”;
    value = {
    amount = 100000;
    “owner_address” = 41e7a2af4519c784d15b69237a66fcb0a5cb47d21f;
    “to_address” = 41d1eb17b8bbfd0b6c1b15e9dcfeb3a6b9b9c25789;
    };
    };
    type = TransferContract;
    }
    );
    data = “”;
    expiration = 1751898088658;
    “fee_limit” = 10000000;
    “permission_id” = 2;
    “ref_block_bytes” = 48c0;
    “ref_block_hash” = 8a6f28dabc9e300c;
    timestamp = 1751898028658;
    };
    signature = (
    a60bef6f4977b8a6f4d1b0b125a3f0f29a10fe213dd8d12c78d0dc6a1889323e2e4f56337ea0881357928a66c57286a5d94ea374b912a0a2a62a33eb70d23d931b
    );
    }
    Snapshotting a view (0x12b2f0e00, UIKeyboardImpl) that has not been rendered at least once requires afterScreenUpdates:YES.
    Snapshot request 0x12b784540 complete with error: <NSError: 0x12b784180; domain: BSActionErrorDomain; code: 6 (“anulled”)>
    :link: [SceneDelegate] 收到URL回调
    :link: [SceneDelegate] 处理URL: com.wellintech.test.wallet.Wallet.u20240726://transfer?param=%7B%22data%22:%7B%22actionId%22:%22wallet-tron-pushtx-1751898032%22,%22onlySign%22:false,%22action%22:%22pushTransaction%22,%22result%22:2,%22wallet%22:%22TRX-1%22,%22ref%22:%22TokenPocket%22,%22publickey%22:%22TX5yyu7eMwGK21vaAd1GDXdhPC6m22UpwY%22%7D,%22result%22:2,%22message%22:%22%E6%97%A0%E6%95%88%E7%9A%84%E4%BA%A4%E6%98%93%22%7D
    action:pushTransaction
    message:(null)
    响应结果:失败
    data:
    {
    action = pushTransaction;
    actionId = “wallet-tron-pushtx-1751898032”;
    onlySign = 0;
    publickey = TX5yyu7eMwGK21vaAd1GDXdhPC6m22UpwY;
    ref = TokenPocket;
    result = 2;
    wallet = “TRX-1”;
    }
    :mobile_phone: [SceneDelegate] TPSDK响应: result=2, message=无效的交易
    :magnifying_glass_tilted_left: [SceneDelegate] respObj.data类型: __NSDictionaryI
    :magnifying_glass_tilted_left: [SceneDelegate] respObj.data内容: {
    action = pushTransaction;
    actionId = “wallet-tron-pushtx-1751898032”;
    onlySign = 0;
    publickey = TX5yyu7eMwGK21vaAd1GDXdhPC6m22UpwY;
    ref = TokenPocket;
    result = 2;
    wallet = “TRX-1”;
    }
    :link: [SceneDelegate] URL处理完成
    :link: [DeepLink] 收到TokenPocket响应
    :cross_mark: [DeepLink] 操作失败 (pushTransaction): 无效的交易

最后提示无效的交易,请指导我哪里需要修改

执行主币转账: TRX
:link: [DeepLink] 准备TRON转账:

  • 币种: TRX
  • 合约地址: TRX原生币
  • 发送方: TX5yyu7eMwGK21vaAd1GDXdhPC6m22UpwY
  • 接收方: TUdaofknguAvYPCx8gk9rfGNeBvuuYLtF8
  • 金额: 0.1
    :link: [DeepLink] 构建TRON交易数据 (异步获取区块信息)
    :link: [DeepLink] 参数: from=TX5yyu7eMwGK21vaAd1GDXdhPC6m22UpwY, to=TUdaofknguAvYPCx8gk9rfGNeBvuuYLtF8, amount=0.1, symbol=TRX, contract=(null)
    :link: [TRON] 开始异步获取最新区块信息
    :white_check_mark: [TRON] 异步获取区块信息成功: {
    blockID = 00000000046551cf33c0be54a66942105768beff6e117718c72a2b074a289687;
    “block_header” = {
    “raw_data” = {
    number = 73748943;
    parentHash = 00000000046551cefbfa65e26a469b810e276f4b1bc4a3a9015ab7402b7c7e42;
    timestamp = 1751904981000;
    txTrieRoot = 849e0cb485af3d7a52133a19a7676f719afe13dcefb8d4009f6de4f1dd861953;
    version = 32;
    “witness_address” = 412a4d700c196a78f8ff7f0bf17d93fe6018396d2e;
    };
    “witness_signature” = b74b9fb07ba002ca2a4e11d687f9060d52cdea2a014b57101b3b5472e4f8c89c4c73cdad30f20d5d0d12a1db94a19b8a07f254a966f708c1fe757769923fad3501;
    };
    transactions = (
    {
    “raw_data” = {
    contract = (
    {
    parameter = {

:white_check_mark: [TRON] 提取区块信息成功:

  • 区块号: 73748943
  • blockID: 00000000046551cf33c0be54a66942105768beff6e117718c72a2b074a289687
  • ref_block_bytes: 51cf
  • ref_block_hash: 33c0be54a6694210
    :outbox_tray: [DeepLink] TRON交易数据构建完成: {
    “raw_data” = {
    contract = (
    {
    parameter = {
    “type_url” = “”;
    value = {
    amount = 100000;
    “owner_address” = 360f12010035210924000f0c1e2428160b052c0101;
    “to_address” = 3409351f160b3707272b0831260f15250a3534341f;
    };
    };
    type = TransferContract;
    }
    );
    data = “”;
    expiration = 1751905105892;
    “fee_limit” = 10000000;
    “ref_block_bytes” = 51cf;
    “ref_block_hash” = 33c0be54a6694210;
    timestamp = 1751905045892;
    };
    visible = 0;
    }
    :link: [DeepLink] 发送TRON pushTransaction请求
    NSBundle (null) initWithPath failed because the resolved path is empty or nil
    :link: [DeepLink] TRON PushTransaction 请求参数:
  • dappName: Wallet
  • actionId: wallet-tron-tx-1751905045
  • blockchains: (
    “<TPChainObj: 0x11b85bea0>”
    )
  • txData: {
    “raw_data” = {
    contract = (
    {
    parameter = {
    “type_url” = “”;
    value = {
    amount = 100000;
    “owner_address” = 360f12010035210924000f0c1e2428160b052c0101;
    “to_address” = 3409351f160b3707272b0831260f15250a3534341f;
    };
    };
    type = TransferContract;
    }
    );
    data = “”;
    expiration = 1751905105892;
    “fee_limit” = 10000000;
    “ref_block_bytes” = 51cf;
    “ref_block_hash” = 33c0be54a6694210;
    timestamp = 1751905045892;
    };
    visible = 0;
    }
    :white_check_mark: [DeepLink] TRON pushTransaction请求已发送到TokenPocket

跳转到tp钱包后 提示钱包未导入

你在TP上导入对应的TRON钱包了吗

已经导入了,可以跳转到tp钱包授权选择对应钱包 获取钱包地址,通过这个地址也能查到余额

跟您确认一下流程
1.从第三方app跳转tp钱包授权登录
2.跳转tp钱包进行签名授权
3.通过TPPushTransactionObj发起交易 跳转tp钱包授权交易

[DeepLink] TRON PushTransaction 请求参数:

  • dappName: Wallet
  • actionId: wallet-tron-tx-1751944100
  • blockchains: (
    “<TPChainObj: 0x11f8d9700>”
    )
  • txData: {
    “raw_data” = {
    contract = (
    {
    parameter = {
    “type_url” = “”;
    value = {
    amount = 100000;
    “owner_address” = 360f12010035210924000f0c1e2428160b052c0101;
    “to_address” = 3409351f160b3707272b0831260f15250a3534341f;
    };
    };
    type = TransferContract;
    }
    );
    data = “”;
    expiration = 1751886648000;
    “fee_limit” = 150000000;
    “ref_block_bytes” = 84a7;
    “ref_block_hash” = 896d59d34cb62865;
    timestamp = 1751944100600;
    };
    visible = 0;
    }

结果是跳转到tp钱包后,提示钱包未导入

你好 这个钱包未导入的原因是什么 你有遇到过吗

贴一下构建好的deeplink原始数据(不是你上面log的)

感谢你的回复,请问我在iOS原生代码使用tpsdk.framewrok的情况下构造trx交易数据的时候,是否要对交易的内容进行protobuf序列化
如果不需要序列化,有列子可以参考吗

具体数据示例看这里 tp-wallet-sdk/TxData Example.md at master · TP-Lab/tp-wallet-sdk · GitHub

我理解不用序列化,你按照SDK的入参就行了

但是这个参数的 raw_data_hex 这个值如何生成呢… 我用tronweb的方式构造交易可以获取,原生的方式如何获取呢
现在我使用原生和webtron都卡在“钱包未导入”的状态…
好几天了,期待你的帮助

TP SDK不提供获取raw_data_hex的方法;
你这边只是iOS端遇到问题么,Android端正常?可以对比一下两端的差异..

你好,我这边只有iOS端,所以我现在卡在转账-“钱包未导入”的状态…