Skip to content

Commit 08f2ec5

Browse files
authored
Merge pull request #96 from wavesplatform/github-workflow
fix workflow and tests
2 parents 358eba4 + 08cebdd commit 08f2ec5

9 files changed

Lines changed: 56 additions & 42 deletions

File tree

.github/workflows/publish.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@ permissions:
1010
id-token: write
1111
jobs:
1212
publish-snapshots:
13+
name: Publish snapshot packages
14+
runs-on: ubuntu-latest
1315
env:
1416
NODE_OPTIONS: --openssl-legacy-provider
17+
TAG: snapshot
1518
environment:
1619
name: NPMJS
1720
url: ${{ steps.publish.outputs.url }}
18-
name: Publish snapshot packages
19-
runs-on: ubuntu-latest
2021
steps:
2122
- uses: actions/checkout@v4
2223
- uses: actions/setup-node@v4
2324
with:
2425
registry-url: 'https://registry.npmjs.org'
2526
node-version: '>=24.7.0'
26-
- run: npm i
27+
- run: npm ci
2728
- if: ${{ github.event_name == 'push' }}
2829
run: |
2930
PACKAGE_NAME=$(jq --raw-output .name package.json)
@@ -41,5 +42,6 @@ jobs:
4142
- id: publish
4243
run: |
4344
npm run build
45+
echo "Publishing version=$(jq -r .version package.json) tag=$TAG"
4446
npm publish --provenance --access public --tag $TAG
4547
echo "url=https://www.npmjs.com/package/@waves/signer/v/$(jq --raw-output .version package.json)" >> "$GITHUB_OUTPUT"

src/validation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ export const sponsorshipArgsScheme = {
190190
...getCommonValidators(TRANSACTION_TYPE.SPONSORSHIP),
191191
// TODO Add not WAVES ASSET ID
192192
assetId: isString,
193-
minSponsoredAssetFee: isNumberLike,
193+
minSponsoredAssetFee: (value: unknown) =>
194+
value === null || isNumberLike(value),
194195
};
195196
export const sponsorshipArgsValidator = validator(
196197
sponsorshipArgsScheme as any,

test/TestProvider.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
TypedData,
1313
UserData,
1414
} from '../src';
15-
import { TRANSACTION_TYPE } from '@waves/waves-transactions/dist/transactions';
15+
import { TRANSACTION_TYPE } from '@waves/ts-types';
1616

