@ar.io/sdk 4.0.0-solana.30 → 4.0.0-solana.31

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.
@@ -53,7 +53,7 @@ function toGeneratedFundingSourceSpec(s) {
53
53
  import { getSyncAttributesInstruction } from '@ar.io/solana-contracts/ant';
54
54
  import { getApprovePrimaryNameInstructionAsync, getCloseExpiredRequestInstruction, getCreateVaultInstructionAsync, getExtendVaultInstructionAsync, getIncreaseVaultInstructionAsync, getReleaseVaultInstructionAsync, getRemovePrimaryNameInstructionAsync, getRequestAndSetPrimaryNameFromFundingPlanInstructionAsync, getRequestAndSetPrimaryNameInstructionAsync, getRequestPrimaryNameFromFundingPlanInstructionAsync, getRequestPrimaryNameInstructionAsync, getRevokeVaultInstructionAsync, getVaultedTransferInstructionAsync, } from '@ar.io/solana-contracts/core';
55
55
  import { getDelegationDecoder, getGatewayDecoder, } from '@ar.io/solana-contracts/gar';
56
- import { Protocol, getAllowDelegateInstructionAsync, getCancelWithdrawalInstruction, getClaimDelegateFromDisabledGatewayInstructionAsync, 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';
56
+ import { Protocol, getAllowDelegateInstructionAsync, getCancelWithdrawalInstruction, getClaimDelegateFromDisabledGatewayInstructionAsync, getClaimDelegateFromLeavingGatewayInstructionAsync, getClaimWithdrawalInstructionAsync, getCloseDrainedWithdrawalInstruction, getCloseEmptyDelegationInstruction, getCloseEpochInstructionAsync, getCloseObservationInstructionAsync, getCreateEpochInstructionAsync, getDecreaseDelegateStakeInstructionAsync, getDecreaseOperatorStakeInstructionAsync, getDelegateStakeInstructionAsync, getDisallowDelegateInstructionAsync, getDistributeEpochInstructionAsync, getFinalizeGoneInstructionAsync, getIncreaseOperatorStakeInstructionAsync, getInstantWithdrawalInstructionAsync, getJoinNetworkInstructionAsync, getLeaveNetworkInstructionAsync, getPrescribeEpochInstructionAsync, getPruneGatewayInstructionAsync, getRedelegateStakeInstructionAsync, getSaveObservationsInstructionAsync, getSetAllowlistEnabledInstructionAsync, getTallyWeightsInstructionAsync, getUpdateGatewaySettingsInstructionAsync, getUpdateObserverAddressInstructionAsync, } from '@ar.io/solana-contracts/gar';
57
57
  import { getTransferCheckedInstruction } from '@solana-program/token';
58
58
  import { ARIO_ANT_PROGRAM_ID, TOKEN_DECIMALS } from './constants.js';
59
59
  import { SolanaARIOReadable } from './io-readable.js';
@@ -591,25 +591,50 @@ export class SolanaARIOWriteable extends SolanaARIOReadable {
591
591
  return { id: sig };
592
592
  }
593
593
  async updateGatewaySettings(params, _options) {
594
- const ix = await getUpdateGatewaySettingsInstructionAsync(await this.withGarDefaults({
595
- operator: this.signer,
596
- label: params.label ?? null,
597
- fqdn: params.fqdn ?? null,
598
- port: params.port ?? null,
599
- // Codama exposes `protocol` as Option<Protocol>. We only ever updated
600
- // the URL parts above, so leave protocol untouched (None).
601
- protocol: null,
602
- properties: params.properties ?? null,
603
- note: params.note ?? null,
604
- allowDelegatedStaking: typeof params.allowDelegatedStaking === 'boolean'
605
- ? params.allowDelegatedStaking
606
- : null,
607
- delegateRewardShareRatio: params.delegateRewardShareRatio ?? null,
608
- minDelegateStake: params.minDelegatedStake !== undefined
609
- ? BigInt(params.minDelegatedStake)
610
- : null,
611
- }), { programAddress: this.garProgram });
612
- const sig = await this.sendTransaction([ix], 1_000_000);
594
+ const ixs = [];
595
+ // Settings fields (label, fqdn, port, etc.) — only emit when at least one
596
+ // non-observer field is provided so we don't send a no-op instruction.
597
+ const { observerAddress: _observer, ...settingsFields } = params;
598
+ if (Object.keys(settingsFields).length > 0) {
599
+ const settingsIx = await getUpdateGatewaySettingsInstructionAsync(await this.withGarDefaults({
600
+ operator: this.signer,
601
+ label: params.label ?? null,
602
+ fqdn: params.fqdn ?? null,
603
+ port: params.port ?? null,
604
+ // Codama exposes `protocol` as Option<Protocol>. We only ever updated
605
+ // the URL parts above, so leave protocol untouched (None).
606
+ protocol: null,
607
+ properties: params.properties ?? null,
608
+ note: params.note ?? null,
609
+ allowDelegatedStaking: typeof params.allowDelegatedStaking === 'boolean'
610
+ ? params.allowDelegatedStaking
611
+ : null,
612
+ delegateRewardShareRatio: params.delegateRewardShareRatio ?? null,
613
+ minDelegateStake: params.minDelegatedStake !== undefined
614
+ ? BigInt(params.minDelegatedStake)
615
+ : null,
616
+ }), { programAddress: this.garProgram });
617
+ ixs.push(settingsIx);
618
+ }
619
+ // Observer address update — uses a separate on-chain instruction that
620
+ // swaps the observer lookup PDA from old → new.
621
+ if (params.observerAddress !== undefined) {
622
+ const newObserver = address(params.observerAddress);
623
+ const gateway = await this.getGateway({
624
+ address: this.signer.address,
625
+ });
626
+ const oldObserver = address(gateway.observerAddress);
627
+ const [oldObserverLookupPda] = await getObserverLookupPDA(oldObserver, this.garProgram);
628
+ const [newObserverLookupPda] = await getObserverLookupPDA(newObserver, this.garProgram);
629
+ const observerIx = await getUpdateObserverAddressInstructionAsync(await this.withGarDefaults({
630
+ operator: this.signer,
631
+ oldObserverLookup: oldObserverLookupPda,
632
+ newObserverLookup: newObserverLookupPda,
633
+ newObserver,
634
+ }), { programAddress: this.garProgram });
635
+ ixs.push(observerIx);
636
+ }
637
+ const sig = await this.sendTransaction(ixs, 1_000_000);
613
638
  return { id: sig };
614
639
  }
615
640
  async increaseOperatorStake(params, _options) {
@@ -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.30';
17
+ export const version = '4.0.0-solana.31';
@@ -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.29";
16
+ export declare const version = "4.0.0-solana.30";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "4.0.0-solana.30",
3
+ "version": "4.0.0-solana.31",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"