@ar.io/sdk 4.0.0-solana.8 → 4.0.0-solana.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,7 +36,7 @@ function toGeneratedFundingSourceSpec(s) {
36
36
  return { kind: kindMap[s.kind], amount: s.amount };
37
37
  }
38
38
  import { getSyncAttributesInstruction } from '@ar.io/solana-contracts/ant';
39
- import { getApprovePrimaryNameInstructionAsync, getCloseExpiredRequestInstruction, getCreateVaultInstructionAsync, getExtendVaultInstructionAsync, getIncreaseVaultInstructionAsync, getReleaseVaultInstructionAsync, getRequestAndSetPrimaryNameFromFundingPlanInstructionAsync, getRequestPrimaryNameFromFundingPlanInstructionAsync, getRequestPrimaryNameInstructionAsync, getRevokeVaultInstructionAsync, getVaultedTransferInstructionAsync, } from '@ar.io/solana-contracts/core';
39
+ import { getApprovePrimaryNameInstructionAsync, getCloseExpiredRequestInstruction, getCreateVaultInstructionAsync, getExtendVaultInstructionAsync, getIncreaseVaultInstructionAsync, getReleaseVaultInstructionAsync, getRequestAndSetPrimaryNameFromFundingPlanInstructionAsync, getRequestAndSetPrimaryNameInstructionAsync, getRequestPrimaryNameFromFundingPlanInstructionAsync, getRequestPrimaryNameInstructionAsync, getRevokeVaultInstructionAsync, getVaultedTransferInstructionAsync, } from '@ar.io/solana-contracts/core';
40
40
  import { getDelegationDecoder, getGatewayDecoder, } from '@ar.io/solana-contracts/gar';
41
41
  import { Protocol, getAllowDelegateInstructionAsync, getCancelWithdrawalInstruction, getClaimDelegateFromLeavingGatewayInstructionAsync, getClaimWithdrawalInstructionAsync, getCloseDrainedWithdrawalInstruction, getCloseEmptyDelegationInstruction, getCloseEpochInstructionAsync, getCloseObservationInstructionAsync, getCreateEpochInstructionAsync, getDecreaseDelegateStakeInstructionAsync, getDecreaseOperatorStakeInstructionAsync, getDelegateStakeInstructionAsync, getDisallowDelegateInstructionAsync, getDistributeEpochInstructionAsync, getFinalizeGoneInstructionAsync, getIncreaseOperatorStakeInstructionAsync, getInstantWithdrawalInstructionAsync, getJoinNetworkInstructionAsync, getLeaveNetworkInstructionAsync, getPrescribeEpochInstructionAsync, getPruneGatewayInstructionAsync, getRedelegateStakeInstructionAsync, getSaveObservationsInstructionAsync, getSetAllowlistEnabledInstructionAsync, getTallyWeightsInstructionAsync, getUpdateGatewaySettingsInstructionAsync, } from '@ar.io/solana-contracts/gar';
42
42
  import { getTransferCheckedInstruction } from '@solana-program/token';
@@ -1415,23 +1415,28 @@ export class SolanaARIOWriteable extends SolanaARIOReadable {
1415
1415
  const coreConfig = await this.getCoreConfig();
1416
1416
  const signerATA = await getAssociatedTokenAddressKit(coreConfig.mint, this.signer.address);
1417
1417
  const { remaining, antProgram } = await this._buildPrimaryNameValidationAccounts(params.name, 'requestAndSet');
1418
+ let ix;
1418
1419
  if (!params.fundFrom ||
1419
1420
  params.fundFrom === 'balance' ||
1420
1421
  params.fundFrom === 'turbo') {
1421
- // Direct-transfer path: delegate to requestPrimaryName for now (this
1422
- // matches the pre-Phase-4 placeholder; the on-chain
1423
- // request_and_set_primary_name ix uses the same fee charge so the
1424
- // routing is functionally identical).
1425
- void signerATA;
1426
- return this.requestPrimaryName(params, _options);
1422
+ ix = withRemainingAccounts(await getRequestAndSetPrimaryNameInstructionAsync(await this.withCoreDefaults({
1423
+ initiatorTokenAccount: signerATA,
1424
+ protocolTokenAccount: coreConfig.treasury,
1425
+ initiator: this.signer,
1426
+ name: params.name,
1427
+ reverseLookupHash: hashName(params.name),
1428
+ antProgramId: antProgram,
1429
+ }), { programAddress: this.coreProgram }), remaining);
1430
+ }
1431
+ else {
1432
+ ix = await this._buildPrimaryNameFromFundingPlanIx({
1433
+ params,
1434
+ coreConfig,
1435
+ validationAccounts: remaining,
1436
+ operation: 'requestAndSet',
1437
+ antProgramId: antProgram,
1438
+ });
1427
1439
  }
1428
- const ix = await this._buildPrimaryNameFromFundingPlanIx({
1429
- params,
1430
- coreConfig,
1431
- validationAccounts: remaining,
1432
- operation: 'requestAndSet',
1433
- antProgramId: antProgram,
1434
- });
1435
1440
  const sig = await this.sendTransaction([ix]);
1436
1441
  return { id: sig };
1437
1442
  }
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '4.0.0-solana.8';
17
+ export const version = '4.0.0-solana.9';
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "4.0.0-solana.7";
16
+ export declare const version = "4.0.0-solana.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "4.0.0-solana.8",
3
+ "version": "4.0.0-solana.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"
@@ -61,10 +61,14 @@
61
61
  "test": "yarn test:unit && yarn test:e2e",
62
62
  "test:esm": "yarn build:esm && yarn link && cd ./tests/e2e/esm && yarn && yarn test",
63
63
  "test:web": "yarn build:esm && yarn link && cd ./tests/e2e/web && yarn && yarn test",
64
- "test:unit": "c8 tsx --test --test-reporter=spec --enable-source-maps --trace-warnings $(find src -type f -name '*.test.ts')",
64
+ "test:unit": "c8 tsx --test --test-reporter=spec --enable-source-maps --trace-warnings $(find src -type f -name '*.test.ts' -not -name '*.localnet.test.ts' -not -name '*.cross.test.ts' -not -name '*.e2e.test.ts')",
65
65
  "test:link": "yarn build && yarn link",
66
66
  "test:e2e": "yarn test:esm && yarn test:web",
67
67
  "test:integration": "yarn build:esm && yarn link && cd ./tests/integration && yarn && yarn test",
68
+ "test:localnet:io-write": "tsx --test --test-reporter=spec src/solana/io-writeable.localnet.test.ts",
69
+ "sdk-e2e:up": "bash scripts/sdk-e2e-bootstrap.sh",
70
+ "test:sdk-e2e:run": "tsx --test --test-reporter=spec src/solana/sdk.e2e.test.ts",
71
+ "test:sdk-e2e": "bash -c 'set -a && source test/.env.e2e && set +a && yarn test:sdk-e2e:run'",
68
72
  "prepare": "husky install",
69
73
  "docs:update": "markdown-toc-gen insert README.md --max-depth 2",
70
74
  "example:esm": "cd examples/esm && yarn && node index.mjs",