Skip to content

Commit 6a787bf

Browse files
kiok46rkalis
andauthored
Replace import-assertions syntax by import-attributes (#227)
Co-authored-by: Rosco Kalis <roscokalis@gmail.com>
1 parent 66c7724 commit 6a787bf

File tree

19 files changed

+28
-28
lines changed

19 files changed

+28
-28
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Using the CashScript SDK, you can import contract artifact files, create new ins
6060
```ts
6161
...
6262
// Import the P2PKH artifact
63-
import P2PKH from './p2pkh-artifact.json' assert { type: 'json' };
63+
import P2PKH from './p2pkh-artifact.json' with { type: 'json' };
6464

6565
// Instantiate a network provider for CashScript's network operations
6666
const provider = new ElectrumNetworkProvider('mainnet');

examples/testing-suite/test/example.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import artifact from '../artifacts/example.json' assert { type: 'json' };
1+
import artifact from '../artifacts/example.json' with { type: 'json' };
22
import { Contract, MockNetworkProvider, randomUtxo } from 'cashscript';
33
import 'cashscript/jest';
44

packages/cashscript/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Using the CashScript SDK, you can import contract artifact files, create new ins
3131
```ts
3232
...
3333
// Import the P2PKH artifact
34-
import P2PKH from './p2pkh-artifact.json' assert { type: 'json' };
34+
import P2PKH from './p2pkh-artifact.json' with { type: 'json' };
3535

3636
// Instantiate a network provider for CashScript's network operations
3737
const provider = new ElectrumNetworkProvider('mainnet');

packages/cashscript/test/Contract.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import {
1111
import {
1212
alicePkh, alicePriv, alicePub, bobPriv,
1313
} from './fixture/vars.js';
14-
import p2pkhArtifact from './fixture/p2pkh.json' assert { type: 'json' };
15-
import twtArtifact from './fixture/transfer_with_timeout.json' assert { type: 'json' };
16-
import hodlVaultArtifact from './fixture/hodl_vault.json' assert { type: 'json' };
17-
import mecenasArtifact from './fixture/mecenas.json' assert { type: 'json' };
18-
import boundedBytesArtifact from './fixture/bounded_bytes.json' assert { type: 'json' };
14+
import p2pkhArtifact from './fixture/p2pkh.json' with { type: 'json' };
15+
import twtArtifact from './fixture/transfer_with_timeout.json' with { type: 'json' };
16+
import hodlVaultArtifact from './fixture/hodl_vault.json' with { type: 'json' };
17+
import mecenasArtifact from './fixture/mecenas.json' with { type: 'json' };
18+
import boundedBytesArtifact from './fixture/bounded_bytes.json' with { type: 'json' };
1919

2020
describe('Contract', () => {
2121
describe('new', () => {

packages/cashscript/test/e2e/Announcement.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
createOpReturnOutput, randomUtxo, utxoComparator,
88
} from '../../src/utils.js';
99
import { aliceAddress } from '../fixture/vars.js';
10-
import artifact from '../fixture/announcement.json' assert { type: 'json' };
10+
import artifact from '../fixture/announcement.json' with { type: 'json' };
1111

1212
describe('Announcement', () => {
1313
let announcement: Contract;

packages/cashscript/test/e2e/BigInt.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
Network,
99
} from '../../src/index.js';
1010
import { getTxOutputs } from '../test-util.js';
11-
import artifact from '../fixture/bigint.json' assert { type: 'json' };
11+
import artifact from '../fixture/bigint.json' with { type: 'json' };
1212
import { randomUtxo } from '../../src/utils.js';
1313

1414
describe('BigInt', () => {

packages/cashscript/test/e2e/FullStack.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from '../fixture/vars.js';
99
import { getTxOutputs } from '../test-util.js';
1010
import { FailedRequireError } from '../../src/Errors.js';
11-
import artifact from '../fixture/p2pkh.json' assert { type: 'json' };
11+
import artifact from '../fixture/p2pkh.json' with { type: 'json' };
1212

1313
describe.skip('P2PKH (using FullStackNetworkProvider)', () => {
1414
let p2pkhInstance: Contract;

packages/cashscript/test/e2e/HodlVault.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from '../fixture/vars.js';
1414
import { getTxOutputs } from '../test-util.js';
1515
import { FailedRequireError } from '../../src/Errors.js';
16-
import artifact from '../fixture/hodl_vault.json' assert { type: 'json' };
16+
import artifact from '../fixture/hodl_vault.json' with { type: 'json' };
1717
import { randomUtxo } from '../../src/utils.js';
1818

1919
describe('HodlVault', () => {

packages/cashscript/test/e2e/Mecenas.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '../fixture/vars.js';
1010
import { getTxOutputs } from '../test-util.js';
1111
import { FailedRequireError } from '../../src/Errors.js';
12-
import artifact from '../fixture/mecenas.json' assert { type: 'json' };
12+
import artifact from '../fixture/mecenas.json' with { type: 'json' };
1313
import { randomUtxo } from '../../src/utils.js';
1414

1515
// Mecenas has tx.age check omitted for testing

packages/cashscript/test/e2e/P2PKH-tokens.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '../fixture/vars.js';
1010
import { getTxOutputs } from '../test-util.js';
1111
import { Network, TokenDetails, Utxo } from '../../src/interfaces.js';
12-
import artifact from '../fixture/p2pkh.json' assert { type: 'json' };
12+
import artifact from '../fixture/p2pkh.json' with { type: 'json' };
1313

1414
describe('P2PKH-tokens', () => {
1515
let p2pkhInstance: Contract;

packages/cashscript/test/e2e/P2PKH.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Network, Utxo } from '../../src/interfaces.js';
1616
import {
1717
createOpReturnOutput, randomUtxo, utxoComparator,
1818
} from '../../src/utils.js';
19-
import artifact from '../fixture/p2pkh.json' assert { type: 'json' };
19+
import artifact from '../fixture/p2pkh.json' with { type: 'json' };
2020

2121
describe('P2PKH-no-tokens', () => {
2222
let p2pkhInstance: Contract;

packages/cashscript/test/e2e/TokenCategoryCheck.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
Contract, ElectrumNetworkProvider, FailedRequireError, MockNetworkProvider,
44
} from '../../src/index.js';
55
import { Network, Utxo } from '../../src/interfaces.js';
6-
import artifact from '../fixture/token_category_comparison.json' assert { type: 'json' };
6+
import artifact from '../fixture/token_category_comparison.json' with { type: 'json' };
77

88
describe('TokenCategoryCheck', () => {
99
let tokenCategoryCheckInstance: Contract;

packages/cashscript/test/e2e/TransferWithTimeout.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
alicePriv, alicePub, bobPriv, bobPub,
1111
} from '../fixture/vars.js';
1212
import { getTxOutputs } from '../test-util.js';
13-
import artifact from '../fixture/transfer_with_timeout.json' assert { type: 'json' };
13+
import artifact from '../fixture/transfer_with_timeout.json' with { type: 'json' };
1414
import { randomUtxo } from '../../src/utils.js';
1515

1616
describe('TransferWithTimeout', () => {

packages/cashscript/test/e2e/misc.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
Contract, MockNetworkProvider, ElectrumNetworkProvider, Network,
44
} from '../../src/index.js';
55
import { getTxOutputs } from '../test-util.js';
6-
import artifact from '../fixture/simple_covenant.json' assert { type: 'json' };
6+
import artifact from '../fixture/simple_covenant.json' with { type: 'json' };
77

88
describe('Simple Covenant', () => {
99
const provider = process.env.TESTS_USE_MOCKNET

packages/cashscript/test/e2e/old/Mecenas.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '../../fixture/vars.js';
1616
import { getTxOutputs } from '../../test-util.js';
1717
import { FailedTransactionError } from '../../../src/Errors.js';
18-
import artifact from '../../fixture/old/mecenas.json' assert { type: 'json' };
18+
import artifact from '../../fixture/old/mecenas.json' with { type: 'json' };
1919

2020
if (!process.env.TESTS_USE_MOCKNET) {
2121
// Mecenas has tx.age check omitted for testing

packages/cashscript/test/e2e/old/misc.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import {
1313
alicePriv,
1414
} from '../../fixture/vars.js';
1515
import { getTxOutputs } from '../../test-util.js';
16-
import simpleCovenantArtifact from '../../fixture/old/simple_covenant.json' assert { type: 'json' };
17-
import mecenasBorderArtifact from '../../fixture/old/mecenas_border.json' assert { type: 'json' };
16+
import simpleCovenantArtifact from '../../fixture/old/simple_covenant.json' with { type: 'json' };
17+
import mecenasBorderArtifact from '../../fixture/old/mecenas_border.json' with { type: 'json' };
1818

1919
if (!process.env.TESTS_USE_MOCKNET) {
2020
describe('v0.6.0 - Simple Covenant', () => {

packages/cashscript/test/e2e/transaction-builder/TransactionBuilder.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {
1111
} from '../../fixture/vars.js';
1212
import { Network, Utxo } from '../../../src/interfaces.js';
1313
import { utxoComparator, calculateDust } from '../../../src/utils.js';
14-
import p2pkhArtifact from '../../fixture/p2pkh.json' assert { type: 'json' };
15-
import twtArtifact from '../../fixture/transfer_with_timeout.json' assert { type: 'json' };
14+
import p2pkhArtifact from '../../fixture/p2pkh.json' with { type: 'json' };
15+
import twtArtifact from '../../fixture/transfer_with_timeout.json' with { type: 'json' };
1616
import { TransactionBuilder } from '../../../src/TransactionBuilder.js';
1717
import { getTxOutputs } from '../../test-util.js';
1818

packages/cashscript/test/fixture/libauth-template/fixtures.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Contract, HashType, MockNetworkProvider, SignatureAlgorithm, SignatureTemplate, Transaction, randomNFT, randomToken, randomUtxo } from '../../../src/index.js';
2-
import TransferWithTimeout from '../transfer_with_timeout.json' assert { type: 'json' };
3-
import Mecenas from '../mecenas.json' assert { type: 'json' };
4-
import P2PKH from '../p2pkh.json' assert { type: 'json' };
5-
import HoldVault from '../hodl_vault.json' assert { type: 'json' };
2+
import TransferWithTimeout from '../transfer_with_timeout.json' with { type: 'json' };
3+
import Mecenas from '../mecenas.json' with { type: 'json' };
4+
import P2PKH from '../p2pkh.json' with { type: 'json' };
5+
import HoldVault from '../hodl_vault.json' with { type: 'json' };
66
import { aliceAddress, alicePkh, alicePriv, alicePub, bobPkh, bobPriv, bobPub, oracle, oraclePub } from '../vars.js';
77
import { WalletTemplate, hexToBin } from '@bitauth/libauth';
88

website/docs/sdk/testing-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ contract Example() {
9898
```
9999

100100
```ts title="Example test file"
101-
import artifact from '../artifacts/example.json' assert { type: "json" };
101+
import artifact from '../artifacts/example.json' with { type: "json" };
102102
import { Contract, MockNetworkProvider, randomUtxo } from 'cashscript';
103103
import 'cashscript/jest';
104104

0 commit comments

Comments
 (0)