feat: 接入天河链延时确认
This commit is contained in:
@@ -37,5 +37,32 @@ describe('TianheProvider', () => {
|
||||
expect(result.explorerUrl).toBe(response.data.url);
|
||||
expect(result.raw.digest).toBe(response.data.digest);
|
||||
expect(result.raw.transactionStatus).toBe('submitted');
|
||||
expect(result.confirmationRequired).toBe(true);
|
||||
});
|
||||
|
||||
it('按交易状态接口确认链上区块信息', async () => {
|
||||
const response = {
|
||||
code: 0,
|
||||
message: 'success',
|
||||
data: {
|
||||
status: '0x0',
|
||||
blockHash: '0xblockhash',
|
||||
blockNum: 12345,
|
||||
transactionHash: '0x1234567890abcdef',
|
||||
tokenId: -999,
|
||||
},
|
||||
};
|
||||
jest.spyOn(globalThis, 'fetch').mockResolvedValue({
|
||||
ok: true,
|
||||
text: async () => JSON.stringify(response),
|
||||
} as Response);
|
||||
|
||||
const result = await provider.confirmTransaction(response.data.transactionHash);
|
||||
|
||||
expect(result.confirmed).toBe(true);
|
||||
expect(result.txHash).toBe(response.data.transactionHash);
|
||||
expect(result.blockHash).toBe(response.data.blockHash);
|
||||
expect(result.blockHeight).toBe(response.data.blockNum);
|
||||
expect(result.raw.transactionStatus).toBe('confirmed');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user