1717
export class TestProvider implements Provider {
1818
private options: ConnectOptions = {
@@ -92,14 +92,20 @@ export class TestProvider implements Provider {
9292
tx.type === TRANSACTION_TYPE.ALIAS
9393
? { ...tx, alias: tx.alias.replace(/alias:.:/, '') }
9494
: tx;
95+
const fixIssueDescription = (tx: any) =>
96+
tx.type === TRANSACTION_TYPE.ISSUE && tx.description == null
97+
? { ...tx, description: '' }
98+
: tx;
9599

96100
return Promise.resolve(
97101
list.map((item) =>
98102
signTx(
99-
fixAlias({
100-
chainId: this.options.NETWORK_BYTE,
101-
...item,
102-
}) as any,
103+
fixIssueDescription(
104+
fixAlias({
105+
chainId: this.options.NETWORK_BYTE,
106+
...item,
107+
})
108+
) as any,
103109
this.seed
104110
)
105111
)

test/transactions/alias.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Signer from '../../src/Signer';
33
import { TestProvider } from '../TestProvider';
44
import { MASTER_ACCOUNT_SEED } from '@waves/node-state/dist/constants';
55

6-
let waves: Signer = new Signer();
6+
let waves: Signer;
77
let provider: TestProvider = new TestProvider(MASTER_ACCOUNT_SEED);
88

99

test/transactions/data.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { TestProvider } from '../TestProvider';
44
import { MASTER_ACCOUNT_SEED } from '@waves/node-state/dist/constants';
55

66

7-
let waves: Signer = new Signer();
7+
let waves: Signer;
88
let provider: TestProvider = new TestProvider(MASTER_ACCOUNT_SEED);
99

1010

test/transactions/leasing.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { libs } from '@waves/waves-transactions';
55

66

77
const MASTER_ADDRESS = libs.crypto.address(ACCOUNTS.NODE.seed, NETWORK_BYTE);
8-
let waves: Signer = new Signer();
8+
let waves: Signer;
99
let provider: TestProvider = new TestProvider(ACCOUNTS.SIMPLE.seed);
1010

1111

test/transactions/sponsorship.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ it('Cancel Sponsorship', async () => {
4040
await waves
4141
.sponsorship({
4242
assetId: asset.id,
43-
minSponsoredAssetFee: 0
43+
minSponsoredAssetFee: null
4444
})
4545
.broadcast();
4646
});

test/transactions/tokens.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { TestProvider } from '../TestProvider';
44
import { MASTER_ACCOUNT_SEED } from '@waves/node-state/dist/constants';
55

66

7-
let waves: Signer = new Signer();
7+
let waves: Signer;
88
let provider: TestProvider = new TestProvider(MASTER_ACCOUNT_SEED);
99

1010

test/transactions/transfers.spec.ts

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import Signer from '../../src/Signer';
33
import { TestProvider } from '../TestProvider';
44
import { libs } from '@waves/waves-transactions';
55

6-
76
const MASTER_ADDRESS = libs.crypto.address(ACCOUNTS.SIMPLE.seed, NETWORK_BYTE);
8-
let waves: Signer = new Signer();
7+
let waves: Signer;
98
let provider: TestProvider = new TestProvider(ACCOUNTS.SIMPLE.seed);
109

1110
beforeEach(() => {
@@ -24,11 +23,13 @@ it('Transfer Signer', async () => {
2423
});
2524

2625
it('Transfer custom asset', async () => {
27-
const [{ id }] = await waves.issue({
28-
name: 'Bitcoin',
29-
decimals: 8,
30-
quantity: 10000,
31-
}).broadcast();
26+
const [{ id }] = await waves
27+
.issue({
28+
name: 'Bitcoin',
29+
decimals: 8,
30+
quantity: 10000,
31+
})
32+
.broadcast();
3233

3334
await waves
3435
.transfer({
@@ -40,11 +41,13 @@ it('Transfer custom asset', async () => {
4041
});
4142

4243
it('Transfer two transactions', async () => {
43-
const [{ id }] = await waves.issue({
44-
name: 'Bitcoin',
45-
decimals: 8,
46-
quantity: 10000,
47-
}).broadcast();
44+
const [{ id }] = await waves
45+
.issue({
46+
name: 'Bitcoin',
47+
decimals: 8,
48+
quantity: 10000,
49+
})
50+
.broadcast();
4851

4952
await waves
5053
.transfer({
@@ -61,11 +64,13 @@ it('Transfer two transactions', async () => {
6164
});
6265

6366
it('Transfer smart asset', async () => {
64-
const [{ id }] = await waves.issue({
65-
name: 'Bitcoin',
66-
decimals: 8,
67-
quantity: 10000,
68-
}).broadcast();
67+
const [{ id }] = await waves
68+
.issue({
69+
name: 'Bitcoin',
70+
decimals: 8,
71+
quantity: 10000,
72+
})
73+
.broadcast();
6974

7075
const [tx] = await waves
7176
.transfer({
@@ -82,26 +87,26 @@ it('Transfer smart asset', async () => {
8287
it('Mass transfer Signer', async () => {
8388
await waves
8489
.massTransfer({
85-
transfers: [
86-
{ recipient: MASTER_ADDRESS, amount: Math.pow(10, 8) }
87-
],
90+
transfers: [{ recipient: MASTER_ADDRESS, amount: Math.pow(10, 8) }],
91+
attachment: null,
8892
})
8993
.broadcast();
9094
});
9195

9296
it('Mass transfer asset', async () => {
93-
const [{ id }] = await waves.issue({
94-
name: 'Bitcoin',
95-
decimals: 8,
96-
quantity: 10000,
97-
}).broadcast();
97+
const [{ id }] = await waves
98+
.issue({
99+
name: 'Bitcoin',
100+
decimals: 8,
101+
quantity: 10000,
102+
})
103+
.broadcast();
98104

99105
await waves
100106
.massTransfer({
101107
assetId: id,
102-
transfers: [
103-
{ recipient: MASTER_ADDRESS, amount: Math.pow(10, 8) },
104-
],
108+
transfers: [{ recipient: MASTER_ADDRESS, amount: Math.pow(10, 8) }],
109+
attachment: null,
105110
})
106111
.broadcast();
107112
});

0 commit comments

Comments
 (0)