Skip to content

Commit

Permalink
feat(sdk-coin-oas): add oas sdk skeleton
Browse files Browse the repository at this point in the history
Ticket: WIN-3696
  • Loading branch information
adarsh312 committed Nov 11, 2024
1 parent bad6f96 commit 1306d26
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 15 deletions.
3 changes: 3 additions & 0 deletions modules/sdk-coin-oas/src/lib/transactionBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { getCommon } from './utils';
import { TransferBuilder } from './transferBuilder';

export class TransactionBuilder extends AbstractTransactionBuilder {
amount(arg0: number) {
throw new Error('Method not implemented.');
}
protected _transfer: TransferBuilder;

constructor(_coinConfig: Readonly<CoinConfig>) {
Expand Down
4 changes: 4 additions & 0 deletions modules/sdk-coin-oas/test/resources/oas.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { KeyPair } from '@bitgo/abstract-eth';

export const TEST_ACCOUNT = {
seed: '4b3b89f6ca897cb729d2146913877f71',
ethPrivateKey: 'ABAF3CD623F5353A143AB5E2EF47CEBD94877460D3C6F5A273313DE98F96DBBC',
Expand All @@ -10,3 +12,5 @@ export const TEST_ACCOUNT = {
'xprv9s21ZrQH143K2MJE1yvV8UhjfLQcaDPPipMYvfYjrPbHLptLsnt1FbbCrCT9E5LCmRrS593YZ1CKgf3rf3C2hYTynZN5au3VvBvLcWh8sV2',
ethAddress: '0x1374a2046661f914d1687d85dbbceb9ac7910a29',
};

export const KEYPAIR_PRV = new KeyPair({ prv: 'ABAF3CD623F5353A143AB5E2EF47CEBD94877460D3C6F5A273313DE98F96DBBC' });
47 changes: 32 additions & 15 deletions modules/sdk-coin-oas/test/unit/transactionBuilder/send.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
import { getBuilder } from '../getBuilder';
import should from 'should';
// import { getBuilder } from '../getBuilder';
// import should from 'should';
// import * as testData from '../../resources/oas';

describe('OAS Transfer Builder', () => {
describe('Build from TxHex', function () {
it('Should successfully build from txHex', async function () {
const txBuilder = getBuilder('toas');
const txHex =
'0xf9018e018541314cf000836acfc0948ce59c2d1702844f8eded451aa103961bc37b4e880b9016439125215000000000000000000000000eeaf0f05f37891ab4a21208b105a0687d12c5af7000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004105d7520d2834b2e789206d4b016346247147838c32bd8dc12cf189d296a5e66219daf603c940897d2eb847dcd3bdb261cdc287596e757e16736711a7cd23f94f1b00000000000000000000000000000000000000000000000000000000000000830271cb8080';
txBuilder.from(txHex);
const parsedTx = await txBuilder.build();

should.exist(parsedTx.toJson());
});
});
});
// describe('OAS Transfer Builder', () => {
// describe('Build from TxHex', function () {
// it('Should successfully build from txHex', async function () {
// const txBuilder = getBuilder('toas');
// const privatekey = "ABAF3CD623F5353A143AB5E2EF47CEBD94877460D3C6F5A273313DE98F96DBBC";
// const recipient = '0x19645032c7f1533395d44a629462e751084d3e4c';
// const amount = '1000000000';
// const expireToime = 1590066728;
// const sequenceId = 5;
// const key = testData.KEYPAIR_PRV.getKeys().prv as string;
// txBuilder.fee({
// fee: '1000000000',
// gasLimit: '12100000',
// });
// txBuilder
// .transfer()
// .amount(amount)
// .to(recipient)
// .expirationTime(expireTime)
// .contractSequenceId(sequenceId)
// .key(key);
//
// txBuilder.sign({ key: privatekey });
//
// const tx = await txBuilder.build();
//
// });
// });
// });

0 comments on commit 1306d26

Please sign in to comment.